Skip to content

Commit a55f5b7

Browse files
author
Daisuke Baba
committed
Extract an example flow to a single file
1 parent 11adbe9 commit a55f5b7

File tree

2 files changed

+170
-174
lines changed

2 files changed

+170
-174
lines changed

README.md

Lines changed: 0 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -60,182 +60,8 @@ sudo systemctl restart candy-red
6060
```
6161
The above command performs `hciconfig hci0 reset` as well. So you don't have to run `hciconfig` command separately.
6262

63-
# Example Flow
6463

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.
6664

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-
```
23965

24066
# Appendix
24167

examples/01.read-write.json

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
[
2+
{
3+
"id": "12121a3f.3ee31e",
4+
"type": "tab",
5+
"label": "Generic BLE Example",
6+
"disabled": false,
7+
"info": "This flow shows BLE Read/Write example.\n"
8+
},
9+
{
10+
"id": "11b829f1.d5215e",
11+
"type": "Generic BLE in",
12+
"z": "12121a3f.3ee31e",
13+
"name": "",
14+
"genericBle": "95ea8a12.e7aa38",
15+
"useString": false,
16+
"notification": false,
17+
"x": 337.5,
18+
"y": 259.25,
19+
"wires": [
20+
[
21+
"486cfab5.aec02c",
22+
"f5a90326.7009a"
23+
]
24+
]
25+
},
26+
{
27+
"id": "64b63eaf.52e4a8",
28+
"type": "inject",
29+
"z": "12121a3f.3ee31e",
30+
"name": "Get Battery Level",
31+
"topic": "",
32+
"payload": "",
33+
"payloadType": "date",
34+
"repeat": "",
35+
"crontab": "",
36+
"once": false,
37+
"x": 223.5,
38+
"y": 129.25,
39+
"wires": [
40+
[
41+
"11b829f1.d5215e"
42+
]
43+
]
44+
},
45+
{
46+
"id": "486cfab5.aec02c",
47+
"type": "debug",
48+
"z": "12121a3f.3ee31e",
49+
"name": "",
50+
"active": false,
51+
"console": "false",
52+
"complete": "false",
53+
"x": 706.5,
54+
"y": 259.5,
55+
"wires": []
56+
},
57+
{
58+
"id": "3c6ec3aa.24cfbc",
59+
"type": "Generic BLE out",
60+
"z": "12121a3f.3ee31e",
61+
"name": "",
62+
"genericBle": "95ea8a12.e7aa38",
63+
"x": 576.5,
64+
"y": 489.5,
65+
"wires": []
66+
},
67+
{
68+
"id": "90562835.fb6488",
69+
"type": "inject",
70+
"z": "12121a3f.3ee31e",
71+
"name": "Write Some Data",
72+
"topic": "",
73+
"payload": "{\"2a00\":\"yayyay\"}",
74+
"payloadType": "json",
75+
"repeat": "",
76+
"crontab": "",
77+
"once": false,
78+
"x": 212.5,
79+
"y": 490.25,
80+
"wires": [
81+
[
82+
"3c6ec3aa.24cfbc"
83+
]
84+
]
85+
},
86+
{
87+
"id": "f5a90326.7009a",
88+
"type": "function",
89+
"z": "12121a3f.3ee31e",
90+
"name": "Extract Battery Level",
91+
"func": "var payload = msg.payload;\nvar buff = payload.characteristics['2a19'] || []\nmsg.payload = buff[0];\nreturn msg;",
92+
"outputs": 1,
93+
"noerr": 0,
94+
"x": 457.5,
95+
"y": 353.75,
96+
"wires": [
97+
[
98+
"33bc905d.f4a09"
99+
]
100+
]
101+
},
102+
{
103+
"id": "33bc905d.f4a09",
104+
"type": "debug",
105+
"z": "12121a3f.3ee31e",
106+
"name": "",
107+
"active": true,
108+
"console": "false",
109+
"complete": "false",
110+
"x": 704.5,
111+
"y": 353.5,
112+
"wires": []
113+
},
114+
{
115+
"id": "95ea8a12.e7aa38",
116+
"type": "Generic BLE",
117+
"z": "",
118+
"localName": "nRF5x",
119+
"address": "f9:00:99:99:99:99",
120+
"uuid": "f90099999999",
121+
"listeningPeriod": "1000",
122+
"characteristics": [
123+
{
124+
"uuid": "2a00",
125+
"name": "Device Name",
126+
"type": "org.bluetooth.characteristic.gap.device_name",
127+
"notifiable": false,
128+
"readable": true,
129+
"writable": true,
130+
"writeWithoutResponse": false
131+
},
132+
{
133+
"uuid": "2a01",
134+
"name": "Appearance",
135+
"type": "org.bluetooth.characteristic.gap.appearance",
136+
"notifiable": false,
137+
"readable": true,
138+
"writable": false,
139+
"writeWithoutResponse": false
140+
},
141+
{
142+
"uuid": "2a04",
143+
"name": "Peripheral Preferred Connection Parameters",
144+
"type": "org.bluetooth.characteristic.gap.peripheral_preferred_connection_parameters",
145+
"notifiable": false,
146+
"readable": true,
147+
"writable": false,
148+
"writeWithoutResponse": false
149+
},
150+
{
151+
"uuid": "2a05",
152+
"name": "Service Changed",
153+
"type": "org.bluetooth.characteristic.gatt.service_changed",
154+
"notifiable": false,
155+
"readable": false,
156+
"writable": false,
157+
"writeWithoutResponse": false
158+
},
159+
{
160+
"uuid": "2a19",
161+
"name": "Battery Level",
162+
"type": "org.bluetooth.characteristic.battery_level",
163+
"notifiable": true,
164+
"readable": true,
165+
"writable": false,
166+
"writeWithoutResponse": false
167+
}
168+
]
169+
}
170+
]

0 commit comments

Comments
 (0)