Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bluetooth-hci-socket

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bluetooth-hci-socket - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

34

lib/usb.js
var events = require('events');
var util = require('util');
var debug = require('debug')('bluetooth-hci-socket-usb');
var debug = require('debug')('hci-usb');
var usb = require('usb');

@@ -11,3 +11,8 @@

var OGF_HOST_CTL = 0x03;
var OCF_RESET = 0x0003;
function BluetoothHciSocket() {
this._isUp = false;
this._hciEventEndpointBuffer = new Buffer(0);

@@ -27,2 +32,6 @@ }

if (!this._usbDevice) {
throw new Error('No compatible USB Bluetooth 4.0 device found!');
}
this._usbDevice.open();

@@ -38,2 +47,4 @@

this._usbDeviceInterface.claim();
this.reset();
};

@@ -46,3 +57,3 @@

BluetoothHciSocket.prototype.isDevUp = function() {
return true;
return this._isUp;
};

@@ -87,2 +98,7 @@

if (data.length === 6 && ('0e0401030c00' === data.toString('hex'))) {
debug('reset complete');
this._isUp = true;
}
// add to buffer

@@ -116,2 +132,16 @@ this._hciEventEndpointBuffer = Buffer.concat([

BluetoothHciSocket.prototype.reset = function() {
var cmd = new Buffer(4);
// header
cmd.writeUInt8(HCI_COMMAND_PKT, 0);
cmd.writeUInt16LE(OCF_RESET | OGF_HOST_CTL << 10, 1);
// length
cmd.writeUInt8(0x00, 3);
debug('reset');
this.write(cmd);
};
module.exports = BluetoothHciSocket;

2

package.json
{
"name": "bluetooth-hci-socket",
"version": "0.3.0",
"version": "0.3.1",
"description": "Bluetooth HCI socket binding for Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

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