Skip to content

Commit ac779ad

Browse files
author
Daisuke Baba
committed
Merge branch 'hotfix/1.0.2'
2 parents 11adbe9 + dad93b9 commit ac779ad

File tree

7 files changed

+219
-181
lines changed

7 files changed

+219
-181
lines changed

README.md

Lines changed: 48 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,59 @@ Supported operations are as follows:
1010
- Write without Response
1111
- Notify
1212

13-
Read and Write operations are performed asynchronously and they're stored into the separate queues (read queue and write queue). Each queue has up to 10 operation requests. The parameter can be modified by providing `GENERIC_BLE_MAX_REQUESTS`.
13+
Read and Write operations are performed asynchronously and they're stored into the separate queues (read queue and write queue). Each queue has up to 10 operation requests. The parameter can be modified by providing an environmental variable `GENERIC_BLE_MAX_REQUESTS`.
14+
15+
# How to use
16+
17+
## How to configure a new BLE peripheral
18+
19+
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.
20+
21+
![ble in node](images/ble1.png)
22+
23+
Then the new config node dialog appears like this.
24+
25+
![ble config node](images/ble2.png)
26+
27+
The `Scan Result` shows the scanned BLE peripherals. It can be empty when no peripherals are found.
28+
29+
In order for the dialog to list your device, turn BLE on prior to open the dialog. Close the dialog then re-open it if you'd like to get the latest scan result.
30+
31+
By default, you have to enter either MAC address or UUID manually to configure your BLE peripheral. However, by checking `Select from scan result`(`2`), you can choose the peripheral if it exists in the scan result.
32+
33+
![ble config node](images/ble3.png)
34+
35+
When you choose the peripheral, `GATT Characteristics` shows all characteristics discovered in it, and `Local Name`, `MAC` and `UUID` are automatically resolved as well.
36+
37+
If you cannot find your peripheral in the `Scan Result`, you can reload the result by closing this dialog and re-opening it as described above.
38+
39+
Click `Add` (`3`) when the information on the dialog looks good.
40+
41+
![ble config node](images/ble4.png)
42+
43+
Click `Done` (`4`) to finish the `ble in` node settings.
44+
45+
## BLE in and out nodes
46+
47+
See `info` tab for detail on the editor UI.
48+
49+
# Example Flow
50+
51+
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.
52+
53+
# Systemwide Configuration
1454

1555
These are environmental variables for systemwidely configuring this node:
1656

1757
| Variable | Description |
1858
|----------|-------------|
1959
| `GENERIC_BLE_CONNECTION_TIMEOUT_MS` | Connection Timeout in milliseconds. 5s by default |
2060
| `GENERIC_BLE_CONCURRENT_CONNECTIONS` | Number of Concurrent BLE connections. 1 by default |
21-
| `GENERIC_BLE_READ_WRITE_INTERVAL_MS` | Read/Write operation interval in milliseconds. 50ms by default | `GENERIC_BLE_NOTIFY_WAIT_MS` | Default waiting time for listening notify events. 300 by default |
61+
| `GENERIC_BLE_READ_WRITE_INTERVAL_MS` | Read/Write operation interval in milliseconds. 50ms by default |
62+
| `GENERIC_BLE_NOTIFY_WAIT_MS` | Default waiting time for listening notify events. 300 by default |
2263
| `GENERIC_BLE_MAX_REQUESTS` | The length of Read/Write operation queues. 10 by default |
2364

24-
You can easily get started by importing the example flow shown below.
65+
You can easily get started with importing the example flow from the menu icon > `Import` > `Examples` > `generic ble`.
2566

2667
# How to install
2768

