-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor changes, Add client examples, Update examples
- Add code to bring interface up after config - Modify timing in gw.update() - Keep track of packets dropped from the network interface due to being received faster than then radio network can handle - Add extra info to ncurses example - Create client examples demonstrating how to automate control or requesting information from sensor nodes using various scripting methods (Python,Bash,NodeJS)
- Loading branch information
Showing
12 changed files
with
244 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
|
||
if (( $# != 2 )) | ||
then | ||
echo "Usage: ... ./bClient.sh <IP> <ON/OFF>" | ||
exit 1 | ||
fi | ||
|
||
IP=$1 | ||
PAGE=$2 | ||
|
||
URL=":1000/" | ||
SUFFIX="</td*" | ||
|
||
#Build a request ( http://10.10.2.4:1000/ON ) | ||
REQUEST="http://"$IP$URL$PAGE | ||
|
||
#Make the request, with 1 retry and a timeout of 10 seconds per retry (max 20 seconds per request) | ||
RESULT=$(wget -q --tries=1 --timeout=10 -O- $REQUEST | grep 'LED is') | ||
|
||
#Trim the HTML from the result | ||
RESULT=${RESULT%$SUFFIX} | ||
|
||
#If succesful, print status, else indicate failure | ||
if [ ${#RESULT} -ne 0 ] | ||
then | ||
echo $RESULT | ||
else | ||
echo "Request Failed" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
bClient.sh example for use with RF24Ethernet/RF24Gateway | ||
|
||
Once RF24Gateway and RF24Ethernet are configured, standard tools can be used to interact with | ||
the sensor nodes. | ||
|
||
This is a simple example demonstrating how to connect directly to a sensor node running one of the | ||
included server examples via a bash script and control LEDs/lighting. | ||
|
||
Usage: | ||
1. Edit bClient.sh and configure the options | ||
2. Run sudo ./bClient.sh <IP OF NODE> <ON or OFF> ie: ./bClient.sh 10.10.2.4 ON | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
|
||
var request = require('request') | ||
var url = 'http://10.10.2.4:1000/ON' // input your url here /ON to turn on and /OFF to turn off | ||
|
||
// use a timeout value of 10 seconds | ||
var timeoutInMilliseconds = 10*1000 | ||
var opts = { | ||
url: url, | ||
timeout: timeoutInMilliseconds | ||
} | ||
|
||
request(opts, function (err, res, body) { | ||
if (err) { | ||
console.dir(err) | ||
return | ||
} | ||
var statusCode = res.statusCode | ||
console.log('status code: ' + statusCode) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
nodeClient.js example for use with RF24Ethernet/RF24Gateway | ||
|
||
Once RF24Gateway and RF24Ethernet are configured, standard tools can be used to interact with | ||
the sensor nodes. | ||
|
||
This is a simple example demonstrating how to connect directly to a sensor node running one of the | ||
included server examples via a NodeJS script and control LEDs/lighting. | ||
|
||
Usage: | ||
1. a: Edit nodeClient.js and configure the URL( Sensor IP, page to request (OFF,ON) | ||
b: From the example directory, run ```npm install request``` | ||
2. Run ```node nodeClient.js``` | ||
3. Status code: 200 indicates success | ||
|
Oops, something went wrong.