@stoprocent/noble 2.3.9 → 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.
- package/lib/win/src/ble_manager.cc +30 -20
- package/package.json +4 -3
- package/patches/@thegecko+docker-run+3.1.0.patch +13 -0
- package/patches/@vweevers+docker-pull+1.1.1.patch +13 -0
- package/patches/prebuildify-cross+5.1.1.patch +13 -0
- package/prebuilds/darwin-x64+arm64/@stoprocent+noble.node +0 -0
- package/prebuilds/win32-ia32/@stoprocent+noble.node +0 -0
- package/prebuilds/win32-x64/@stoprocent+noble.node +0 -0
|
@@ -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,6 +705,11 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
|
|
|
703
705
|
mEmit.Notify(uuid, serviceId, characteristicId, true);
|
|
704
706
|
return;
|
|
705
707
|
}
|
|
708
|
+
|
|
709
|
+
auto onChanged = bind2(this, &BLEManager::OnValueChanged, uuid);
|
|
710
|
+
auto token = characteristic->ValueChanged(onChanged);
|
|
711
|
+
mNotifyMap.Add(uuid, *characteristic, token);
|
|
712
|
+
|
|
706
713
|
auto descriptorValue =
|
|
707
714
|
GetDescriptorValue(characteristic->CharacteristicProperties());
|
|
708
715
|
|
|
@@ -736,6 +743,7 @@ bool BLEManager::Notify(const std::string& uuid, const winrt::guid& serviceUuid,
|
|
|
736
743
|
else
|
|
737
744
|
{
|
|
738
745
|
LOGE("GetCharacteristic error");
|
|
746
|
+
mEmit.Notify(uuid, serviceId, characteristicId, on, "GetCharacteristic error");
|
|
739
747
|
}
|
|
740
748
|
};
|
|
741
749
|
peripheral.GetCharacteristic(serviceUuid, characteristicUuid, onCharacteristic);
|
|
@@ -750,18 +758,16 @@ void BLEManager::OnNotify(IAsyncOperation<GattWriteResult> asyncOp, AsyncStatus
|
|
|
750
758
|
{
|
|
751
759
|
if (status == AsyncStatus::Completed)
|
|
752
760
|
{
|
|
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
761
|
mEmit.Notify(uuid, serviceId, characteristicId, state);
|
|
760
762
|
}
|
|
761
763
|
else
|
|
762
764
|
{
|
|
763
765
|
std::string error = "status: " + std::to_string((int)status);
|
|
764
766
|
mEmit.Notify(uuid, serviceId, characteristicId, state, error);
|
|
767
|
+
if (state == true)
|
|
768
|
+
{
|
|
769
|
+
mNotifyMap.Unsubscribe(uuid, characteristic);
|
|
770
|
+
}
|
|
765
771
|
}
|
|
766
772
|
}
|
|
767
773
|
|
|
@@ -784,10 +790,10 @@ bool BLEManager::DiscoverDescriptors(const std::string& uuid, const winrt::guid&
|
|
|
784
790
|
{
|
|
785
791
|
peripheral.GetCharacteristic(
|
|
786
792
|
serviceUuid, characteristicUuid, [=](std::optional<GattCharacteristic> characteristic) {
|
|
793
|
+
std::string serviceId = toStr(serviceUuid);
|
|
794
|
+
std::string characteristicId = toStr(characteristicUuid);
|
|
787
795
|
if (characteristic)
|
|
788
796
|
{
|
|
789
|
-
std::string serviceId = toStr(serviceUuid);
|
|
790
|
-
std::string characteristicId = toStr(characteristicUuid);
|
|
791
797
|
auto completed = bind2(this, &BLEManager::OnDescriptorsDiscovered, uuid,
|
|
792
798
|
serviceId, characteristicId);
|
|
793
799
|
characteristic->GetDescriptorsAsync(BluetoothCacheMode::Uncached)
|
|
@@ -796,6 +802,8 @@ bool BLEManager::DiscoverDescriptors(const std::string& uuid, const winrt::guid&
|
|
|
796
802
|
else
|
|
797
803
|
{
|
|
798
804
|
LOGE("GetCharacteristic error");
|
|
805
|
+
std::vector<std::string> emptyDescriptors;
|
|
806
|
+
mEmit.DescriptorsDiscovered(uuid, serviceId, characteristicId, emptyDescriptors, "GetCharacteristic error");
|
|
799
807
|
}
|
|
800
808
|
});
|
|
801
809
|
return true;
|
|
@@ -833,11 +841,11 @@ bool BLEManager::ReadValue(const std::string& uuid, const winrt::guid& serviceUu
|
|
|
833
841
|
peripheral.GetDescriptor(
|
|
834
842
|
serviceUuid, characteristicUuid, descriptorUuid,
|
|
835
843
|
[=](std::optional<GattDescriptor> descriptor) {
|
|
844
|
+
std::string serviceId = toStr(serviceUuid);
|
|
845
|
+
std::string characteristicId = toStr(characteristicUuid);
|
|
846
|
+
std::string descriptorId = toStr(descriptorUuid);
|
|
836
847
|
if (descriptor)
|
|
837
848
|
{
|
|
838
|
-
std::string serviceId = toStr(serviceUuid);
|
|
839
|
-
std::string characteristicId = toStr(characteristicUuid);
|
|
840
|
-
std::string descriptorId = toStr(descriptorUuid);
|
|
841
849
|
auto completed = bind2(this, &BLEManager::OnReadValue, uuid, serviceId,
|
|
842
850
|
characteristicId, descriptorId);
|
|
843
851
|
descriptor->ReadValueAsync(BluetoothCacheMode::Uncached).Completed(completed);
|
|
@@ -845,6 +853,7 @@ bool BLEManager::ReadValue(const std::string& uuid, const winrt::guid& serviceUu
|
|
|
845
853
|
else
|
|
846
854
|
{
|
|
847
855
|
LOGE("descriptor not found");
|
|
856
|
+
mEmit.ReadValue(uuid, serviceId, characteristicId, descriptorId, Data(), "descriptor not found");
|
|
848
857
|
}
|
|
849
858
|
});
|
|
850
859
|
return true;
|
|
@@ -885,11 +894,11 @@ bool BLEManager::WriteValue(const std::string& uuid, const winrt::guid& serviceU
|
|
|
885
894
|
IFDEVICE(device, uuid)
|
|
886
895
|
{
|
|
887
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);
|
|
888
900
|
if (descriptor)
|
|
889
901
|
{
|
|
890
|
-
std::string serviceId = toStr(serviceUuid);
|
|
891
|
-
std::string characteristicId = toStr(characteristicUuid);
|
|
892
|
-
std::string descriptorId = toStr(descriptorUuid);
|
|
893
902
|
auto writer = DataWriter();
|
|
894
903
|
writer.WriteBytes(data);
|
|
895
904
|
auto value = writer.DetachBuffer();
|
|
@@ -900,6 +909,7 @@ bool BLEManager::WriteValue(const std::string& uuid, const winrt::guid& serviceU
|
|
|
900
909
|
else
|
|
901
910
|
{
|
|
902
911
|
LOGE("descriptor not found");
|
|
912
|
+
mEmit.WriteValue(uuid, serviceId, characteristicId, descriptorId, "descriptor not found");
|
|
903
913
|
}
|
|
904
914
|
};
|
|
905
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.
|
|
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') {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|