File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,7 +86,6 @@ Future<void> _startServiceLogic(
8686 ServiceInstance service,
8787 BLEAdvertiser advertiser,
8888) async {
89- await Future .delayed (const Duration (seconds: 1 ));
9089 final prefs = await SharedPreferences .getInstance ();
9190 String currentName = prefs.getString ('advertising_name_v2' ) ?? "BLE Node" ;
9291 bool advertisingOn = false ;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class BLEAdvertiser {
2424 static const messageCharUuid = '12345678-90ab-cdef-1234-567890abcdef' ;
2525
2626 static const int manufacturerId = MeshConstants .manufacturerId;
27- static const int maxNameLength = 13 ;
27+ static const int maxNameLength = 10 ;
2828
2929 static bool _initialized = false ,
3030 _servicesAdded = false ,
@@ -209,7 +209,7 @@ class BLEAdvertiser {
209209 manufacturerId: manufacturerId,
210210 data: manufacturerData,
211211 ),
212- addManufacturerDataInScanResponse: false , // Move StableId to primary packet
212+ addManufacturerDataInScanResponse: true , // Allow OS to balance between packets
213213 scanResponseManufacturerData: ManufacturerData (
214214 manufacturerId: manufacturerId,
215215 data: scanResponseData,
Original file line number Diff line number Diff line change @@ -17,8 +17,12 @@ class OnboardingController extends _$OnboardingController {
1717 final user = await ref.watch (profileControllerProvider.future);
1818 final isOnboarded = user? .isOnboarded ?? false ;
1919 if (isOnboarded) {
20- _log.info ('User already onboarded, ensuring service is running' );
21- await initializeBackgroundService ().catchError ((e) {
20+ _log.info ('User already onboarded, ensuring service is running and advertising is active' );
21+ await initializeBackgroundService ().then ((_) {
22+ if (user != null ) {
23+ FlutterBackgroundService ().invoke ("startAdvertising" , {"name" : user.username});
24+ }
25+ }).catchError ((e) {
2226 _log.severe ('Failed to auto-start background service: $e ' );
2327 });
2428 }
You can’t perform that action at this time.
0 commit comments