Skip to content

Commit 72b8a88

Browse files
authored
Merge pull request #20 from TIBCOSoftware/UpdateReadme
Rework raspberry samples and update readme file
2 parents 6ddd149 + 6acc069 commit 72b8a88

File tree

5 files changed

+608
-335
lines changed

5 files changed

+608
-335
lines changed

samples/aws_iot/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ Use AWS-IOT sample to update AWS-IoT Shadow
1919
* Download AWS IoT Certificate and Private file
2020
* Replace AWS Iot Certificate to root-CA.pem.crt and device.pem.crt
2121
* Replace AWS Iot Private key to device.pem.key
22-
* Copy things folder to where you start flogo, copy to where you run docker-compose-start.sh for user flow.
22+
* Mount things folde into flogo-web container when you start flogo:
23+
```bash
24+
docker run -it -p 3303:3303 -v ${thingsFolderPath}:/tmp/flogo-web/build/server/test-engine/bin/things flogo/flogo-web
25+
```
2326

2427
Please keep name same with root-CA.pem.crt, device.pem.crt and device.pem.key)
2528

2629

2730
### Import to Web UI
2831

29-
* Open Flogo web ui, eg:http://localhost:3010
32+
* Open Flogo web ui, eg:http://localhost:3303
3033
* Click Import a flow at right top of the page
3134
* Select aws_iot.json under web folder
3235
* Change the AWS-IOT(Update) acitivity's thingName and awsEndpoint field
@@ -47,7 +50,7 @@ flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/awsiot
4750
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/log
4851
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/reply
4952
flogo add trigger github.com/TIBCOSoftware/flogo-contrib/trigger/rest
50-
53+
#Make sure aws_iot.json file under current location
5154
flogo add flow aws_iot.json
5255
flogo build
5356

samples/helloworld/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Simple flow to count the number and print hello word
55

66
### Import to Web UI
77

8-
* Open Flogo web ui, eg:http://localhost:3010
9-
* Click Import a flow at right top of the page
10-
* Select helloworld.json under web folder
8+
* Open Flogo web ui, eg:http://localhost:3303
9+
* Click Import a flow
10+
* Select helloWorld.json under web folder
1111
* Now we can play on web ui.
1212

1313

@@ -25,6 +25,7 @@ Simple flow to count the number and print hello word
2525
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/log
2626
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/counter
2727
flogo add trigger github.com/TIBCOSoftware/flogo-contrib/trigger/timer
28+
#Make sure helloWorld.json file under current location
2829
flogo add flow helloWorld.json
2930
flogo build
3031
```

samples/raspberry_iot/README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,32 @@ The sample show how to use Flogo to control Raspberry PI GPIO
88
###Prerequisites
99

1010
* Prepare raspberry pi device and install default raspbian operation system
11-
* Install [WebIOPI](http://webiopi.trouch.com/INSTALL.html)
12-
* Disable authentication for webiopi by rename /etc/webiopi/passwd to /etc/webiopi/passwd_bak
13-
* Start WebIOPI server.
14-
* Open WebIOPI web ui http://raspberrypi:8000/app/gpio-header
15-
* Change GPIO 23 to OUT function that we use for this sample
1611

1712
### Import to Web UI
1813

19-
* Open Flogo web ui, eg:http://localhost:3010
20-
* Click Import a flow at right top of the page
14+
* Open Flogo web ui, eg:http://localhost:3303
15+
* Click Import a flow
2116
* Select raspberry_iot.json under web folder
22-
* Update raspberrypi's ip for GetStatus, SetToOn and SetToOff activities
2317
* Now you can play Flogo on web ui.
18+
* You cannot run it from web UI since it required raspberry pi environment so you should build engine by "build->ARM/Linux" and copy this executable file into raspberry environment and run it.
2419

2520
### Run from Flogo command line
2621

2722
* Please following flogo command line [Getting Started](https://github.com/TIBCOSoftware/flogo-cli#getting-started) guide
2823
* Using flow [raspberry_iot.json](https://github.com/TIBCOSoftware/flogo/blob/master/samples/raspberry_iot/cli/raspberry_iot.json) that under cli folder
29-
* Update raspberrypi's ip for GetStatus, SetToOn and SetToOff activities
3024
* Run command
3125

3226
```bash
3327
flogo create raspberry_iot
3428
cd raspberry_iot
35-
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/awsiot
29+
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/gpio
3630
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/log
3731
flogo add activity github.com/TIBCOSoftware/flogo-contrib/activity/reply
3832
flogo add trigger github.com/TIBCOSoftware/flogo-contrib/trigger/rest
39-
33+
#Make sure raspberry_iot.json file under current location
4034
flogo add flow raspberry_iot.json
41-
flogo build
35+
#Add build arguments since the default system is raspbian operation system
36+
GOOS=linux GOARCH=arm GOARM=7 flogo build
4237

