@stoprocent/noble 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@
11
11
  bool pendingRead;
12
12
  }
13
13
  @property (strong) CBCentralManager *centralManager;
14
+ @property (assign) CBManagerState lastState;
14
15
  @property dispatch_queue_t dispatchQueue;
15
16
  @property NSMutableDictionary *peripherals;
16
17
  @property NSMutableSet *discovered;
@@ -22,6 +22,15 @@
22
22
 
23
23
  - (void)centralManagerDidUpdateState:(CBCentralManager *)central
24
24
  {
25
+ if (central.state != self.lastState && self.lastState == CBManagerStatePoweredOff && central.state == CBManagerStatePoweredOn) {
26
+ [self.peripherals enumerateKeysAndObjectsUsingBlock:^(id key, CBPeripheral* peripheral, BOOL *stop) {
27
+ if (peripheral.state == CBPeripheralStateConnected) {
28
+ [self.centralManager cancelPeripheralConnection:peripheral];
29
+ }
30
+ }];
31
+ }
32
+
33
+ self.lastState = central.state;
25
34
  auto state = stateToString(central.state);
26
35
  emit.RadioState(state);
27
36
  }
@@ -142,6 +151,7 @@
142
151
  // Simulate discovery handling
143
152
  [self centralManager:central didDiscoverPeripheral:peripheral advertisementData:advertisementData RSSI:RSSI];
144
153
  }
154
+
145
155
  std::string uuid = getUuid(peripheral);
146
156
  emit.Connected(uuid, "");
147
157
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "name": "@stoprocent/noble",
8
8
  "description": "A Node.js BLE (Bluetooth Low Energy) central library.",
9
- "version": "2.1.0",
9
+ "version": "2.1.1",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/stoprocent/noble.git"