File tree Expand file tree Collapse file tree
lib/src/features/discovery/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,11 +166,15 @@ class BLEAdvertiser {
166166 BleCharacteristic (
167167 uuid: messageCharUuid,
168168 properties: [
169+ CharacteristicProperties .read.index,
169170 CharacteristicProperties .write.index,
170171 CharacteristicProperties .notify.index,
171172 CharacteristicProperties .indicate.index,
172173 ],
173- permissions: [AttributePermissions .writeable.index],
174+ permissions: [
175+ AttributePermissions .readable.index,
176+ AttributePermissions .writeable.index,
177+ ],
174178 value: Uint8List .fromList ([0x00 ]),
175179 ),
176180 ],
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class BLEDiscoverer {
2626 final Logger _log = Logger ('BLEDiscoverer' );
2727 final Map <int , BluetoothDevice > _syncQueue = {};
2828 final Map <int , DateTime > _lastSyncAttempt = {};
29+ final Map <int , DateTime > _lastHandshakeAttempt = {};
2930 final Set <int > _activeSyncs = {};
3031
3132 final StreamController <bool > _scanStatusController = StreamController .broadcast ();
@@ -296,7 +297,16 @@ class BLEDiscoverer {
296297 Duration (milliseconds: 1000 + Random ().nextInt (2000 )),
297298 );
298299 _lastSyncAttempt[entry.key] = DateTime .now ();
300+
301+ final lastHandshake = _lastHandshakeAttempt[entry.key];
302+ if (lastHandshake != null &&
303+ DateTime .now ().difference (lastHandshake).inMinutes < 5 ) {
304+ _log.info ('Skipping full sync for ${entry .key } due to backoff' );
305+ continue ;
306+ }
307+
299308 _activeSyncs.add (entry.key);
309+ _lastHandshakeAttempt[entry.key] = DateTime .now ();
300310
301311 service.invoke ('updateProgress' , {
302312 'value' : 1.0 ,
You can’t perform that action at this time.
0 commit comments