4338
```
4439

@@ -70,15 +65,20 @@ flogo build
7065
```
7166

7267
* Modify Flogo engine configuration in bin/Config.json when necessary
68+
* Rename executabe file
69+
```bash
70+
#Rename raspberry_iot-linux-arm to raspberry_iot
71+
mv raspberry_iot-linux-arm raspberry_iot
72+
```
73+
* Copy Flogo Engine and configuration file under bin folder to raspberry system
7374
* Start Flogo Engine
7475
```bash
75-
cd bin
7676
./raspberry_iot
7777
```
7878
* Send a POST request to trigger
7979
For example:
8080
```
81-
URL: http://localhost:9999/lights/status
81+
URL: http://${raspberryhostname}:9999/lights/status
8282
```
8383
* The GPIO 23 pin's value will be switched between 1 and 0
8484

samples/raspberry_iot/cli/raspberry_iot.json

Lines changed: 114 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
"from": 3,
1818
"id": 2,
1919
"to": 4,
20-
"type": 1,
21-
"value": "${A3.result}==0"
20+
"type": 0
2221
},
2322
{
2423
"from": 4,
2524
"id": 3,
2625
"to": 5,
27-
"type": 0
26+
"type": 1,
27+
"value": "${A4.result}==0"
2828
},
2929
{
3030
"from": 5,
@@ -33,23 +33,29 @@
3333
"type": 0
3434
},
3535
{
36-
"from": 3,
36+
"from": 6,
3737
"id": 5,
3838
"to": 7,
39-
"type": 1,
40-
"value": "${A3.result}==1"
39+
"type": 0
4140
},
4241
{
43-
"from": 7,
42+
"from": 4,
4443
"id": 6,
4544
"to": 8,
46-
"type": 0
45+
"type": 1,
46+
"value": "${A4.result}==1"
4747
},
4848
{
4949
"from": 8,
5050
"id": 7,
5151
"to": 9,
5252
"type": 0
53+
},
54+
{
55+
"from": 9,
56+
"id": 8,
57+
"to": 10,
58+
"type": 0
5359
}
5460
],
5561
"name": "root",
@@ -78,20 +84,68 @@
7884
"type": 1
7985
},
8086
{
81-
"activityType": "tibco-rest",
87+
"activityType": "tibco-gpio",
8288
"attributes": [
8389
{
8490
"name": "method",
8591
"type": "string",
86-
"value": "GET"
92+
"value": "Direction"
93+
},
94+
{
95+
"name": "pinNumber",
96+
"type": "integer",
97+
"value": "23"
98+
},
99+
{
100+
"name": "direction",
101+
"type": "string",
102+
"value": "Output"
103+
},
104+
{
105+
"name": "state",
106+
"type": "string",
107+
"value": ""
87108
},
88109
{
89-
"name": "uri",
110+
"name": "Pull",
90111
"type": "string",
91-
"value": "http://10.97.170.106:8000/GPIO/23/value"
112+
"value": ""
92113
}
93114
],
94115
"id": 3,
116+
"name": "SetToOutput",
117+
"type": 1
118+
},
119+
{
120+
"activityType": "tibco-gpio",
121+
"attributes": [
122+
{
123+
"name": "method",
124+
"type": "string",
125+
"value": "Read State"
126+
},
127+
{
128+
"name": "pinNumber",
129+
"type": "integer",
130+
"value": "23"
131+
},
132+
{
133+
"name": "direction",
134+
"type": "string",
135+
"value": ""
136+
},
137+
{
138+
"name": "state",
139+
"type": "string",
140+
"value": ""
141+
},
142+
{
143+
"name": "Pull",
144+
"type": "string",
145+
"value": ""
146+
}
147+
],
148+
"id": 4,
95149
"name": "GetStatus",
96150
"type": 1
97151
},
@@ -114,32 +168,47 @@
114168
"value": "true"
115169
}
116170
],
117-
"id": 4,
171+
"id": 5,
118172
"inputMappings": [
119173
{
120174
"mapTo": "message",
121175
"type": 1,
122-
"value": "{A3.result}"
176+
"value": "{A4.result}"
123177
}
124178
],
125179
"name": "SetToOnLog",
126180
"type": 1
127181
},
128182
{
129-
"activityType": "tibco-rest",
183+
"activityType": "tibco-gpio",
130184
"attributes": [
131185
{
132186
"name": "method",
133187
"type": "string",
134-
"value": "POST"
188+
"value": "Set State"
135189
},
136190
{
137-
"name": "uri",
191+
"name": "pinNumber",
192+
"type": "integer",
193+
"value": "23"
194+
},
195+
{
196+
"name": "direction",
197+
"type": "string",
198+
"value": ""
199+
},
200+
{
201+
"name": "state",
138202
"type": "string",
139-
"value": "http://10.97.170.106:8000/GPIO/23/value/1"
203+
"value": "High"
204+
},
205+
{
206+
"name": "Pull",
207+
"type": "string",
208+
"value": ""
140209
}
141210
],
142-
"id": 5,
211+
"id": 6,
143212
"name": "SetToOn",
144213
"type": 1
145214
},
@@ -154,10 +223,10 @@
154223
{
155224
"name": "data",
156225
"type": "any",
157-
"value": "Update light to 1 successfully"
226+
"value": "Update light to high successfully"
158227
}
159228
],
160-
"id": 6,
229+
"id": 7,
161230
"name": "Reply To Trigger",
162231
"type": 1
163232
},
@@ -180,32 +249,47 @@
180249
"value": "true"
181250
}
182251
],
183-
"id": 7,
252+
"id": 8,
184253
"inputMappings": [
185254
{
186255
"mapTo": "message",
187256
"type": 1,
188-
"value": "{A3.result}"
257+
"value": "{A4.result}"
189258
}
190259
],
191260
"name": "SetToOffLog",
192261
"type": 1
193262
},
194263
{
195-
"activityType": "tibco-rest",
264+
"activityType": "tibco-gpio",
196265
"attributes": [
197266
{
198267
"name": "method",
199268
"type": "string",
200-
"value": "POST"
269+
"value": "Set State"
270+
},
271+
{
272+
"name": "pinNumber",
273+
"type": "integer",
274+
"value": "23"
275+
},
276+
{
277+
"name": "direction",
278+
"type": "string",
279+
"value": ""
280+
},
281+
{
282+
"name": "state",
283+
"type": "string",
284+
"value": "Low"
201285
},
202286
{
203-
"name": "uri",
287+
"name": "Pull",
204288
"type": "string",
205-
"value": "http://10.97.170.106:8000/GPIO/23/value/0"
289+
"value": ""
206290
}
207291
],
208-
"id": 8,
292+
"id": 9,
209293
"name": "SetToOff",
210294
"type": 1
211295
},
@@ -220,10 +304,10 @@
220304
{
221305
"name": "data",
222306
"type": "any",
223-
"value": "Update light to 1 successfully"
307+
"value": "Update light to low successfully"
224308
}
225309
],
226-
"id": 9,
310+
"id": 10,
227311
"name": "Reply To Trigger (2)",
228312
"type": 1
229313
}

0 commit comments

Comments
 (0)