New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bluetooth-serial-port

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluetooth-serial-port - npm Package Compare versions

Comparing version 1.1.4 to 1.2.0

src/ngx-queue.h

110

lib/bluetooth-serial-port.js

@@ -6,14 +6,18 @@ /*

* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* 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.
* 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.
* 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.
*/
(function() {
/*jslint node: true*/
/*global require*/
(function () {
"use strict";
var util = require('util');
var EventEmitter = require('events').EventEmitter;
var btSerial = require('bindings')('BluetoothSerialPort.node');
var DeviceINQ = require("./device-inquiry.js").DeviceINQ;
var util = require('util'),
EventEmitter = require('events').EventEmitter,
btSerial = require('bindings')('BluetoothSerialPort.node'),
DeviceINQ = require("./device-inquiry.js").DeviceINQ;

@@ -32,7 +36,7 @@ /**

this.inq.on('found', function(address, name) {
this.inq.on('found', function (address, name) {
self.emit('found', address, name);
});
this.inq.on('finished', function() {
this.inq.on('finished', function () {
self.emit('finished');

@@ -45,15 +49,15 @@ });

BluetoothSerialPort.prototype.listPairedDevices = function(callback) {
BluetoothSerialPort.prototype.listPairedDevices = function (callback) {
this.inq.listPairedDevices(callback);
};
BluetoothSerialPort.prototype.inquire = function() {
BluetoothSerialPort.prototype.inquire = function () {
this.inq.inquire();
};
BluetoothSerialPort.prototype.findSerialPortChannel = function(address, successCallback, errorCallback) {
this.inq.findSerialPortChannel(address, function(channel) {
BluetoothSerialPort.prototype.findSerialPortChannel = function (address, successCallback, errorCallback) {
this.inq.findSerialPortChannel(address, function (channel) {
if (channel >= 0) {
successCallback(channel);
} else {
} else if (errorCallback) {
errorCallback();

@@ -64,41 +68,45 @@ }

BluetoothSerialPort.prototype.connect = function(address, channel, successCallback, errorCallback) {
var self = this;
BluetoothSerialPort.prototype.connect = function (address, channel, successCallback, errorCallback) {
var self = this,
read = function () {
process.nextTick(function () {
if (self.connection) {
self.connection.read(function (err, buffer) {
if (!err && buffer) {
self.emit('data', buffer);
} else {
self.close();
self.emit('failure', err);
}
});
}
});
},
connection = new btSerial.BTSerialPortBinding(address, channel, function () {
self.address = address;
self.buffer = [];
self.connection = connection;
self.isReading = false;
var read = function() {
process.nextTick(function() {
if (self.connection) {
self.connection.read(function(err, buffer) {
if (!err && buffer) {
self.emit('data', buffer);
} else {
self.close();
self.emit('failure', err);
}
});
}
});
};
self.on('data', function (buffer) {
if (buffer.length <= 0) {
// we are done reading. The remote device might have closed the device
// or we have closed it ourself. Lets cleanup our side anyway...
self.close();
} else {
read();
}
});
var connection = new btSerial.BTSerialPortBinding(address, channel, function() {
self.address = address;
self.buffer = [];
self.connection = connection;
self.isReading = false;
read();
self.on('data', function(data) {
read();
successCallback();
}, function (err) {
if (errorCallback) {
errorCallback(err);
}
});
read();
successCallback();
}, function (err) {
if (errorCallback) {
errorCallback(err);
}
});
};
BluetoothSerialPort.prototype.write = function(buffer, cb) {
BluetoothSerialPort.prototype.write = function (buffer, cb) {
if (this.connection) {

@@ -112,3 +120,3 @@ this.connection.write(buffer, this.address, cb);

BluetoothSerialPort.prototype.close = function() {
BluetoothSerialPort.prototype.close = function () {
if (this.connection) {

@@ -118,7 +126,9 @@ this.connection.close(this.address);

}
this.emit('closed');
};
BluetoothSerialPort.prototype.isOpen = function() {
BluetoothSerialPort.prototype.isOpen = function () {
return this.connection !== undefined;
};
})();
}());

@@ -6,20 +6,30 @@ /*

* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* 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.
* 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.
* 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.
*/
// javascript shim that lets our object inherit from EventEmitter
var DeviceINQ = require('bindings')('BluetoothSerialPort.node').DeviceINQ;
/*jslint node: true*/
/*global require */
var events = require('events');
(function () {
"use strict";
inherits(DeviceINQ, events.EventEmitter);
exports.DeviceINQ = DeviceINQ;
// javascript shim that lets our object inherit from EventEmitter
var DeviceINQ = require('bindings')('BluetoothSerialPort.node').DeviceINQ,
events = require('events');
// extend prototype
function inherits(target, source) {
for (var k in source.prototype)
target.prototype[k] = source.prototype[k];
}
// extend prototype
function inherits(target, source) {
var k;
for (k in source.prototype) {
target.prototype[k] = source.prototype[k];
}
}
inherits(DeviceINQ, events.EventEmitter);
exports.DeviceINQ = DeviceINQ;
}());
{ "name" : "bluetooth-serial-port"
, "version" : "1.1.4"
, "version" : "1.2.0"
, "description" : "Bluetooth serial port communication for Node.js"

@@ -23,5 +23,6 @@ , "author": "Eelco Cramer <eelco@hailendal.org>"

, "main" : "./lib/bluetooth-serial-port.js"
, "os": [ "darwin", "linux", "win32" ]
, "os": [ "darwin", "linux" ]
, "dependencies" :
{ "bindings" : "1.1.x"
, "nan" : "^1.4.1"
}

@@ -36,3 +37,3 @@ , "engines" :

, "license": "BSD-2-Clause"
, "contributors": ["Eric Smekens", "Juho Vepsäläinen", "Elmar Langholz", "Donald Ness", "Joost Verdoorn"]
, "contributors": ["Eric Smekens", "Juho Vepsäläinen", "Elmar Langholz", "Donald Ness", "Joost Verdoorn", "Max Metral"]
}

@@ -5,4 +5,18 @@ # Bluetooth serial port communication for Node.js

If you have any problems make sure to [checkout the FAQ](https://github.com/eelcocramer/node-bluetooth-serial-port/issues?q=label%3AFAQ).
## RELEASE NOTES
### 1.2.0
> *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.
* 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.
* [Improves](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/51) the implementation of the Bluetooth worker on OSX.
* Better [performance](https://github.com/eelcocramer/node-bluetooth-serial-port/issues/35) while writing to the Bluetooth connection on OSX.
* Keeps the [reader loop from reading from a closed connection]((https://github.com/eelcocramer/node-bluetooth-serial-port/issues/47).
* Will work on both node v0.8.x, v0.10.x and node v0.11.x on OSX and Linux (Windows to be done).
* When trying to write to closed connection the `write` function will not throw an exception anymore but will call the callback as per documentation.
* Adds a `closed` event that fires when a connection is closed either by the user or remotely.
### 1.1.4

@@ -76,3 +90,3 @@

`apt-get install libbluetooth-dev`
`apt-get install build-essential libbluetooth-dev`

@@ -118,2 +132,4 @@ ## Pre-request on OS X

btSerial.close();
}, function() {
console.log('found nothing');
});

@@ -135,2 +151,6 @@ });

### Event: ('closed')
Emitted when a connection was closed either by the user (i.e. calling `close` or remotely).
#### Event: ('failure', err)

@@ -137,0 +157,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc