ardtweeno 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +37 -0
- data/Gemfile.lock +26 -16
- data/README.md +15 -11
- data/lib/ardtweeno/configreader.rb +1 -1
- data/lib/ardtweeno/dispatcher.rb +253 -31
- data/lib/ardtweeno/exceptions.rb +6 -0
- data/lib/ardtweeno/nodemanager.rb +13 -7
- data/lib/ardtweeno/restapi.rb +68 -21
- data/lib/ardtweeno/serialparser.rb +57 -105
- data/lib/ardtweeno.rb +15 -9
- data/public/bootstrap.min.js +6 -0
- data/public/highcharts.js +270 -0
- data/public/jquery-1.8.2.min.js +2 -0
- data/public/jquery-2.0.1.min.js +6 -0
- data/public/main.css +338 -3
- data/public/main.js +30 -0
- data/resources/conf.yaml +2 -13
- data/resources/posts.yaml +7 -0
- data/test/api_test.rb +29 -7
- data/test/{run_mock → debug/run_mock} +0 -0
- data/test/{run_packet_push → debug/run_packet_push} +3 -3
- data/test/debug/run_post_watch +12 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/AUTHORS +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/COPYING +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/INSTALL +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/README +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/THANKS +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/TODO +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/VERSION +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/Makefile +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/Module.symvers +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/modules.order +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/tty0tty.c +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/tty0tty.ko +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/tty0tty.mod.c +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/tty0tty.mod.o +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/module/tty0tty.o +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/pts/Makefile +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/pts/tty0tty +0 -0
- data/test/{tty0tty-1.1 → debug/tty0tty-1.1}/pts/tty0tty.c +0 -0
- data/test/dispatcher_test.rb +116 -2
- data/test/nodemanager_test.rb +9 -0
- data/test/parser_test.rb +35 -92
- data/test/rest_api_test.rb +45 -15
- data/test/serialport_mock.rb +4 -4
- data/test/test_helper.rb +9 -3
- data/views/createpost.erb +48 -39
- data/views/home.erb +25 -57
- data/views/index.erb +54 -0
- data/views/status.erb +158 -0
- metadata +144 -28
- data/public/glossy_green_button.svg +0 -123
- data/public/glossy_red_button.svg +0 -75
- data/public/raspberrypi.jpg +0 -0
- data/resources/serialparser.js +0 -84
- data/test/post_watch +0 -11
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
-
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
-
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="400" height="400" id="svg11772" version="1.1" inkscape:version="0.48.0 r9654" sodipodi:docname="glossy_blue_button.svg">
|
|
4
|
-
<defs id="defs11774">
|
|
5
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient4156" id="linearGradient11748" gradientUnits="userSpaceOnUse" x1="241.40979" y1="287.49377" x2="315.47369" y2="367.88477"/>
|
|
6
|
-
<linearGradient id="linearGradient4156" inkscape:collect="always">
|
|
7
|
-
<stop id="stop4158" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
|
|
8
|
-
<stop id="stop4160" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
9
|
-
</linearGradient>
|
|
10
|
-
<filter id="filter6126" inkscape:collect="always" color-interpolation-filters="sRGB">
|
|
11
|
-
<feGaussianBlur id="feGaussianBlur6128" stdDeviation="0.53035713" inkscape:collect="always"/>
|
|
12
|
-
</filter>
|
|
13
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient7171" id="linearGradient11750" gradientUnits="userSpaceOnUse" x1="275.60828" y1="300.86383" x2="341.99622" y2="391.44925"/>
|
|
14
|
-
<linearGradient id="linearGradient7171">
|
|
15
|
-
<stop id="stop7173" offset="0" style="stop-color:#00112b;stop-opacity:1"/>
|
|
16
|
-
<stop id="stop7175" offset="1" style="stop-color:#0055d4;stop-opacity:1"/>
|
|
17
|
-
</linearGradient>
|
|
18
|
-
<radialGradient inkscape:collect="always" xlink:href="#linearGradient7111" id="radialGradient11752" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.5932658,-0.5932658,0.7150464,-0.7150486,243.27022,849.03358)" cx="312.78131" cy="386.57211" fx="312.78131" fy="386.57211" r="53.035713"/>
|
|
19
|
-
<linearGradient id="linearGradient7111">
|
|
20
|
-
<stop id="stop7113" offset="0" style="stop-color:#ffffff;stop-opacity:0.40816328;"/>
|
|
21
|
-
<stop id="stop7115" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
22
|
-
</linearGradient>
|
|
23
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient4148" id="linearGradient11754" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9553353,0,0,0.9553353,55.103173,472.67243)" x1="255.31609" y1="286.66653" x2="300.26785" y2="338.81863"/>
|
|
24
|
-
<linearGradient id="linearGradient4148" inkscape:collect="always">
|
|
25
|
-
<stop id="stop4150" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
|
|
26
|
-
<stop id="stop4152" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
27
|
-
</linearGradient>
|
|
28
|
-
<linearGradient y2="338.81863" x2="300.26785" y1="286.66653" x1="255.31609" gradientTransform="matrix(0.9553353,0,0,0.9553353,55.103173,472.67243)" gradientUnits="userSpaceOnUse" id="linearGradient11820" xlink:href="#linearGradient4148" inkscape:collect="always"/>
|
|
29
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient4156-1" id="linearGradient11732" gradientUnits="userSpaceOnUse" x1="241.40979" y1="287.49377" x2="315.47369" y2="367.88477"/>
|
|
30
|
-
<linearGradient id="linearGradient4156-1" inkscape:collect="always">
|
|
31
|
-
<stop id="stop4158-0" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
|
|
32
|
-
<stop id="stop4160-0" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
33
|
-
</linearGradient>
|
|
34
|
-
<filter id="filter6126-7" inkscape:collect="always" color-interpolation-filters="sRGB">
|
|
35
|
-
<feGaussianBlur id="feGaussianBlur6128-1" stdDeviation="0.53035713" inkscape:collect="always"/>
|
|
36
|
-
</filter>
|
|
37
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient7199" id="linearGradient11734" gradientUnits="userSpaceOnUse" x1="275.60828" y1="300.86383" x2="341.99622" y2="391.44925"/>
|
|
38
|
-
<linearGradient id="linearGradient7199">
|
|
39
|
-
<stop style="stop-color:#550000;stop-opacity:1" offset="0" id="stop7201"/>
|
|
40
|
-
<stop style="stop-color:#ff0000;stop-opacity:1" offset="1" id="stop7203"/>
|
|
41
|
-
</linearGradient>
|
|
42
|
-
<radialGradient inkscape:collect="always" xlink:href="#linearGradient7111-1" id="radialGradient11736" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-0.5932658,-0.5932658,0.7150464,-0.7150486,243.27022,849.03358)" cx="312.78131" cy="386.57211" fx="312.78131" fy="386.57211" r="53.035713"/>
|
|
43
|
-
<linearGradient id="linearGradient7111-1">
|
|
44
|
-
<stop id="stop7113-1" offset="0" style="stop-color:#ffffff;stop-opacity:0.40816328;"/>
|
|
45
|
-
<stop id="stop7115-8" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
46
|
-
</linearGradient>
|
|
47
|
-
<linearGradient inkscape:collect="always" xlink:href="#linearGradient4148-9" id="linearGradient11738" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.9553353,0,0,0.9553353,-84.896827,472.67243)" x1="255.31609" y1="286.66653" x2="300.26785" y2="338.81863"/>
|
|
48
|
-
<linearGradient id="linearGradient4148-9" inkscape:collect="always">
|
|
49
|
-
<stop id="stop4150-3" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
|
|
50
|
-
<stop id="stop4152-8" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
|
|
51
|
-
</linearGradient>
|
|
52
|
-
<linearGradient y2="338.81863" x2="300.26785" y1="286.66653" x1="255.31609" gradientTransform="matrix(0.9553353,0,0,0.9553353,-84.896827,472.67243)" gradientUnits="userSpaceOnUse" id="linearGradient11925" xlink:href="#linearGradient4148-9" inkscape:collect="always"/>
|
|
53
|
-
</defs>
|
|
54
|
-
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.98994949" inkscape:cx="211.24527" inkscape:cy="230.76804" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1280" inkscape:window-height="748" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"/>
|
|
55
|
-
<metadata id="metadata11777">
|
|
56
|
-
<rdf:RDF>
|
|
57
|
-
<cc:Work rdf:about="">
|
|
58
|
-
<dc:format>image/svg+xml</dc:format>
|
|
59
|
-
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
|
60
|
-
<dc:title/>
|
|
61
|
-
</cc:Work>
|
|
62
|
-
</rdf:RDF>
|
|
63
|
-
</metadata>
|
|
64
|
-
<g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-652.36218)">
|
|
65
|
-
<g id="g11689" transform="matrix(2.9051461,0,0,2.9051461,-368.53183,-1417.5461)">
|
|
66
|
-
<path sodipodi:type="arc" style="fill:#999999;fill-opacity:1;stroke:none" id="path7177" sodipodi:cx="303.75" sodipodi:cy="346.11218" sodipodi:rx="53.035713" sodipodi:ry="53.035713" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" transform="matrix(0.9735424,0,0,0.9735424,-100.92321,445.98894)"/>
|
|
67
|
-
<path sodipodi:type="arc" style="fill:url(#linearGradient11732);fill-opacity:1;stroke:none" id="path7179" sodipodi:cx="303.75" sodipodi:cy="346.11218" sodipodi:rx="53.035713" sodipodi:ry="53.035713" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" transform="matrix(0.9595959,0,0,0.9595959,-96.686937,450.81603)"/>
|
|
68
|
-
<path transform="matrix(0.8735475,0,0,0.8735475,-70.549757,480.5984)" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" sodipodi:ry="53.035713" sodipodi:rx="53.035713" sodipodi:cy="346.11218" sodipodi:cx="303.75" id="path7181" style="fill:#ececec;fill-opacity:1;stroke:none;filter:url(#filter6126-7)" sodipodi:type="arc"/>
|
|
69
|
-
<path sodipodi:type="arc" style="fill:#999999;fill-opacity:1;stroke:none;filter:url(#filter6126-7)" id="path7183" sodipodi:cx="303.75" sodipodi:cy="346.11218" sodipodi:rx="53.035713" sodipodi:ry="53.035713" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" transform="matrix(0.8383837,0,0,0.8383837,-59.868747,492.76902)"/>
|
|
70
|
-
<path sodipodi:type="arc" style="fill:url(#linearGradient11734);fill-opacity:1;stroke:none" id="path7185" sodipodi:cx="303.75" sodipodi:cy="346.11218" sodipodi:rx="53.035713" sodipodi:ry="53.035713" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" transform="matrix(0.8058691,0,0,0.8058691,-49.992417,504.02274)"/>
|
|
71
|
-
<path transform="matrix(0.7582525,0,0,0.7582525,-34.266187,522.52374)" d="m 356.78571,346.11218 c 0,29.29082 -23.74489,53.03572 -53.03571,53.03572 -29.29082,0 -53.03571,-23.7449 -53.03571,-53.03572 0,-29.29081 23.74489,-53.03571 53.03571,-53.03571 29.29082,0 53.03571,23.7449 53.03571,53.03571 z" sodipodi:ry="53.035713" sodipodi:rx="53.035713" sodipodi:cy="346.11218" sodipodi:cx="303.75" id="path7187" style="fill:url(#radialGradient11736);fill-opacity:1;stroke:none" sodipodi:type="arc"/>
|
|
72
|
-
<path id="path7189" d="m 193.78625,742.76451 c -13.3306,0.30069 -26.18606,7.35801 -33.33579,19.74172 -7.69026,13.31988 -6.71392,29.26602 1.15447,41.33061 0.85306,-26.53161 21.13176,-46.51511 46.32378,-45.05384 8.25891,0.47907 16.05431,3.20007 22.85883,7.59075 -3.25775,-7.44975 -8.8171,-13.95312 -16.3937,-18.32748 -6.48672,-3.74508 -13.62489,-5.43927 -20.60759,-5.28176 z" style="opacity:0.31770833;fill:url(#linearGradient11925);fill-opacity:1;stroke:none" inkscape:connector-curvature="0"/>
|
|
73
|
-
</g>
|
|
74
|
-
</g>
|
|
75
|
-
</svg>
|
data/public/raspberrypi.jpg
DELETED
|
Binary file
|
data/resources/serialparser.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var serialport = require("serialport");
|
|
2
|
-
var SerialPort = serialport.SerialPort;
|
|
3
|
-
var needle = require('needle');
|
|
4
|
-
|
|
5
|
-
// Read in the ARGV object parameters and remove the first two which hold the node variable
|
|
6
|
-
// and the name of the script file.
|
|
7
|
-
var myArgs = process.argv.slice(2);
|
|
8
|
-
|
|
9
|
-
// Check to ensure the remaining parameters size is 2
|
|
10
|
-
if(!(myArgs.length == 3)){
|
|
11
|
-
console.log("Usage: node serialparser.js /dev/ttyUSB0 9600 adminkey");
|
|
12
|
-
process.exit();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
var dev = myArgs[0];
|
|
16
|
-
var options = {
|
|
17
|
-
parser: serialport.parsers.raw,
|
|
18
|
-
baudrate: parseInt(myArgs[1])
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
var sp = new SerialPort(dev, options);
|
|
22
|
-
var tempData = "";
|
|
23
|
-
var attempts = 0;
|
|
24
|
-
|
|
25
|
-
sp.on("data", function (data) {
|
|
26
|
-
data = data.toString().trim();
|
|
27
|
-
|
|
28
|
-
console.log("Data received: " + data);
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
if(attempts > 0){
|
|
32
|
-
throw new Error('Preventing loss of data in buffer');
|
|
33
|
-
}
|
|
34
|
-
JSON.parse(data);
|
|
35
|
-
tempData = "";
|
|
36
|
-
attempts = 0;
|
|
37
|
-
console.log("Data for transmit: " + data);
|
|
38
|
-
var theData = 'key=' + myArgs[2] + '&payload=' + data
|
|
39
|
-
|
|
40
|
-
needle.post('http://localhost:4567/api/v1/packets', theData, function(err, resp, body){
|
|
41
|
-
try {
|
|
42
|
-
console.log("Got status code: " + resp.statusCode);
|
|
43
|
-
// you can pass params as a string or as an object
|
|
44
|
-
} catch (e){
|
|
45
|
-
console.log(e.message)
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
} catch (e) {
|
|
50
|
-
tempData += data;
|
|
51
|
-
tempData = tempData.trim();
|
|
52
|
-
|
|
53
|
-
if(attempts < 15){
|
|
54
|
-
try {
|
|
55
|
-
JSON.parse(tempData);
|
|
56
|
-
data = tempData;
|
|
57
|
-
tempData = "";
|
|
58
|
-
attempts = 0;
|
|
59
|
-
console.log("Data for transmit: " + data);
|
|
60
|
-
var theData = 'key=' + myArgs[2] + '&payload=' + data
|
|
61
|
-
|
|
62
|
-
needle.post('http://localhost:4567/api/v1/packets', theData, function(err, resp, body){
|
|
63
|
-
try {
|
|
64
|
-
console.log("Got status code: " + resp.statusCode);
|
|
65
|
-
// you can pass params as a string or as an object
|
|
66
|
-
} catch (e){
|
|
67
|
-
console.log(e.message)
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
} catch(e){
|
|
72
|
-
console.log("buffer contains: " + tempData);
|
|
73
|
-
console.log("Nope still not a valid JSON string, buffering...");
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
else
|
|
78
|
-
{
|
|
79
|
-
tempData = "";
|
|
80
|
-
attempts = 0;
|
|
81
|
-
}
|
|
82
|
-
attempts += 1;
|
|
83
|
-
}
|
|
84
|
-
});
|
data/test/post_watch
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
require 'rubygems'
|
|
2
|
-
require 'typhoeus'
|
|
3
|
-
require 'json'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
body = {:key=> "1230aea77d7bd38898fec74a75a87738dea9f657",
|
|
7
|
-
:notifyURL=>"",
|
|
8
|
-
:method=>"POST",
|
|
9
|
-
:timeout=>"60"}
|
|
10
|
-
|
|
11
|
-
puts Typhoeus::Request.post("http://localhost:4567/api/v1/watch/node2", :body=>body)
|