@stoprocent/noble
Advanced tools
Comparing version 1.13.0 to 1.13.1
@@ -9,3 +9,3 @@ { | ||
"description": "A Node.js BLE (Bluetooth Low Energy) central library.", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"repository": { | ||
@@ -38,3 +38,3 @@ "type": "git", | ||
"optionalDependencies": { | ||
"@stoprocent/bluetooth-hci-socket": "^1.1.2" | ||
"@stoprocent/bluetooth-hci-socket": "^1.1.3" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
# ![noble](assets/noble-logo.png) | ||
[![npm version](https://badgen.net/npm/v/@abandonware/noble)](https://www.npmjs.com/package/@abandonware/noble) | ||
[![npm downloads](https://badgen.net/npm/dt/@abandonware/noble)](https://www.npmjs.com/package/@abandonware/noble) | ||
[![Build Status](https://travis-ci.org/abandonware/noble.svg?branch=master)](https://travis-ci.org/abandonware/noble) | ||
[![npm version](https://badgen.net/npm/v/@stoprocent/noble)](https://www.npmjs.com/package/@stoprocent/noble) | ||
[![npm downloads](https://badgen.net/npm/dt/@stoprocent/noble)](https://www.npmjs.com/package/@stoprocent/noble) | ||
[![Build Status](https://travis-ci.org/stoprocent/noble.svg?branch=master)](https://travis-ci.org/stoprocent/noble) | ||
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/abandonware/noble?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![OpenCollective](https://opencollective.com/noble/backers/badge.svg)](#backers) | ||
@@ -11,3 +11,3 @@ [![OpenCollective](https://opencollective.com/noble/sponsors/badge.svg)](#sponsors) | ||
Want to implement a peripheral? Check out [bleno](https://github.com/abandonware/bleno). | ||
Want to implement a peripheral? Check out [bleno](https://github.com/stoprocent/bleno). | ||
@@ -29,3 +29,3 @@ __Note:__ macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes. | ||
const noble = require('@abandonware/noble'); | ||
const noble = require('@stoprocent/noble'); | ||
@@ -53,3 +53,3 @@ noble.on('stateChange', async (state) => { | ||
```javascript | ||
const noble = require('@abandonware/noble/with-custom-binding')({extended: true}); | ||
const noble = require('@stoprocent/noble/with-custom-binding')({extended: true}); | ||
@@ -78,2 +78,34 @@ ``` | ||
##### Example 1 (UART port spcified as enviromental variable) | ||
```bash | ||
$ export BLUETOOTH_HCI_SOCKET_UART_PORT=/dev/tty... | ||
$ export BLUETOOTH_HCI_SOCKET_UART_BAUDRATE=1000000 | ||
``` | ||
__NOTE:__ `BLUETOOTH_HCI_SOCKET_UART_BAUDRATE` defaults to `1000000` so only needed if different. | ||
```javascript | ||
const noble = require('@stoprocent/noble'); | ||
``` | ||
##### Example 2 (UART port spcified in `bindParams`) | ||
```bash | ||
$ export BLUETOOTH_HCI_SOCKET_FORCE_UART=1 | ||
``` | ||
```javascript | ||
const noble = require('@stoprocent/noble/with-custom-binding') ( { | ||
bindParams: { | ||
uart: { | ||
port: '/dev/tty...', | ||
baudRate: 1000000 | ||
} | ||
} | ||
} ); | ||
``` | ||
__NOTE:__ There is a [UART code example](examples/uart-bind-params.js) in the `/examples` directory. | ||
#### OS X | ||
@@ -168,3 +200,3 @@ | ||
```sh | ||
npm install @abandonware/noble | ||
npm install @stoprocent/noble | ||
``` | ||
@@ -179,3 +211,3 @@ | ||
```javascript | ||
const noble = require('@abandonware/noble'); | ||
const noble = require('@stoprocent/noble'); | ||
``` | ||
@@ -217,2 +249,3 @@ | ||
* [_Event: Adapter state changed_](#event-adapter-state-changed) | ||
* [Set address](#set-address) | ||
* [Start scanning](#start-scanning) | ||
@@ -280,2 +313,10 @@ * [_Event: Scanning started_](#event-scanning-started) | ||
#### Set address | ||
```javascript | ||
noble.setAddress('00:11:22:33:44:55'); // set adapter's mac address | ||
``` | ||
__NOTE:__ Curently this feature is only supported on HCI as it's using vendor specific commands. Source of the commands is based on the [BlueZ bdaddr.c](https://github.com/pauloborges/bluez/blob/master/tools/bdaddr.c). | ||
__NOTE:__ `noble.state` must be `poweredOn` before address can be set. `noble.on('stateChange', callback(state));` can be used to listen for state change events. | ||
#### Start scanning | ||
@@ -654,3 +695,3 @@ | ||
```javascript | ||
var noble = require('@abandonware/noble/with-bindings')(require('./my-custom-bindings')); | ||
var noble = require('@stoprocent/noble/with-bindings')(require('./my-custom-bindings')); | ||
``` | ||
@@ -689,4 +730,4 @@ | ||
``` | ||
const HCIBindings = require('@abandonware/noble/lib/hci-socket/bindings'); | ||
const Noble = require('@abandonware/noble/lib/noble'); | ||
const HCIBindings = require('@stoprocent/noble/lib/hci-socket/bindings'); | ||
const Noble = require('@stoprocent/noble/lib/noble'); | ||
@@ -693,0 +734,0 @@ const params = { |
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
2306402
865