@stoprocent/bleno 0.7.0 → 0.7.1
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.
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals.
|
|
7
7
|
|
|
8
|
-
Need a BLE central module? See [noble](https://github.com/
|
|
8
|
+
Need a BLE central module? See [noble](https://github.com/stoprocent/noble).
|
|
9
9
|
|
|
10
10
|
__Note:__ Starting with version 0.6 bleno is basing on ES6 classes and supports Node.js 14.x and higher only. For older versions of Node.js use bleno 0.5.x.
|
|
11
11
|
|
|
@@ -13,6 +13,40 @@ __Note:__ macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only su
|
|
|
13
13
|
|
|
14
14
|
## Prerequisites
|
|
15
15
|
|
|
16
|
+
#### UART (Any OS)
|
|
17
|
+
|
|
18
|
+
Please refer to [https://github.com/stoprocent/node-bluetooth-hci-socket#uartserial-any-os](https://github.com/stoprocent/node-bluetooth-hci-socket#uartserial-any-os)
|
|
19
|
+
|
|
20
|
+
##### Example 1 (UART port spcified as enviromental variable)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
$ export BLUETOOTH_HCI_SOCKET_UART_PORT=/dev/tty...
|
|
24
|
+
$ export BLUETOOTH_HCI_SOCKET_UART_BAUDRATE=1000000
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
__NOTE:__ `BLUETOOTH_HCI_SOCKET_UART_BAUDRATE` defaults to `1000000` so only needed if different.
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
const bleno = require('@stoprocent/bleno');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
##### Example 2 (UART port spcified in `bindParams`)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
$ export BLUETOOTH_HCI_SOCKET_FORCE_UART=1
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
const bleno = require('@stoprocent/bleno/with-custom-binding') ( {
|
|
41
|
+
bindParams: {
|
|
42
|
+
uart: {
|
|
43
|
+
port: '/dev/tty...',
|
|
44
|
+
baudRate: 1000000
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} );
|
|
48
|
+
```
|
|
49
|
+
|
|
16
50
|
### OS X
|
|
17
51
|
|
|
18
52
|
* install the XCode command line tools via `xcode-select --install`
|
|
@@ -82,7 +116,7 @@ Make sure you have read and write permissions on the ```/dev/usb/*``` device tha
|
|
|
82
116
|
## Install
|
|
83
117
|
|
|
84
118
|
```sh
|
|
85
|
-
npm install bleno@npm:@
|
|
119
|
+
npm install bleno@npm:@stoprocent/bleno
|
|
86
120
|
```
|
|
87
121
|
|
|
88
122
|
## Usage
|
|
@@ -91,10 +125,19 @@ npm install bleno@npm:@abandonware/bleno
|
|
|
91
125
|
var bleno = require('bleno');
|
|
92
126
|
```
|
|
93
127
|
|
|
94
|
-
See [examples folder](https://github.com/
|
|
128
|
+
See [examples folder](https://github.com/stoprocent/bleno/blob/master/examples) for code examples.
|
|
95
129
|
|
|
96
130
|
### Actions
|
|
97
131
|
|
|
132
|
+
#### Set address
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
bleno.setAddress('00:11:22:33:44:55'); // set adapter's mac address
|
|
136
|
+
```
|
|
137
|
+
__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).
|
|
138
|
+
__NOTE:__ `bleno.state` must be `poweredOn` before address can be set. `bleno.on('stateChange', callback(state));` can be used to listen for state change events.
|
|
139
|
+
|
|
140
|
+
|
|
98
141
|
#### Advertising
|
|
99
142
|
|
|
100
143
|
##### Start advertising
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|