@stoprocent/noble 2.3.9 → 2.3.10

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.
@@ -703,6 +703,11 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
703
703
  mEmit.Notify(uuid, serviceId, characteristicId, true);
704
704
  return;
705
705
  }
706
+
707
+ auto onChanged = bind2(this, &BLEManager::OnValueChanged, uuid);
708
+ auto token = characteristic->ValueChanged(onChanged);
709
+ mNotifyMap.Add(uuid, *characteristic, token);
710
+
706
711
  auto descriptorValue =
707
712
  GetDescriptorValue(characteristic->CharacteristicProperties());
708
713
 
@@ -750,18 +755,16 @@ void BLEManager::OnNotify(IAsyncOperation<GattWriteResult> asyncOp, AsyncStatus
750
755
  {
751
756
  if (status == AsyncStatus::Completed)
752
757
  {
753
- if (state == true)
754
- {
755
- auto onChanged = bind2(this, &BLEManager::OnValueChanged, uuid);
756
- auto token = characteristic.ValueChanged(onChanged);
757
- mNotifyMap.Add(uuid, characteristic, token);
758
- }
759
758
  mEmit.Notify(uuid, serviceId, characteristicId, state);
760
759
  }
761
760
  else
762
761
  {
763
762
  std::string error = "status: " + std::to_string((int)status);
764
763
  mEmit.Notify(uuid, serviceId, characteristicId, state, error);
764
+ if (state == true)
765
+ {
766
+ mNotifyMap.Unsubscribe(uuid, characteristic);
767
+ }
765
768
  }
766
769
  }
767
770
 
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.3.9",
9
+ "version": "2.3.10",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/stoprocent/noble.git"