bluetooth-serial-port 2.2.5 → 3.0.0

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.
Files changed (55) hide show
  1. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv.h +1724 -0
  2. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv.h.blob +0 -0
  3. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@darwin.h +61 -0
  4. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@darwin.h.blob +0 -0
  5. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@errno.h +443 -0
  6. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@errno.h.blob +0 -0
  7. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@threadpool.h +37 -0
  8. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@threadpool.h.blob +0 -0
  9. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@unix.h +491 -0
  10. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@unix.h.blob +0 -0
  11. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@version.h +43 -0
  12. package/.ccls-cache/@@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/@usr@local@Cellar@libuv@1.31.0@include@uv@version.h.blob +0 -0
  13. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@DeviceINQ.h +78 -0
  14. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@DeviceINQ.h.blob +0 -0
  15. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@BTSerialPortBinding.cc +404 -0
  16. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@BTSerialPortBinding.cc.blob +0 -0
  17. package/{src/osx/BluetoothSerialPort.mm → .ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@BluetoothSerialPort.cc} +3 -3
  18. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@BluetoothSerialPort.cc.blob +0 -0
  19. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@DeviceINQ.cc +369 -0
  20. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@linux@DeviceINQ.cc.blob +0 -0
  21. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@windows@BluetoothHelpers.h +24 -0
  22. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@windows@BluetoothHelpers.h.blob +0 -0
  23. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@windows@DeviceINQ.cc +527 -0
  24. package/.ccls-cache/@Users@eelco@Projects@Figaro@workspace@node-bluetooth-serial-port/src@windows@DeviceINQ.cc.blob +0 -0
  25. package/.circleci/config.yml +47 -0
  26. package/.github/dependabot.yml +11 -0
  27. package/Dockerfile +1 -1
  28. package/Dockerfile.bk +13 -0
  29. package/README.md +91 -78
  30. package/RELEASE_NOTES.md +14 -0
  31. package/appveyor.yml +6 -9
  32. package/binding.gyp +0 -8
  33. package/package.json +56 -58
  34. package/qemu-arm-static +0 -0
  35. package/src/BTSerialPortBinding.h +3 -3
  36. package/src/BTSerialPortBindingServer.h +1 -1
  37. package/src/DeviceINQ.h +1 -1
  38. package/src/linux/BTSerialPortBinding.cc +17 -15
  39. package/src/linux/BTSerialPortBindingServer.cc +29 -19
  40. package/src/linux/BluetoothSerialPort.cc +1 -1
  41. package/src/linux/BluetoothSerialPortServer.cc +1 -1
  42. package/src/linux/DeviceINQ.cc +18 -15
  43. package/src/{osx → macos}/BTSerialPortBinding.mm +23 -17
  44. package/src/{osx → macos}/BluetoothDeviceResources.h +0 -0
  45. package/src/{osx → macos}/BluetoothDeviceResources.mm +0 -0
  46. package/src/macos/BluetoothSerialPort.mm +23 -0
  47. package/src/{osx → macos}/BluetoothWorker.h +3 -3
  48. package/src/{osx → macos}/BluetoothWorker.mm +139 -140
  49. package/src/{osx → macos}/DeviceINQ.mm +21 -23
  50. package/src/{osx → macos}/pipe.c +0 -0
  51. package/src/{osx → macos}/pipe.h +0 -0
  52. package/src/windows/BTSerialPortBinding.cc +17 -18
  53. package/src/windows/BluetoothSerialPort.cc +3 -3
  54. package/src/windows/DeviceINQ.cc +17 -15
  55. package/.travis.yml +0 -48
@@ -3,10 +3,10 @@
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
- *
6
+ *
7
7
  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
8
  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10
10
  */
11
11
 
12
12
  #include <node.h>
@@ -15,7 +15,7 @@
15
15
 
16
16
  using namespace v8;
17
17
 
