Skip to content

Commit 6947270

Browse files
author
Daisuke Baba
committed
Merge branch 'develop' of https://github.com/CANDY-LINE/node-red-contrib-generic-ble into develop
* 'develop' of https://github.com/CANDY-LINE/node-red-contrib-generic-ble: (153 commits) Add a new file for change logs Update README Strip HCI dump instruction as this node no longer uses HCI socket Throw an error when a peripheral is not connected on read/write/subscribe oeprations Update example flow Fix an issue where this would be undefined as _addDashes was unbound Fix an issue where connectPeripheral() failed to return a value Add support for 16bit uuid translation Loose the condition to replace the device name Prepend _ for internal function Suppress DoesNotExist error Swallow an exception while emitting characteristicsDiscover event Fix an issue where characteristic discovery request was never interrupted when an peripheral device was missing Refactor error handler Strip NodeCache Rename variable Strip unused resources Show error while receiving error event Add missing status support and permission error alerting Add error event handler ...
2 parents b3535b9 + d261269 commit 6947270

File tree

19 files changed

+13082
-6167
lines changed

19 files changed

+13082
-6167
lines changed

.babelrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "current"
8+
}
9+
}
10+
]
11+
],
12+
"env": {
13+
"test": {
14+
"plugins": [
15+
"@babel/plugin-transform-modules-commonjs"
16+
]
17+
}
18+
}
19+
}

.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: false,
5+
node: true,
6+
es6: true,
7+
mocha: true,
8+
jest: true
9+
},
10+
parserOptions: {
11+
parser: 'babel-eslint',
12+
sourceType: 'module',
13+
ecmaVersion: 9
14+
},
15+
extends: [
16+
'plugin:prettier/recommended',
17+
'prettier',
18+
'eslint:recommended',
19+
],
20+
plugins: [
21+
'prettier'
22+
],
23+
rules: {
24+
}
25+
}

.jshintrc

Lines changed: 0 additions & 22 deletions
This file was deleted.

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true
4+
}

CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Revision History
2+
3+
* 4.0.0
4+
- The node category is now Network rather than Input and Output.
5+
- Improve stability on Linux by introducing BlueZ 5 D-Bus API
6+
- On Linux, this node no longer depends on HCI socket library.
7+
- Note that when Node-RED process is run by non-root user, add the user to `bluetooth` group so to access BlueZ D-Bus API. For example, run `sudo usermod -G bluetooth -a pi` prior to starting the process if it's run by `pi` user.
8+
- BlueZ's BLE scanning seems to detect devices having `random` address type. But not sure if such devices work with this node properly.
9+
- Tested on Raspbian (4.19.97-v7l+) and Raspberry Pi 3/4.
10+
- With the following packages
11+
- bluez 5.50-1.2~deb10u1
12+
- bluez-firmware 1.2-4+rpt2
13+
- Improve BLE Device Scanning UI/UX
14+
- Check `BLE Scanning` in order to start scanning, and `Scan Result` select box will be fullfilled automatically whenever devices are found. The update will be performed every 10 seconds. The first scan result will appear after 5 seconds since the scanning starts. See the updated README document for detail.
15+
- `GENERIC_BLE_TRACE` environment variable is no longer working. Use `DEBUG` environment variable instead.
16+
- `DEBUG=node-red-contrib-generic-ble:index` is compatible with `GENERIC_BLE_TRACE=true`.
17+
- `DEBUG=node-red-contrib-generic-ble:*` will output all trace logs within the project.
18+
- `DEBUG=node-red-contrib-generic-ble:index:api` will output all API endpoint access logs.
19+
- `DEBUG=node-red-contrib-generic-ble:noble:*` will output all trace logs under `src/noble` modules.
20+
21+
* 3.1.0
22+
- Support Node.js v10.x LTS (Fix #14 and #17)
23+
24+
* 3.0.0
25+
- Refactor entire architecture
26+
- Peripheral connections are retained until it disconnects
27+
- Characteristic subscriptions are retained while the ongoing flows are running (will be unsubscribed on stopping them though)
28+
- The max number of concurrent BLE connections is 5 or 6 according to [this document](https://github.com/noble/noble#maximum-simultaneous-connections)
29+
30+
* 2.0.4
31+
- Fix an issue where this node don't work with [email protected]
32+
33+
* 2.0.3
34+
- Fix an issue where noble looses a reference to a peripheral after it is disconnected
35+
36+
* 2.0.2
37+
- Fix an issue where Write operation cannot be performed properly (#4)
38+
39+
* 2.0.1
40+
- Fix an issue where `Select from scan result` failed to list characteristics
41+
42+
* 2.0.0
43+
- Add `Poll Notify Events` message support so that Generic BLE out node can start to subscribe the given characteristic events
44+
- Support characteristic query by one or more uuids
45+
- Add `Mute Notify Events` to `Generic BLE` config node for this node to avoid unnecessary device connection for event subscription
46+
- Replace `RED.log` functions with node logging functions as possible to offer precise logging control via UI
47+
- Add `Operation Timeout` to `Generic BLE` config node to set the waiting time for Read/Write/Notify response **per characteristic** rather than per device
48+
- `GENERIC_BLE_OPERATION_WAIT_MS` is introduced for default `Operation Timeout` value
49+
- Remove `Listening Period` from `Generic BLE` config node
50+
- `GENERIC_BLE_NOTIFY_WAIT_MS` is removed
51+
52+
* 1.0.2
53+
- Improve README
54+
- Add an example flow file available from the editor UI
55+
56+
* 1.0.1
57+
- Fix an issue where custom characteristics cannot be listed on the Generic BLE config node dialog
58+
59+
* 1.0.0
60+
- Fix an issue where some devices cannot be discovered within a specific time window even after they can be connected
61+
- Fix an issue where the Scan Result select widget didn't show the same item as the stored device info
62+
- Update Scan Result option list whenever Local Name is resolved
63+
- Improve stability by fixing minor bugs
64+
65+
* 0.1.0
66+
- Initial Release (alpha)
67+
- `node-red` keyword is not yet added

README.md

Lines changed: 27 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
node-red-contrib-generic-ble
22
===
33

4-
A Node-RED node for providing access to generic BLE devices via GATT.
4+
A Node-RED node for providing access to generic BLE peripheral devices via GATT.
5+
6+
As of v4.0.0, this node is optmized for Linux with BlueZ 5.
57

68
Supported operations are as follows:
79

@@ -10,9 +12,18 @@ Supported operations are as follows:
1012
- Write without Response
1113
- Notify
1214

15+
In this version, the node status values are as follows:
16+
17+
- `missing` the configured BLE peripheral device is missing. When the device is discovered, the state transitions to `disconnected`. The `disconnected` device may transiton to `missing` again when RSSI is invalidated (Linux only)
18+
- `disconnected` when the configured BLE peripheral device is found but not conncted
19+
- `connecting` when the configured BLE peripheral device is being connecting
20+
- `connected` when the configured BLE peripheral device is connected
21+
- `disconnecting` when the configured BLE peripheral device is being disconnecting
22+
- `error` when unexpected error occurs
23+
1324
# How to use
1425

15-
## How to configure a new BLE peripheral
26+
## How to configure a new BLE peripheral device
1627

1728
At first, drag either a `generic ble in` node or a `generic ble out` node to the workspace from the node palette and double-click the node. And you can find the following dialog. Here, click the pencil icon (`1`) to add a new BLE peripheral or edit the existing one.
1829

@@ -149,11 +160,22 @@ See `info` tab for detail on the editor UI.
149160

150161
# Example Flow
151162

152-
You can import [the example flow](examples/01-read-write.json) on Node-RED UI. You need to change Generic BLE config node named `nRF5x` or add a new config node for your device.
163+
You can import [the example flow](examples/01-read-write.json) on Node-RED UI.
164+
165+
# Installation Note (Linux)
166+
167+
The Node-RED process owner must belong to `bluetooth` group.
168+
For example, if you're going to run the process by `pi` user, run the following command.
169+
170+
```
171+
sudo usermod -G bluetooth -a pi
172+
```
153173

154-
# How to install
174+
Then reboot the OS so that the policy changes take effect.
155175

156-
This will take approx. 3 minutes on Raspberry Pi 3.
176+
```
177+
sudo reboot
178+
```
157179

158180
## Node-RED users
159181

@@ -189,70 +211,3 @@ $ NODE_ENV=development npm run build
189211
# package
190212
$ NODE_ENV=development npm pack
191213
```
192-
193-
## HCI Dump Debugging (Raspbian/Ubuntu/Debian)
194-
195-
```
196-
sudo apt-get update
197-
sudo apt-get install bluez-hcidump
198-
```
199-
200-
then
201-
202-
```
203-
sudo hcidump -t -x
204-
```
205-
206-
## Enabling trace log
207-
208-
Set `GENERIC_BLE_TRACE=true` on starting Node-RED and you can find the precise log in `/var/log/syslog`.
209-
210-
# Revision History
211-
212-
* 3.1.0
213-
- Support Node.js v10.x LTS (Fix #14 and #17)
214-
215-
* 3.0.0
216-
- Refactor entire architecture
217-
- Peripheral connections are retained until it disconnects
218-
- Characteristic subscriptions are retained while the ongoing flows are running (will be unsubscribed on stopping them though)
219-
- The max number of concurrent BLE connections is 5 or 6 according to [this document](https://github.com/noble/noble#maximum-simultaneous-connections)
220-
221-
* 2.0.4
222-
- Fix an issue where this node don't work with [email protected]
223-
224-
* 2.0.3
225-
- Fix an issue where noble looses a reference to a peripheral after it is disconnected
226-
227-
* 2.0.2
228-
- Fix an issue where Write operation cannot be performed properly (#4)
229-
230-
* 2.0.1
231-
- Fix an issue where `Select from scan result` failed to list characteristics
232-
233-
* 2.0.0
234-
- Add `Poll Notify Events` message support so that Generic BLE out node can start to subscribe the given characteristic events
235-
- Support characteristic query by one or more uuids
236-
- Add `Mute Notify Events` to `Generic BLE` config node for this node to avoid unnecessary device connection for event subscription
237-
- Replace `RED.log` functions with node logging functions as possible to offer precise logging control via UI
238-
- Add `Operation Timeout` to `Generic BLE` config node to set the waiting time for Read/Write/Notify response **per characteristic** rather than per device
239-
- `GENERIC_BLE_OPERATION_WAIT_MS` is introduced for default `Operation Timeout` value
240-
- Remove `Listening Period` from `Generic BLE` config node
241-
- `GENERIC_BLE_NOTIFY_WAIT_MS` is removed
242-
243-
* 1.0.2
244-
- Improve README
245-
- Add an example flow file available from the editor UI
246-
247-
* 1.0.1
248-
- Fix an issue where custom characteristics cannot be listed on the Generic BLE config node dialog
249-
250-
* 1.0.0
251-
- Fix an issue where some devices cannot be discovered within a specific time window even after they can be connected
252-
- Fix an issue where the Scan Result select widget didn't show the same item as the stored device info
253-
- Update Scan Result option list whenever Local Name is resolved
254-
- Improve stability by fixing minor bugs
255-
256-
* 0.1.0
257-
- Initial Release (alpha)
258-
- `node-red` keyword is not yet added

0 commit comments

Comments
 (0)