bluetooth-serial-port 3.0.3 → 3.0.4-beta.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.
Files changed (30) hide show
  1. package/README.md +12 -5
  2. package/lib/bluetooth-serial-port.js +8 -4
  3. package/lib/device-inquiry.js +3 -4
  4. package/package.json +18 -7
  5. package/prebuilds/bluetooth-serial-port-v3.0.4-node-v108-linux-arm64.tar.gz +0 -0
  6. package/prebuilds/linux-x64/BluetoothSerialPort.abi108.node +0 -0
  7. package/prebuilds/linux-x64/BluetoothSerialPort.abi115.node +0 -0
  8. package/prebuilds/linux-x64/BluetoothSerialPort.abi127.node +0 -0
  9. package/prebuilds/linux-x64/BluetoothSerialPort.abi137.node +0 -0
  10. package/prebuilds/linux-x64/BluetoothSerialPortServer.abi108.node +0 -0
  11. package/prebuilds/linux-x64/BluetoothSerialPortServer.abi115.node +0 -0
  12. package/prebuilds/linux-x64/BluetoothSerialPortServer.abi127.node +0 -0
  13. package/prebuilds/linux-x64/BluetoothSerialPortServer.abi137.node +0 -0
  14. package/prebuilds/win32-x64/BluetoothSerialPort.abi108.node +0 -0
  15. package/prebuilds/win32-x64/BluetoothSerialPort.abi115.node +0 -0
  16. package/prebuilds/win32-x64/BluetoothSerialPort.abi127.node +0 -0
  17. package/prebuilds/win32-x64/BluetoothSerialPort.abi137.node +0 -0
  18. package/scripts/create-prebuilds.js +42 -0
  19. package/scripts/download-prebuilds.js +98 -0
  20. package/scripts/install-native.js +45 -0
  21. package/scripts/load-native.js +39 -0
  22. package/.circleci/config.yml +0 -59
  23. package/.github/dependabot.yml +0 -11
  24. package/Dockerfile +0 -6
  25. package/RELEASE_NOTES.md +0 -222
  26. package/appveyor.yml +0 -33
  27. package/examples/async.js +0 -15
  28. package/examples/paired.js +0 -5
  29. package/examples/sync.js +0 -15
  30. package/test/index.js +0 -32
