bluetooth-hci-socket
Advanced tools
Comparing version 0.2.0 to 0.3.0
20
index.js
@@ -1,15 +0,11 @@ | ||
var events = require('events'); | ||
var os = require('os'); | ||
var binding = require('./build/Release/binding.node'); | ||
var BluetoothHciSocket = binding.BluetoothHciSocket; | ||
var platform = os.platform(); | ||
inherits(BluetoothHciSocket, events.EventEmitter); | ||
// extend prototype | ||
function inherits(target, source) { | ||
for (var k in source.prototype) { | ||
target.prototype[k] = source.prototype[k]; | ||
} | ||
if (process.env.BLUETOOTH_HCI_SOCKET_FORCE_USB || platform === 'win32') { | ||
module.exports = require('./lib/usb.js'); | ||
} else if (platform === 'linux') { | ||
module.exports = require('./lib/native'); | ||
} else { | ||
throw new Error('Unsupported platform'); | ||
} | ||
module.exports = BluetoothHciSocket; |
{ | ||
"name": "bluetooth-hci-socket", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Bluetooth HCI socket binding for Node.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "jshint lib/*.js" | ||
}, | ||
@@ -16,3 +16,4 @@ "repository": { | ||
"Bluetooth", | ||
"Linux" | ||
"Linux", | ||
"Windows" | ||
], | ||
@@ -26,7 +27,15 @@ "author": "Sandeep Mistry <sandeep.mistry@gmail.com>", | ||
"os": [ | ||
"linux" | ||
"linux", | ||
"win32" | ||
], | ||
"dependencies": { | ||
"debug": "^2.2.0", | ||
"nan": "^1.8.4" | ||
}, | ||
"optionalDependencies": { | ||
"usb": "^1.0.6" | ||
}, | ||
"devDependencies": { | ||
"jshint": "^2.8.0" | ||
} | ||
} |
@@ -5,4 +5,25 @@ # node-bluetooth-hci-socket | ||
__NOTE:__ Currently only supports __Linux__. | ||
__NOTE:__ Currently only supports __Linux__ and __Windows__. | ||
## Prerequisites | ||
### Linux | ||
* Bluetooth 4.0 Adapter | ||
### Windows | ||
This library needs raw USB access to a Bluetooth 4.0 USB adapter, as it needs to bypass the Windows Bluetooth stack. | ||
A [WinUSB](https://msdn.microsoft.com/en-ca/library/windows/hardware/ff540196(v=vs.85).aspx) driver is required, use [Zadig tool](http://zadig.akeo.ie) to replace the driver for your adapter. | ||
__WARNING:__ This will make the adapter unavaible in Windows Bluetooth settings! | ||
#### Compatible Bluetooth 4.0 USB Adapter's | ||
| Name | USB VID | USB PID | | ||
|:---- | :------ | :-------| | ||
| BCM920702 Bluetooth 4.0 | 0x0a5c | 0x21e8 | | ||
| CSR8510 A10 | 0x0a12 | 0x0001 | | ||
## Install | ||
@@ -54,3 +75,3 @@ | ||
Query the device state. __Note:__ must be called after ```bindRaw```. | ||
Query the device state. | ||
@@ -61,2 +82,4 @@ ``` | ||
__Note:__ must be called after ```bindRaw```. | ||
#### Start/stop | ||
@@ -74,2 +97,4 @@ | ||
__Note:__ must be called after ```bindRaw``` or ```bindControl```. | ||
#### Write | ||
@@ -86,2 +111,4 @@ | ||
__Note:__ must be called after ```bindRaw``` or ```bindControl```. | ||
### Events | ||
@@ -112,1 +139,19 @@ | ||
See [examples folder](https://github.com/sandeepmistry/node-bluetooth-hci-socket/blob/master/examples) for code examples. | ||
## Platform Notes | ||
### Linux | ||
#### Force Raw USB mode | ||
Unload ```btusb``` kernel module: | ||
```sh | ||
sudo rmmod btusb | ||
``` | ||
Set ```BLUETOOTH_HCI_SOCKET_FORCE_USB``` environment variable: | ||
```sh | ||
sudo BLUETOOTH_HCI_SOCKET_FORCE_USB=1 node <file>.js | ||
``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
37304
14
607
1
152
3
1
1
+ Addeddebug@^2.2.0
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)
+ Addednode-addon-api@4.3.0(transitive)
+ Addednode-gyp-build@4.8.1(transitive)
+ Addedusb@1.9.2(transitive)