18
- void InitAll(Handle<Object> exports) {
18
+ void InitAll(Local<Object> exports) {
19
19
  DeviceINQ::Init(exports);
20
20
  BTSerialPortBinding::Init(exports);
21
21
  }
@@ -113,7 +113,7 @@ void DeviceINQ::EIO_AfterSdpSearch(uv_work_t *req) {
113
113
  baton = nullptr;
114
114
  }
115
115
 
116
- void DeviceINQ::Init(Handle<Object> target) {
116
+ void DeviceINQ::Init(Local<Object> target) {
117
117
  Nan::HandleScope scope;
118
118
 
119
119
  Local<FunctionTemplate> t = Nan::New<FunctionTemplate>(New);
@@ -121,14 +121,14 @@ void DeviceINQ::Init(Handle<Object> target) {
121
121
  t->InstanceTemplate()->SetInternalFieldCount(1);
122
122
  t->SetClassName(Nan::New("DeviceINQ").ToLocalChecked());
123
123
 
124
+ Isolate *isolate = target->GetIsolate();
125
+ Local<Context> ctx = isolate->GetCurrentContext();
126
+
124
127
  Nan::SetPrototypeMethod(t, "inquireSync", InquireSync);
125
128
  Nan::SetPrototypeMethod(t, "inquire", Inquire);
126
129
  Nan::SetPrototypeMethod(t, "findSerialPortChannel", SdpSearch);
127
130
  Nan::SetPrototypeMethod(t, "listPairedDevices", ListPairedDevices);
128
- target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
129
- target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
130
- target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
131
- target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
131
+ target->Set(ctx, Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction(ctx).ToLocalChecked());
132
132
  }
133
133
 
134
134
  bt_inquiry DeviceINQ::doInquire() {
@@ -333,13 +333,15 @@ NAN_METHOD(DeviceINQ::SdpSearch) {
333
333
  }
334
334
 
335
335
  sdp_baton_t *baton = new sdp_baton_t();
336
- String::Utf8Value address(info[0]);
336
+
337
+ Local<Function> cb = info[1].As<Function>();
338
+ String::Utf8Value address(cb->GetIsolate(), info[0]);
337
339
  if (strcpy_s(baton->address, *address) != 0) {
338
340
  delete baton;
339
341
  return Nan::ThrowTypeError("Address (first argument) length is invalid");
340
342
  }
341
343
 
342
- Local<Function> cb = info[1].As<Function>();
344
+
343
345
  DeviceINQ *inquire = Nan::ObjectWrap::Unwrap<DeviceINQ>(info.This());
344
346
 
345
347
  baton->inquire = inquire;
@@ -413,8 +415,8 @@ NAN_METHOD(DeviceINQ::ListPairedDevices) {
413
415
  : Nan::New(address);
414
416
 
415
417
  Local<Object> deviceObj = Nan::New<v8::Object>();
416
- deviceObj->Set(Nan::New("name").ToLocalChecked(), Nan::New(querySet->lpszServiceInstanceName).ToLocalChecked());
417
- deviceObj->Set(Nan::New("address").ToLocalChecked(), addressString.ToLocalChecked());
418
+ Nan::Set(deviceObj, Nan::New("name").ToLocalChecked(), Nan::New(querySet->lpszServiceInstanceName).ToLocalChecked());
419
+ Nan::Set(deviceObj, Nan::New("address").ToLocalChecked(), addressString.ToLocalChecked());
418
420
 
419
421
  Local<Array> servicesArray = Local<Array>(Nan::New<Array>());
420
422
  {
@@ -443,9 +445,9 @@ NAN_METHOD(DeviceINQ::ListPairedDevices) {
443
445
  if (lookupServiceError2 != SOCKET_ERROR ) {
444
446
  int port = (int)((SOCKADDR_BTH *)querySet2->lpcsaBuffer->RemoteAddr.lpSockaddr)->port;
445
447
  Local<Object> serviceObj = Nan::New<v8::Object>();
446
- serviceObj->Set(Nan::New("channel").ToLocalChecked(), Nan::New(port));
447
- serviceObj->Set(Nan::New("name").ToLocalChecked(), Nan::New(querySet2->lpszServiceInstanceName).ToLocalChecked());
448
- servicesArray->Set(place++, serviceObj);
448
+ Nan::Set(serviceObj, Nan::New("channel").ToLocalChecked(), Nan::New(port));
449
+ Nan::Set(serviceObj, Nan::New("name").ToLocalChecked(), Nan::New(querySet2->lpszServiceInstanceName).ToLocalChecked());
450
+ Nan::Set(servicesArray, place++, serviceObj);
449
451
  } else {
450
452
  int lookupServiceErrorNumber = WSAGetLastError();
451
453
  if (lookupServiceErrorNumber == WSAEFAULT) {
@@ -474,8 +476,8 @@ NAN_METHOD(DeviceINQ::ListPairedDevices) {
474
476
  free(querySet2);
475
477
  }
476
478
 
477
- deviceObj->Set(Nan::New("services").ToLocalChecked(), servicesArray);
478
- resultArray->Set(i, deviceObj);
479
+ Nan::Set(deviceObj, Nan::New("services").ToLocalChecked(), servicesArray);
480
+ Nan::Set(resultArray, i, deviceObj);
479
481
  i = i+1;
480
482
  }
481
483
  } else {
@@ -519,7 +521,7 @@ NAN_METHOD(DeviceINQ::ListPairedDevices) {
519
521
  Local<Value> argv[1] = {
520
522
  resultArray
521
523
  };
522
- cb->Call(Nan::GetCurrentContext()->Global(), 1, argv);
524
+ cb->Call(Nan::GetCurrentContext(), Nan::GetCurrentContext()->Global(), 1, argv);
523
525
 
524
526
  return;
525
527
  }
package/.travis.yml DELETED
@@ -1,48 +0,0 @@
1
- language: cpp # node_js is not supported yet on osx
2
- compiler: gcc
3
- sudo: false
4
-
5
- os:
6
- - linux
7
- - osx
8
-
9
- env:
10
- matrix:
11
- - export NODE_VERSION="6"
12
- - export NODE_VERSION="7"
13
- - export NODE_VERSION="8"
14
- - export NODE_VERSION="9"
15
- - export NODE_VERSION="10"
16
- - export NODE_VERSION="11"
17
-
18
- matrix:
19
- fast-finish: true
20
-
21
- addons:
22
- apt:
23
- sources:
24
- - ubuntu-toolchain-r-test
25
- packages:
26
- - libbluetooth-dev
27
-
28
- before_install:
29
- - git clone https://github.com/creationix/nvm.git ./.nvm
30
- - source ./.nvm/nvm.sh
31
- - nvm install $NODE_VERSION
32
- - nvm use $NODE_VERSION
33
- - npm config set python `which python`
34
- - gcc --version
35
- - g++ --version
36
- - npm --version
37
- - node --version
38
-
39
- script:
40
- - npm install
41
- - node ./test/index.js
42
-
43
- cache:
44
- directories:
45
- - $HOME/.node-gyp
46
- - $HOME/.npm
47
- - node_modules
48
-