package/README.md CHANGED
@@ -6,7 +6,7 @@ This piece of open source software is free (as in speech) to [use, modify and di
6
6
 
7
7
  > MacOS support has (temporarily) been dropped as of version v3.0.0 of the module. If you use the module on a Mac please stay on v2 of this module.
8
8
 
9
- > _DEPRECATED_ Currently I have no plans to add support for NodeJS version 1.13 and up. If you want to help out by adding support please contact me. It was a great experience maintaining this project for almost 8 years. It was great to see people step in to improve this project. Thank you all!
9
+ > _DEPRECATED_ I am no longer actively maintaining this project. If you want to help out by adding support please contact me. It was a great experience maintaining this project for almost 8 years. It was great to see people step in to improve this project. Thank you all!
10
10
 
11
11
  [![Build status](https://dl.circleci.com/status-badge/img/gh/eelcocramer/node-bluetooth-serial-port/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/eelcocramer/node-bluetooth-serial-port/tree/master)
12
12
  [![Build status](https://ci.appveyor.com/api/projects/status/4p1r3ddoid98qc7k?svg=true)](https://ci.appveyor.com/project/eelcocramer/node-bluetooth-serial-port)
@@ -15,8 +15,10 @@ This node module lets you communicate over Bluetooth serial port with devices us
15
15
 
16
16
  If you have any problems make sure to [checkout the FAQ](https://github.com/eelcocramer/node-bluetooth-serial-port/issues?q=label%3AFAQ).
17
17
 
18
- ## New in the last release
18
+ ## New in the last releases
19
19
 
20
+ * Downloads precompiled native assets from github
21
+ * Bumps dependencies
20
22
  * Fixes memory leaks.
21
23
  * Adds support for node 20, 22 and 24
22
24
 
@@ -24,7 +26,8 @@ Check the [release notes](RELEASE_NOTES.md) for an overview of the change histor
24
26
 
25
27
  ## Prerequisites on Linux
26
28
 
27
- * Needs Bluetooth development packages to build
29
+ * Build prerequisites are only needed when no matching prebuilt binary is available.
30
+ * Needs Bluetooth development packages for source builds.
28
31
 
29
32
  `apt-get install build-essential libbluetooth-dev`
30
33
 
@@ -53,13 +56,17 @@ sudo systemctl restart bluetooth
53
56
 
54
57
  ## Prerequisites on Windows
55
58
 
56
- - Needs Visual Studio (Visual C++) and its command line tools installed.
57
- - Needs Python 2.x installed and accessible from the command line path.
59
+ - Build prerequisites are only needed when no matching prebuilt binary is available.
60
+ - Needs Visual Studio (Visual C++) and its command line tools for source builds.
61
+ - Needs Python installed and accessible from the command line path.
58
62
 
59
63
  ## Install
60
64
 
61
65
  `npm install bluetooth-serial-port`
62
66
 
67
+ For Linux x64 and Windows x64 on Node 18, 20, 22 and 24, installation first downloads a prebuilt native binary from GitHub Releases.
68
+ If a matching prebuild is unavailable, install falls back to a local `node-gyp` build.
69
+
63
70
  ## Test build Linux using docker
64
71
 
65
72
  `docker build -t bluetooth-serial-port .`
@@ -15,9 +15,11 @@
15
15
  (function () {
16
16
  "use strict";
17
17
 
18
- var util = require('util'),
18
+ var path = require('path'),
19
+ util = require('util'),
19
20
  EventEmitter = require('events').EventEmitter,
20
- btSerial = require('bindings')('BluetoothSerialPort.node'),
21
+ loadNative = require('../scripts/load-native'),
22
+ btSerial = loadNative(path.join(__dirname, '..'), 'BluetoothSerialPort'),
21
23
  DeviceINQ = require("./device-inquiry.js").DeviceINQ;
22
24
 
23
25
  /**
@@ -143,9 +145,11 @@
143
145
  return;
144
146
  }
145
147
 
146
- var util = require('util'),
148
+ var path = require('path'),
149
+ util = require('util'),
147
150
  EventEmitter = require('events').EventEmitter,
148
- btSerial = require('bindings')('BluetoothSerialPortServer.node'),
151
+ loadNative = require('../scripts/load-native'),
152
+ btSerial = loadNative(path.join(__dirname, '..'), 'BluetoothSerialPortServer'),
149
153
  _SERIAL_PORT_PROFILE_UUID = '1101',
150
154
  _DEFAULT_SERVER_CHANNEL = 1,
151
155
  _ERROR_CLIENT_CLOSED_CONNECTION = 'Error: Connection closed by the client';
@@ -15,14 +15,13 @@
15
15
  (function () {
16
16
  "use strict";
17
17
 
18
- // javascript shim that lets our object inherit from EventEmitter
19
- var DeviceINQ = require('bindings')('BluetoothSerialPort.node').DeviceINQ,
18
+ var path = require('path'),
19
+ loadNative = require('../scripts/load-native'),
20
+ DeviceINQ = loadNative(path.join(__dirname, '..'), 'BluetoothSerialPort').DeviceINQ,
20
21
  events = require('events');
21
22
 
22
- // extend prototype
23
23
  function inherits(target, source) {
24
24
  var k;
25
-
26
25
  for (k in source.prototype) {
27
26
  target.prototype[k] = source.prototype[k];
28
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bluetooth-serial-port",
3
- "version": "3.0.3",
3
+ "version": "3.0.4-beta.12",
4
4
  "description": "Bluetooth serial port communication for Node.js",
5
5
  "author": "Eelco Cramer <eelco@hailendal.org>",
6
6
  "keywords": [
@@ -14,32 +14,43 @@
14
14
  "bugs": "https://github.com/eelcocramer/node-bluetooth-serial-port/issues",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "https://github.com/eelcocramer/node-bluetooth-serial-port"
17
+ "url": "git+https://github.com/eelcocramer/node-bluetooth-serial-port.git"
18
18
  },
19
19
  "directories": {
20
20
  "lib": "./lib"
21
21
  },
22
22
  "main": "./lib/bluetooth-serial-port.js",
23
23
  "types": "./lib/bluetooth-serial-port.d.ts",
24
+ "files": [
25
+ "lib/",
26
+ "src/",
27
+ "scripts/",
28
+ "binding.gyp",
29
+ "prebuilds/"
30
+ ],
24
31
  "os": [
25
32
  "linux",
26
33
  "win32"
27
34
  ],
28
35
  "dependencies": {
29
- "bindings": "1.5.x",
30
36
  "nan": "^2.28.0",
31
- "stable": "^0.1.8"
37
+ "node-gyp-build": "^4.8.4"
32
38
  },
39
+ "devDependencies": {},
33
40
  "optionalDependencies": {
34
- "@types/node": "^18.0.0"
41
+ "@types/node": "^26.1.2"
35
42
  },
36
43
  "engines": {
37
44
  "node": ">= 18.x",
38
45
  "npm": ">= 8.x"
39
46
  },
40
47
  "scripts": {
41
- "install": "node-gyp configure build",
42
- "install-debug": "node-gyp configure build --debug"
48
+ "install": "node scripts/install-native.js",
49
+ "install-release": "node-gyp configure build",
50
+ "install-debug": "node-gyp configure build --debug",
51
+ "prebuild": "node scripts/create-prebuilds.js --strip",
52
+ "prepublishOnly": "node scripts/download-prebuilds.js",
53
+ "test": "node test/index.js"
43
54
  },
44
55
  "license": "MIT",
45
56
  "contributors": [
@@ -0,0 +1,42 @@
1
+ // scripts/create-prebuilds.js
2
+ 'use strict';
3
+
4
+ var cp = require('child_process');
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+
8
+ var strip = process.argv.includes('--strip');
9
+ var abi = process.versions.modules;
10
+ var platform = process.platform;
11
+ var arch = process.arch;
12
+ var rootDir = path.join(__dirname, '..');
13
+ var releaseDir = path.join(rootDir, 'build', 'Release');
14
+ var outDir = path.join(rootDir, 'prebuilds', platform + '-' + arch);
15
+ var modules = ['BluetoothSerialPort'];
16
+ if (platform === 'linux') {
17
+ modules.push('BluetoothSerialPortServer');
18
+ }
19
+
20
+ fs.mkdirSync(outDir, { recursive: true });
21
+
22
+ modules.forEach(function(name) {
23
+ var src = path.join(releaseDir, name + '.node');
24
+
25
+ if (!fs.existsSync(src)) {
26
+ console.error('Error: ' + src + ' not found. Run "npm run install-release" first.');
27
+ process.exit(1);
28
+ }
29
+
30
+ var dest = path.join(outDir, name + '.abi' + abi + '.node');
31
+ fs.copyFileSync(src, dest);
32
+
33
+ if (strip && platform !== 'win32') {
34
+ try {
35
+ cp.execSync('strip "' + dest + '"', { stdio: 'inherit' });
36
+ } catch (e) {
37
+ console.warn('Warning: strip failed for ' + dest + ' (' + e.message + ')');
38
+ }
39
+ }
40
+
41
+ console.log('Created ' + path.relative(rootDir, dest));
42
+ });
@@ -0,0 +1,98 @@
1
+ // scripts/download-prebuilds.js
2
+ 'use strict';
3
+
4
+ var fs = require('fs');
5
+ var path = require('path');
6
+
7
+ var pkg = require('../package.json');
8
+ var token = process.env.GITHUB_TOKEN;
9
+
10
+ // Parse owner/repo from repository.url
11
+ // Handles: https://github.com/owner/repo or git+https://github.com/owner/repo
12
+ var repoMatch = pkg.repository.url.match(/github\.com[/:]([^/]+)\/([^/.]+)/);
13
+ if (!repoMatch) {
14
+ console.error('Error: Cannot parse GitHub owner/repo from: ' + pkg.repository.url);
15
+ process.exit(1);
16
+ }
17
+ var owner = repoMatch[1];
18
+ var repo = repoMatch[2].replace(/\.git$/, '');
19
+ var tag = 'v' + pkg.version;
20
+ var rootDir = path.join(__dirname, '..');
21
+
22
+ console.log('Downloading prebuilds for ' + owner + '/' + repo + '@' + tag + '...');
23
+
24
+ async function main() {
25
+ var apiUrl = 'https://api.github.com/repos/' + owner + '/' + repo + '/releases/tags/' + tag;
26
+ var headers = {
27
+ 'Accept': 'application/vnd.github.v3+json',
28
+ 'User-Agent': repo + '-prebuild-downloader'
29
+ };
30
+
31
+ if (token) {
32
+ headers.Authorization = 'Bearer ' + token;
33
+ }
34
+
35
+ var apiRes = await fetch(apiUrl, {
36
+ headers: headers
37
+ });
38
+
39
+ if (!apiRes.ok) {
40
+ var body = await apiRes.text();
41
+ throw new Error('GitHub API ' + apiRes.status + ' for ' + apiUrl + ': ' + body);
42
+ }
43
+
44
+ var release = await apiRes.json();
45
+ var assets = release.assets.filter(function(a) { return /\.abi\d+\.node$/.test(a.name); });
46
+
47
+ if (assets.length === 0) {
48
+ console.error(
49
+ 'Error: No prebuilt binaries found in GitHub Release ' + tag + '.\n' +
50
+ 'Wait for CI to finish uploading prebuilts before running npm publish.'
51
+ );
52
+ process.exit(1);
53
+ }
54
+
55
+ console.log('Found ' + assets.length + ' prebuild asset(s).');
56
+
57
+ for (var asset of assets) {
58
+ // Asset name format: linux-x64--BluetoothSerialPort.abi108.node
59
+ var sep = asset.name.indexOf('--');
60
+ if (sep === -1) {
61
+ console.warn('Skipping unrecognised asset name: ' + asset.name);
62
+ continue;
63
+ }
64
+ var platformArch = asset.name.slice(0, sep);
65
+ var filename = asset.name.slice(sep + 2);
66
+ var destDir = path.join(rootDir, 'prebuilds', platformArch);
67
+ var destFile = path.join(destDir, filename);
68
+
69
+ fs.mkdirSync(destDir, { recursive: true });
70
+
71
+ var dlHeaders = {
72
+ 'User-Agent': repo + '-prebuild-downloader'
73
+ };
74
+
75
+ if (token) {
76
+ dlHeaders.Authorization = 'Bearer ' + token;
77
+ }
78
+
79
+ var dlRes = await fetch(asset.browser_download_url, {
80
+ headers: dlHeaders
81
+ });
82
+
83
+ if (!dlRes.ok) {
84
+ throw new Error('Download failed for ' + asset.name + ': HTTP ' + dlRes.status);
85
+ }
86
+
87
+ var buf = await dlRes.arrayBuffer();
88
+ fs.writeFileSync(destFile, Buffer.from(buf));
89
+ console.log(' -> ' + path.relative(rootDir, destFile));
90
+ }
91
+
92
+ console.log('All prebuilds downloaded successfully.');
93
+ }
94
+
95
+ main().catch(function(err) {
96
+ console.error('Error:', err.message);
97
+ process.exit(1);
98
+ });
@@ -0,0 +1,45 @@
1
+ // scripts/install-native.js
2
+ 'use strict';
3
+
4
+ var cp = require('child_process');
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+
8
+ var rootDir = path.join(__dirname, '..');
9
+ var abi = process.versions.modules;
10
+ var platform = process.platform;
11
+ var arch = process.arch;
12
+ var prebuildDir = path.join(rootDir, 'prebuilds', platform + '-' + arch);
13
+
14
+ var moduleNames = ['BluetoothSerialPort'];
15
+ if (platform === 'linux') {
16
+ moduleNames.push('BluetoothSerialPortServer');
17
+ }
18
+
19
+ function hasAllPrebuilds() {
20
+ for (var i = 0; i < moduleNames.length; i++) {
21
+ var filename = moduleNames[i] + '.abi' + abi + '.node';
22
+ if (!fs.existsSync(path.join(prebuildDir, filename))) {
23
+ return false;
24
+ }
25
+ }
26
+ return true;
27
+ }
28
+
29
+ if (hasAllPrebuilds()) {
30
+ console.log('Using bundled prebuilds from ' + path.relative(rootDir, prebuildDir));
31
+ process.exit(0);
32
+ }
33
+
34
+ console.log('No matching prebuilds found for ' + platform + '-' + arch + ' abi' + abi + '; building from source...');
35
+ var bin = process.platform === 'win32' ? 'node-gyp.cmd' : 'node-gyp';
36
+ var result = cp.spawnSync(bin, ['rebuild'], {
37
+ stdio: 'inherit',
38
+ shell: process.platform === 'win32',
39
+ windowsHide: true
40
+ });
41
+
42
+ if (result.error) {
43
+ throw result.error;
44
+ }
45
+ process.exit(result.status || 0);
@@ -0,0 +1,39 @@
1
+ // scripts/load-native.js
2
+ 'use strict';
3
+
4
+ var fs = require('fs');
5
+ var path = require('path');
6
+
7
+ /**
8
+ * Loads a named native module (.node file).
9
+ * Resolution order:
10
+ * 1. prebuilds/{platform}-{arch}/{name}.abi{abi}.node (bundled prebuild)
11
+ * 2. build/Release/{name}.node (source-compiled release)
12
+ * 3. build/Debug/{name}.node (source-compiled debug)
13
+ *
14
+ * @param {string} packageRoot Absolute path to the package root directory.
15
+ * @param {string} name Module name without extension (e.g. 'BluetoothSerialPort').
16
+ * @returns {object} The native binding.
17
+ */
18
+ module.exports = function loadNative(packageRoot, name) {
19
+ var abi = process.versions.modules;
20
+ var platform = process.platform;
21
+ var arch = process.arch;
22
+
23
+ var candidates = [
24
+ path.join(packageRoot, 'prebuilds', platform + '-' + arch, name + '.abi' + abi + '.node'),
25
+ path.join(packageRoot, 'build', 'Release', name + '.node'),
26
+ path.join(packageRoot, 'build', 'Debug', name + '.node')
27
+ ];
28
+
29
+ for (var i = 0; i < candidates.length; i++) {
30
+ if (fs.existsSync(candidates[i])) {
31
+ return require(candidates[i]);
32
+ }
33
+ }
34
+
35
+ throw new Error(
36
+ 'Could not find native module "' + name + '". Searched:\n' +
37
+ candidates.map(function(p) { return ' ' + p; }).join('\n')
38
+ );
39
+ };
@@ -1,59 +0,0 @@
1
- # Use the latest 2.1 version of CircleCI pipeline process engine.
2
- # See: https://circleci.com/docs/2.0/configuration-reference
3
- version: 2.1
4
-
5
- orbs:
6
- # The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
7
- # Orbs reduce the amount of configuration required for common tasks.
8
- # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
9
- node: circleci/node@4.7
10
-
11
- jobs:
12
- build-18:
13
- docker:
14
- - image: node:18
15
- steps:
16
- - checkout:
17
- method: full
18
- - run:
19
- name: install build dependencies
20
- command: apt-get update && apt-get install -y build-essential libbluetooth-dev
21
- - node/install-packages
22
- build-20:
23
- docker:
24
- - image: node:20
25
- steps:
26
- - checkout:
27
- method: full
28
- - run:
29
- name: install build dependencies
30
- command: apt-get update && apt-get install -y build-essential libbluetooth-dev
31
- - node/install-packages
32
- build-22:
33
- docker:
34
- - image: node:22
35
- steps:
36
- - checkout:
37
- method: full
38
- - run:
39
- name: install build dependencies
40
- command: apt-get update && apt-get install -y build-essential libbluetooth-dev
41
- - node/install-packages
42
- build-24:
43
- docker:
44
- - image: node:24
45
- steps:
46
- - checkout:
47
- method: full
48
- - run:
49
- name: install build dependencies
50
- command: apt-get update && apt-get install -y build-essential libbluetooth-dev
51
- - node/install-packages
52
-
53
- workflows:
54
- build:
55
- jobs:
56
- - build-18
57
- - build-20
58
- - build-22
59
- - build-24
@@ -1,11 +0,0 @@
1
- # To get started with Dependabot version updates, you'll need to specify which
2
- # package ecosystems to update and where the package manifests are located.
3
- # Please see the documentation for all configuration options:
4
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
-
6
- version: 2
7
- updates:
8
- - package-ecosystem: "npm" # See documentation for possible values
9
- directory: "/" # Location of package manifests
10
- schedule:
11
- interval: "daily"
package/Dockerfile DELETED
@@ -1,6 +0,0 @@
1
- FROM node:18
2
- RUN apt-get update
3
- RUN apt-get install -y build-essential libbluetooth-dev
4
- ADD . node-bluetooth-serial-port
5
- WORKDIR node-bluetooth-serial-port
6
- RUN npm install --unsafe-perm
package/RELEASE_NOTES.md DELETED
@@ -1,222 +0,0 @@
1
- ## RELEASE NOTES
2
-
3
- ### 3.0.2
4
-
5
- * Fixes memory leaks.
6
- * Adds support for node 20, 22 and 24
7
-
8
- ### 3.0.2
9
-
10
- * Changes node version to `lts` in the Dockerfile
11
-
12
-
13
- ### 3.0.1
14
-
15
- * Fixes typescript definition for `listPairedDevices`.
16
-
17
- ### 3.0.0
18
-
19
- * Fixes building issues with recent version of NodeJS.
20
- * Drops support for Darwin / MacOS for the moment. If you want to use the module on a Mac please install v2.2.7.
21
-
22
- ### 2.2.7
23
-
24
- * Changes node version to `lts` in the Dockerfile
25
-
26
- ### 2.2.6
27
-
28
- * Adds support for node v12
29
- * Node v6 and v7 are no longer supported
30
-
31
- ### 2.2.5
32
-
33
- * Fixes issue #97 where the server process does not exit correctly.
34
-
35
- ### 2.2.4
36
-
37
- * Fixes an error where the module would not return correctly when parameter assertion would fail.
38
-
39
- ### 2.2.3
40
-
41
- * Fixes regression when closing a connection
42
-
43
- ### 2.2.2
44
-
45
- * Adds the status code to the error message when a connection fails
46
- * Fixes typescript example
47
-
48
- ### 2.2.1
49
-
50
- * Fixes regression
51
-
52
- ### 2.2.0
53
-
54
- * Adds support for multiple serial port servers [#197](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/197)
55
-
56
- ### 2.1.8
57
-
58
- * Fixes issue #193 where, on Linux, not all bytes where written to the connection. In this fix the Linux implementation now mimics the other implementations.
59
-
60
- ### 2.1.7
61
-
62
- * Adds support for node v10
63
-
64
- ### 2.1.6
65
-
66
- * Fixes an issue on Windows and Linux where `close` would not terminate a connection properly.
67
- * Improves the README.
68
-
69
- ### 2.1.5
70
-
71
- * Fixes an issue in the typescript definitions.
72
- * Fixes an issue where, on Windows, `listPairedDevices` is showing unpaired devices.
73
-
74
- ### 2.1.4
75
-
76
- * Removes erroneous print statement
77
- * Adds `on` to the TypeScript declaration file
78
-
79
- ### 2.1.3
80
-
81
- * Implements `listPairedDevices` on Windows
82
- * Fixes a memory leak that occurs when trying to reconnect to a device repeatedly
83
- * Adds support for TypeScript
84
- * Removes support for node v0.10, v0.12 and iojs
85
- * Adds support for node v7
86
-
87
- ### 2.1.2
88
-
89
- * `listen()` method will not exit until there's an explicit call to `close()`.
90
- * If a client disconnects, `listen()` can still handle new connections.
91
- * Calling `listen()` more than once is not allowed.
92
- * Better error handling in the server part.
93
- * New server and client test in the experiments folder
94
-
95
- ### 2.1.1
96
-
97
- * Fixes a segmentation fault that can occur on OSX
98
-
99
- ### 2.1.0
100
-
101
- * Adds asynchronous searching for devices
102
- * Asynchronous searching replaces the old synchronous `inquire` function so without touching your code you will be using the asynchronous search function.
103
- * Moves synchronous searching for devices to a new `inquireSync` function
104
-
105
- ### 2.0.0
106
-
107
- * Improvements and API changes of the experimental RFCOMM server socket (Linux only)
108
- * No changes in the client
109
-
110
- ### 1.3.1
111
-
112
- * Fixes compilation problem on Windows.
113
- * Adds experimental RFCOMM server socket (Linux only)
114
-
115
- ### 1.2.6
116
-
117
- * Fixes a critical [runtime error](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/83) on all platforms.
118
- * Improves travis build.
119
-
120
- ### 1.2.5
121
-
122
- * Compatible to NodeJS 4.x
123
- * Dockerfile to test build Linux from OSX or Win
124
-
125
- ### 1.2.4
126
-
127
- * The release notes for previous version have moved to [a separate file](RELEASE_NOTES.md).
128
- * Fixes an issue where the `Error` object is passed in the 2nd argument of the callback function when a `write` is called before the remote device was connected.
129
- * Fixes a [segfault on OSX](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/74).
130
- * Fixes a [buffer overflow on OSX](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/76).
131
-
132
- ### 1.2.3
133
-
134
- * [Updates nan](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/67) for io.js 2.x.x compatibility.
135
-
136
- ### 1.2.2
137
-
138
- * Adds [cross-platform continues integration](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/58) to the repository. Thanks @mackwic.
139
- * [Re-enables windows](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/53) support.
140
- * Fixes an issue where [pipes and file descriptors are leaked](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/57) when a connection could not be established.
141
-
142
- ### 1.2.1
143
-
144
- * Fixes issues compile issues on OS X and Linux when using newer versions of [nan](https://github.com/rvagg/nan).
145
-
146
- ### 1.2.0
147
-
148
- > *PLEASE NOTE* This release is not yet available for the Windows platform because the [compilation needs to be verified first](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/53). As there are no major functional changes this release and the release, hopefully, will fix major issues on OSX I decided to go forward without Windows support for the moment. This will hopefully be fixed in the next release. I will update as soon as possible.
149
-
150
- * Fixes an [issue on OSX](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/46) where multiple reads would result into a corrupted read buffer.
151
- * [Improves](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/51) the implementation of the Bluetooth worker on OSX.
152
- * Better [performance](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/35) while writing to the Bluetooth connection on OSX.
153
- * Keeps the [reader loop from reading from a closed connection]((https://github.com/eelcocramer/node-bluetooth-serial-port/issues/47).
154
- * Will work on both node v0.8.x, v0.10.x and node v0.11.x on OSX and Linux (Windows to be done).
155
- * When trying to write to closed connection the `write` function will not throw an exception anymore but will call the callback as per documentation.
156
- * Adds a `closed` event that fires when a connection is closed either by the user or remotely.
157
-
158
- ### 1.1.4
159
-
160
- * Fixes an compile issue on Windows.
161
-
162
- ### 1.1.3
163
-
164
- * Fixes [segfault](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/29) that occurs when a buffer is invalidated by the garbage collector.
165
- * Adds experimental support for listing paired devices.
166
-
167
- ### 1.1.2
168
-
169
- * Updates the documentation to reflect the changes made in version 1.1.0.
170
-
171
- ### 1.1.1
172
-
173
- * Fixes typo in readme.
174
-
175
- ### 1.1.0
176
-
177
- * Fixes [buffer overflow on close()](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/26) in Mac OSX.
178
- * Adds failure callback that is called when no channel can be found.
179
- * Fixes an [issue on Mac OSX](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/23) where a write action would fail when the MTU was exceeded.
180
- * Fixes an [issue on Mac OSX](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/24) where data would not be written asynchronously.
181
-
182
- ### 1.0.5
183
-
184
- * Updates the code example in the README.
185
- * Adds `win32` to the supported OS'es in the `package.json`.
186
-
187
- ### 1.0.4
188
-
189
- * Added windows support.
190
-
191
- ### 1.0.3
192
-
193
- * Fixes an [issue on Linux](https://github.com/eelcocramer/node-bluetooth-serial-port/pull/11) where reading from a closed or reset connection would result into a SEGFAULT.
194
-
195
- ### 1.0.2
196
-
197
- * Updates the documentation.
198
- * Fixes an issue where memory is freed incorrectly after closing a connection on OS X.
199
- * Improves the timeout mechanism that is used for getting the Bluetooth service records on a remote device on OS X.
200
-
201
- ### 1.0.1
202
-
203
- * No code changes, only updates the documentation.
204
-
205
- ### 1.0.0
206
-
207
- * Makes the write function asynchrone.
208
- * Takes a [Buffer](http://nodejs.org/api/buffer.html) as the input for the write function in favor of a String.
209
- * Reads data into a [Buffer](http://nodejs.org/api/buffer.html) object instead of using a String.
210
- * Improves error handling when calling the native addon.
211
-
212
- ### 0.2.1
213
-
214
- * Fixes issue where calling `close` on a connection would result in an `Abort trap: 6` error on OS X.
215
-
216
- ### 0.2.0
217
-
218
- * Experimental support for OS X!
219
- * `findSerialPortChannel` does not invoke callback anymore when no channel was found.
220
- * `found` event now emits the Bluetooth address as the value of the name parameter `name` when the name of the device could not be determined (used to be `[undefined]`).
221
-
222
-
package/appveyor.yml DELETED
@@ -1,33 +0,0 @@
1
- image: Visual Studio 2019
2
-
3
- environment:
4
- # Visual Studio Version
5
- MSVS_VERSION: 2017
6
- # Test against these Node.js versions
7
- matrix:
8
- - nodejs_version: "18"
9
- - nodejs_version: "20"
10
- - nodejs_version: "22"
11
- - nodejs_version: "24"
12
-
13
-
14
- platform:
15
- - x64
16
-
17
- # Install scripts. (runs after repo cloning)
18
- install:
19
- # Get the latest stable version of Node.js or io.js
20
- - ps: Install-Product node $env:nodejs_version $env:Platform
21
- # install modules
22
- - node --version
23
- - npm --version
24
- - npm ci --ignore-scripts
25
-
26
- # Disable automatic MSBuild discovery (there is no .sln/.vcxproj in repo root).
27
- build: off
28
-
29
- # Post-install test scripts.
30
- test_script:
31
- # run tests
32
- - npm run install-debug
33
- - node test\index.js
package/examples/async.js DELETED
@@ -1,15 +0,0 @@
1
- const BluetoothSerialPort = require('../lib/bluetooth-serial-port');
2
-
3
- const rfcomm = new BluetoothSerialPort.BluetoothSerialPort();
4
-
5
- rfcomm.on('found', function (address, name) {
6
- console.log('found device:', name, 'with address:', address);
7
- });
8
-
9
- rfcomm.on('finished', function () {
10
- console.log('inquiry finished');
11
- });
12
-
13
- console.log('start inquiry');
14
- rfcomm.inquire();
15
- console.log('should be displayed before the end of inquiry');
@@ -1,5 +0,0 @@
1
- const BluetoothSerialPort = require('../lib/bluetooth-serial-port');
2
- const rfcomm = new BluetoothSerialPort.BluetoothSerialPort();
3
- rfcomm.listPairedDevices(function (list) {
4
- console.log(JSON.stringify(list,null,2));
5
- });
package/examples/sync.js DELETED
@@ -1,15 +0,0 @@
1
- const BluetoothSerialPort = require('../lib/bluetooth-serial-port');
2
-
3
- const rfcomm = new BluetoothSerialPort.BluetoothSerialPort();
4
-
5
- rfcomm.on('found', function (address, name) {
6
- console.log('found device:', name, 'with address:', address);
7
- });
8
-
9
- rfcomm.on('finished', function () {
10
- console.log('inquiry finished');
11
- });
12
-
13
- console.log('start inquiry');
14
- rfcomm.inquireSync();
15
- console.log('should be displayed after the end of inquiry');
package/test/index.js DELETED
@@ -1,32 +0,0 @@
1
- var bt = require('../lib/bluetooth-serial-port.js');
2
- var Bt = new bt.BluetoothSerialPort();
3
-
4
- console.log('Checking client...');
5
-
6
- [
7
- 'inquire', 'findSerialPortChannel', 'connect', 'write', 'on', 'close'
8
- ].forEach(function(fun) {
9
- if (typeof Bt[fun] !== 'function')
10
- throw new Error("Assert failed: " + fun +
11
- "should be a function but is " + (typeof Bt[fun]));
12
- });
13
-
14
- console.log('Ok!');
15
-
16
- if (process.platform === 'linux') {
17
- console.log('Checking server...');
18
-
19
- var ServerBt = new bt.BluetoothSerialPortServer();
20
- [
21
- 'listen', 'write', 'on', 'close'
22
- ].forEach(function(fun) {
23
- if (typeof ServerBt[fun] !== 'function')
24
- throw new Error("Assert failed: " + fun +
25
- "should be a function but is " + (typeof ServerBt[fun]));
26
- });
27
-
28
- console.log('Ok!');
29
- }
30
-
31
- process.exit(0);
32
-