@stoprocent/noble 2.3.10 → 2.3.12

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.
@@ -579,10 +579,10 @@ bool BLEManager::Read(const std::string& uuid, const winrt::guid& serviceUuid,
579
579
  {
580
580
  peripheral.GetCharacteristic(
581
581
  serviceUuid, characteristicUuid, [=](std::optional<GattCharacteristic> characteristic) {
582
+ std::string serviceId = toStr(serviceUuid);
583
+ std::string characteristicId = toStr(characteristicUuid);
582
584
  if (characteristic)
583
585
  {
584
- std::string serviceId = toStr(serviceUuid);
585
- std::string characteristicId = toStr(characteristicUuid);
586
586
  characteristic->ReadValueAsync(BluetoothCacheMode::Uncached)
587
587
  .Completed(
588
588
  bind2(this, &BLEManager::OnRead, uuid, serviceId, characteristicId));
@@ -590,6 +590,7 @@ bool BLEManager::Read(const std::string& uuid, const winrt::guid& serviceUuid,
590
590
  else
591
591
  {
592
592
  LOGE("GetCharacteristic error");
593
+ mEmit.Read(uuid, serviceId, characteristicId, Data(), false, "GetCharacteristic error");
593
594
  }
594
595
  });
595
596
  return true;
@@ -631,10 +632,10 @@ bool BLEManager::Write(const std::string& uuid, const winrt::guid& serviceUuid,
631
632
  {
632
633
  peripheral.GetCharacteristic(
633
634
  serviceUuid, characteristicUuid, [=](std::optional<GattCharacteristic> characteristic) {
635
+ std::string serviceId = toStr(serviceUuid);
636
+ std::string characteristicId = toStr(characteristicUuid);
634
637
  if (characteristic)
635
638
  {
636
- std::string serviceId = toStr(serviceUuid);
637
- std::string characteristicId = toStr(characteristicUuid);
638
639
  auto writer = DataWriter();
639
640
  writer.WriteBytes(data);
640
641
  auto value = writer.DetachBuffer();
@@ -647,6 +648,7 @@ bool BLEManager::Write(const std::string& uuid, const winrt::guid& serviceUuid,
647
648
  else
648
649
  {
649
650
  LOGE("GetCharacteristic error");
651
+ mEmit.Write(uuid, serviceId, characteristicId, "GetCharacteristic error");
650
652
  }
651
653
  });
652
654
  return true;
@@ -689,10 +691,10 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
689
691
  IFDEVICE(device, uuid)
690
692
  {
691
693
  auto onCharacteristic = [=](std::optional<GattCharacteristic> characteristic) {
694
+ std::string serviceId = toStr(serviceUuid);
695
+ std::string characteristicId = toStr(characteristicUuid);
692
696
  if (characteristic)
693
697
  {
694
- std::string serviceId = toStr(serviceUuid);
695
- std::string characteristicId = toStr(characteristicUuid);
696
698
  bool subscribed = mNotifyMap.IsSubscribed(uuid, *characteristic);
697
699
 
698
700
  if (on)
@@ -703,7 +705,7 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
703
705
  mEmit.Notify(uuid, serviceId, characteristicId, true);
704
706
  return;
705
707
  }
706
-
708
+
707
709
  auto onChanged = bind2(this, &BLEManager::OnValueChanged, uuid);
708
710
  auto token = characteristic->ValueChanged(onChanged);
709
711
  mNotifyMap.Add(uuid, *characteristic, token);
@@ -741,6 +743,7 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
741
743
  else
742
744
  {
743
745
  LOGE("GetCharacteristic error");
746
+ mEmit.Notify(uuid, serviceId, characteristicId, on, "GetCharacteristic error");
744
747
  }
745
748
  };
746
749
  peripheral.GetCharacteristic(serviceUuid, characteristicUuid, onCharacteristic);
@@ -787,10 +790,10 @@ bool BLEManager::DiscoverDescriptors(const std::string& uuid, const winrt::guid&
787
790
  {
788
791
  peripheral.GetCharacteristic(
789
792
  serviceUuid, characteristicUuid, [=](std::optional<GattCharacteristic> characteristic) {
793
+ std::string serviceId = toStr(serviceUuid);
794
+ std::string characteristicId = toStr(characteristicUuid);
790
795
  if (characteristic)
791
796
  {
792
- std::string serviceId = toStr(serviceUuid);
793
- std::string characteristicId = toStr(characteristicUuid);
794
797
  auto completed = bind2(this, &BLEManager::OnDescriptorsDiscovered, uuid,
795
798
  serviceId, characteristicId);
796
799
  characteristic->GetDescriptorsAsync(BluetoothCacheMode::Uncached)
@@ -799,6 +802,8 @@ bool BLEManager::DiscoverDescriptors(const std::string& uuid, const winrt::guid&
799
802
  else
800
803
  {
801
804
  LOGE("GetCharacteristic error");
805
+ std::vector<std::string> emptyDescriptors;
806
+ mEmit.DescriptorsDiscovered(uuid, serviceId, characteristicId, emptyDescriptors, "GetCharacteristic error");
802
807
  }
803
808
  });
804
809
  return true;
@@ -836,11 +841,11 @@ bool BLEManager::ReadValue(const std::string& uuid, const winrt::guid& serviceUu
836
841
  peripheral.GetDescriptor(
837
842
  serviceUuid, characteristicUuid, descriptorUuid,
838
843
  [=](std::optional<GattDescriptor> descriptor) {
844
+ std::string serviceId = toStr(serviceUuid);
845
+ std::string characteristicId = toStr(characteristicUuid);
846
+ std::string descriptorId = toStr(descriptorUuid);
839
847
  if (descriptor)
840
848
  {
841
- std::string serviceId = toStr(serviceUuid);
842
- std::string characteristicId = toStr(characteristicUuid);
843
- std::string descriptorId = toStr(descriptorUuid);
844
849
  auto completed = bind2(this, &BLEManager::OnReadValue, uuid, serviceId,
845
850
  characteristicId, descriptorId);
846
851
  descriptor->ReadValueAsync(BluetoothCacheMode::Uncached).Completed(completed);
@@ -848,6 +853,7 @@ bool BLEManager::ReadValue(const std::string& uuid, const winrt::guid& serviceUu
848
853
  else
849
854
  {
850
855
  LOGE("descriptor not found");
856
+ mEmit.ReadValue(uuid, serviceId, characteristicId, descriptorId, Data(), "descriptor not found");
851
857
  }
852
858
  });
853
859
  return true;
@@ -888,11 +894,11 @@ bool BLEManager::WriteValue(const std::string& uuid, const winrt::guid& serviceU
888
894
  IFDEVICE(device, uuid)
889
895
  {
890
896
  auto onDescriptor = [=](std::optional<GattDescriptor> descriptor) {
897
+ std::string serviceId = toStr(serviceUuid);
898
+ std::string characteristicId = toStr(characteristicUuid);
899
+ std::string descriptorId = toStr(descriptorUuid);
891
900
  if (descriptor)
892
901
  {
893
- std::string serviceId = toStr(serviceUuid);
894
- std::string characteristicId = toStr(characteristicUuid);
895
- std::string descriptorId = toStr(descriptorUuid);
896
902
  auto writer = DataWriter();
897
903
  writer.WriteBytes(data);
898
904
  auto value = writer.DetachBuffer();
@@ -903,6 +909,7 @@ bool BLEManager::WriteValue(const std::string& uuid, const winrt::guid& serviceU
903
909
  else
904
910
  {
905
911
  LOGE("descriptor not found");
912
+ mEmit.WriteValue(uuid, serviceId, characteristicId, descriptorId, "descriptor not found");
906
913
  }
907
914
  };
908
915
  peripheral.GetDescriptor(serviceUuid, characteristicUuid, descriptorUuid, onDescriptor);
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.10",
9
+ "version": "2.3.12",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/stoprocent/noble.git"
@@ -30,7 +30,8 @@
30
30
  "dependencies": {
31
31
  "debug": "^4.3.7",
32
32
  "node-addon-api": "^8.1.0",
33
- "node-gyp-build": "^4.8.1"
33
+ "node-gyp-build": "^4.8.1",
34
+ "patch-package": "^8.0.0"
34
35
  },
35
36
  "optionalDependencies": {
36
37
  "@stoprocent/bluetooth-hci-socket": "^2.2.3"
@@ -67,7 +68,7 @@
67
68
  "lint": "eslint \"**/*.js\"",
68
69
  "lint-fix": "eslint \"**/*.js\" --fix",
69
70
  "prebuildify": "prebuildify --napi --target 17.0.0 --force --strip --verbose",
70
- "prebuildify-cross": "prebuildify-cross --napi --target 17.0.0 --force --strip --verbose",
71
+ "prebuildify-cross": "patch-package && prebuildify-cross --napi --target 17.0.0 --force --strip --verbose",
71
72
  "semantic-release": "semantic-release",
72
73
  "pretest": "npm run rebuild",
73
74
  "rebuild": "node-gyp rebuild",
@@ -0,0 +1,13 @@
1
+ diff --git a/node_modules/@thegecko/docker-run/index.js b/node_modules/@thegecko/docker-run/index.js
2
+ index 5299bee..4de15b3 100644
3
+ --- a/node_modules/@thegecko/docker-run/index.js
4
+ +++ b/node_modules/@thegecko/docker-run/index.js
5
+ @@ -14,7 +14,7 @@ var endsWith = function(str, suffix) {
6
+ var run = function(image, opts) {
7
+ if (!opts) opts = {}
8
+
9
+ - var request = docker({host: opts.host, version: opts.version || 'v1.21'})
10
+ + var request = docker({host: opts.host, version: opts.version || 'v1.44'})
11
+ var that = new events.EventEmitter()
12
+ var tty = !!opts.tty
13
+
@@ -0,0 +1,13 @@
1
+ diff --git a/node_modules/@vweevers/docker-pull/index.js b/node_modules/@vweevers/docker-pull/index.js
2
+ index 67b3e73..5fcb567 100644
3
+ --- a/node_modules/@vweevers/docker-pull/index.js
4
+ +++ b/node_modules/@vweevers/docker-pull/index.js
5
+ @@ -12,7 +12,7 @@ var pull = function (image, opts, cb) {
6
+ image = parse(image)
7
+ if (!image) throw new Error('Invalid image')
8
+
9
+ - var request = docker({host: opts.host, version: opts.version || 'v1.21'})
10
+ + var request = docker({host: opts.host, version: opts.version || 'v1.44'})
11
+ var that = new events.EventEmitter()
12
+ var layers = {}
13
+ var progress = {}
@@ -0,0 +1,13 @@
1
+ diff --git a/node_modules/prebuildify-cross/index.js b/node_modules/prebuildify-cross/index.js
2
+ index 3048337..0031ced 100644
3
+ --- a/node_modules/prebuildify-cross/index.js
4
+ +++ b/node_modules/prebuildify-cross/index.js
5
+ @@ -11,7 +11,7 @@ const unixify = require('unixify')
6
+ const once = require('once')
7
+ const path = require('path')
8
+
9
+ -const DOCKER_VERSION = 'v1.24'
10
+ +const DOCKER_VERSION = 'v1.44'
11
+
12
+ module.exports = function (opts, callback) {
13
+ if (typeof opts === 'function') {