@@ -60,183 +101,6 @@ sudo systemctl restart candy-red
60101
```
61102
The above command performs `hciconfig hci0 reset` as well. So you don't have to run `hciconfig` command separately.
62103

63-
# Example Flow
64-
65-
You can import this flow on Node-RED UI. You need to change Generic BLE config node named `nRF5x` or add a new config node for your device.
66-
67-
```
68-
[
69-
{
70-
"id": "12121a3f.3ee31e",
71-
"type": "tab",
72-
"label": "Generic BLE Example",
73-
"disabled": false,
74-
"info": "This flow shows BLE Read/Write example.\n"
75-
},
76-
{
77-
"id": "11b829f1.d5215e",
78-
"type": "Generic BLE in",
79-
"z": "12121a3f.3ee31e",
80-
"name": "",
81-
"genericBle": "95ea8a12.e7aa38",
82-
"useString": false,
83-
"notification": false,
84-
"x": 337.5,
85-
"y": 259.25,
86-
"wires": [
87-
[
88-
"486cfab5.aec02c",
89-
"f5a90326.7009a"
90-
]
91-
]
92-
},
93-
{
94-
"id": "64b63eaf.52e4a8",
95-
"type": "inject",
96-
"z": "12121a3f.3ee31e",
97-
"name": "Get Battery Level",
98-
"topic": "",
99-
"payload": "",
100-
"payloadType": "date",
101-
"repeat": "",
102-
"crontab": "",
103-
"once": false,
104-
"x": 223.5,
105-
"y": 129.25,
106-
"wires": [
107-
[
108-
"11b829f1.d5215e"
109-
]
110-
]
111-
},
112-
{
113-
"id": "486cfab5.aec02c",
114-
"type": "debug",
115-
"z": "12121a3f.3ee31e",
116-
"name": "",
117-
"active": false,
118-
"console": "false",
119-
"complete": "false",
120-
"x": 706.5,
121-
"y": 259.5,
122-
"wires": []
123-
},
124-
{
125-
"id": "3c6ec3aa.24cfbc",
126-
"type": "Generic BLE out",
127-
"z": "12121a3f.3ee31e",
128-
"name": "",
129-
"genericBle": "95ea8a12.e7aa38",
130-
"x": 576.5,
131-
"y": 489.5,
132-
"wires": []
133-
},
134-
{
135-
"id": "90562835.fb6488",
136-
"type": "inject",
137-
"z": "12121a3f.3ee31e",
138-
"name": "Write Some Data",
139-
"topic": "",
140-
"payload": "{\"2a00\":\"yayyay\"}",
141-
"payloadType": "json",
142-
"repeat": "",
143-
"crontab": "",
144-
"once": false,
145-
"x": 212.5,
146-
"y": 490.25,
147-
"wires": [
148-
[
149-
"3c6ec3aa.24cfbc"
150-
]
151-
]
152-
},
153-
{
154-
"id": "f5a90326.7009a",
155-
"type": "function",
156-
"z": "12121a3f.3ee31e",
157-
"name": "Extract Battery Level",
158-
"func": "var payload = msg.payload;\nvar buff = payload.characteristics['2a19'] || []\nmsg.payload = buff[0];\nreturn msg;",
159-
"outputs": 1,
160-
"noerr": 0,
161-
"x": 457.5,
162-
"y": 353.75,
163-
"wires": [
164-
[
165-
"33bc905d.f4a09"
166-
]
167-
]
168-
},
169-
{
170-
"id": "33bc905d.f4a09",
171-
"type": "debug",
172-
"z": "12121a3f.3ee31e",
173-
"name": "",
174-
"active": true,
175-
"console": "false",
176-
"complete": "false",
177-
"x": 704.5,
178-
"y": 353.5,
179-
"wires": []
180-
},
181-
{
182-
"id": "95ea8a12.e7aa38",
183-
"type": "Generic BLE",
184-
"z": "",
185-
"localName": "nRF5x",
186-
"address": "f9:00:99:99:99:99",
187-
"uuid": "f90099999999",
188-
"listeningPeriod": "1000",
189-
"characteristics": [
190-
{
191-
"uuid": "2a00",
192-
"name": "Device Name",
193-
"type": "org.bluetooth.characteristic.gap.device_name",
194-
"notifiable": false,
195-
"readable": true,
196-
"writable": true,
197-
"writeWithoutResponse": false
198-
},
199-
{
200-
"uuid": "2a01",
201-
"name": "Appearance",
202-
"type": "org.bluetooth.characteristic.gap.appearance",
203-
"notifiable": false,
204-
"readable": true,
205-
"writable": false,
206-
"writeWithoutResponse": false
207-
},
208-
{
209-
"uuid": "2a04",
210-
"name": "Peripheral Preferred Connection Parameters",
211-
"type": "org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters",
212-
"notifiable": false,
213-
"readable": true,
214-
"writable": false,
215-
"writeWithoutResponse": false
216-
},
217-
{
218-
"uuid": "2a05",
219-
"name": "Service Changed",
220-
"type": "org.bluetooth.characteristic.gatt.service_changed",
221-
"notifiable": false,
222-
"readable": false,
223-
"writable": false,
224-
"writeWithoutResponse": false
225-
},
226-
{
227-
"uuid": "2a19",
228-
"name": "Battery Level",
229-
"type": "org.bluetooth.characteristic.battery_level",
230-
"notifiable": true,
231-
"readable": true,
232-
"writable": false,
233-
"writeWithoutResponse": false
234-
}
235-
]
236-
}
237-
]
238-
```
239-
240104
# Appendix
241105

242106
## How to build
@@ -266,6 +130,10 @@ sudo hcidump -t -x
266130
Set `GENERIC_BLE_TRACE=true` on starting Node-RED and you can find the precise log in `/var/log/syslog`.
267131

268132
# Revision History
133+
* 1.0.2
134+
- Improve README
135+
- Add an example flow file available from the editor UI
136+
269137
* 1.0.1
270138
- Fix an issue where custom characteristics cannot be listed on the Generic BLE config node dialog
271139

0 commit comments

Comments
 (0)