ardtweeno 0.0.2 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +179 -1
  3. data/COPYING +4 -3
  4. data/Gemfile +29 -0
  5. data/Gemfile.lock +76 -0
  6. data/INSTALL +12 -0
  7. data/Procfile +1 -0
  8. data/README.md +26 -2
  9. data/Rakefile +14 -7
  10. data/lib/ardtweeno/api.rb +542 -0
  11. data/lib/ardtweeno/configreader.rb +65 -0
  12. data/lib/ardtweeno/db.rb +51 -0
  13. data/lib/ardtweeno/dispatcher.rb +538 -0
  14. data/lib/ardtweeno/exceptions.rb +33 -0
  15. data/lib/ardtweeno/node.rb +117 -0
  16. data/lib/ardtweeno/nodemanager.rb +300 -0
  17. data/lib/ardtweeno/packet.rb +98 -0
  18. data/lib/ardtweeno/restapi.rb +266 -0
  19. data/lib/ardtweeno/serialparser.rb +221 -0
  20. data/lib/ardtweeno.rb +120 -1
  21. data/public/glossy_green_button.svg +123 -0
  22. data/public/glossy_red_button.svg +75 -0
  23. data/public/main.css +129 -0
  24. data/public/raspberrypi.jpg +0 -0
  25. data/resources/conf.yaml +41 -0
  26. data/resources/nodelist.yaml +26 -0
  27. data/resources/serialparser.js +84 -0
  28. data/test/api_test.rb +255 -0
  29. data/test/dispatcher_test.rb +115 -0
  30. data/test/node_test.rb +105 -0
  31. data/test/nodemanager_test.rb +167 -0
  32. data/test/packet_test.rb +75 -0
  33. data/test/parser_test.rb +147 -0
  34. data/test/post_watch +11 -0
  35. data/test/rest_api_test.rb +248 -0
  36. data/test/run_mock +17 -0
  37. data/test/run_packet_push +14 -0
  38. data/test/serialport_mock.rb +43 -0
  39. data/test/test_helper.rb +15 -0
  40. data/test/tty0tty-1.1/AUTHORS +1 -0
  41. data/test/tty0tty-1.1/COPYING +340 -0
  42. data/test/tty0tty-1.1/INSTALL +18 -0
  43. data/test/tty0tty-1.1/README +52 -0
  44. data/test/tty0tty-1.1/THANKS +4 -0
  45. data/test/tty0tty-1.1/TODO +3 -0
  46. data/test/tty0tty-1.1/VERSION +4 -0
  47. data/test/tty0tty-1.1/module/Makefile +41 -0
  48. data/{bin/ardtweeno → test/tty0tty-1.1/module/Module.symvers} +0 -0
  49. data/test/tty0tty-1.1/module/modules.order +1 -0
  50. data/test/tty0tty-1.1/module/tty0tty.c +678 -0
  51. data/test/tty0tty-1.1/module/tty0tty.ko +0 -0
  52. data/test/tty0tty-1.1/module/tty0tty.mod.c +51 -0
  53. data/test/tty0tty-1.1/module/tty0tty.mod.o +0 -0
  54. data/test/tty0tty-1.1/module/tty0tty.o +0 -0
  55. data/test/tty0tty-1.1/pts/Makefile +10 -0
  56. data/test/tty0tty-1.1/pts/tty0tty +0 -0
  57. data/test/tty0tty-1.1/pts/tty0tty.c +222 -0
  58. data/views/createpost.erb +45 -0
  59. data/views/home.erb +59 -0
  60. metadata +89 -37
  61. data/README +0 -1
  62. data/test/Rakefile +0 -6
  63. data/test/features/ardtweeno.feature +0 -14
  64. data/test/features/step_definitions/ardtweeno_steps.rb +0 -24
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 63968507920512729a01dd5e5952ce70b427bf99
4
+ data.tar.gz: 00a74be7f57bded6c488096b3c49bc3b4ee8eb82
5
+ SHA512:
6
+ metadata.gz: b781f4581fb7f475cfbb219f53ae547a8e618115c6e01bf922396d34143fdbfbc7955e9f3a0f6c3a9af42df5dc5e55f4eecb6855a854a7639ce24a474cc6a6d9
7
+ data.tar.gz: 54ecc4d3c96a512f42d04c89e92a594b87f8b337ca089781b9fe7390972d151080cb26187b1853c54f8f3a35776b1bcc61c949099026b17bfa307387cd0444ec
data/CHANGELOG CHANGED
@@ -1,6 +1,184 @@
1
+ ## Version 0.2.5 Engineering Release 2 RC5
2
+ - Updated gemspec in preparation for release of ER 2
3
+ - Updated REST API to be more robust when printing news posts
4
+ - Latest documentation build
5
+ - Added documentation supporting the newly implemented watch list and push notifications
6
+ - Added EagleCAD schematics for Ardtweeno Nodes
7
+ - Added latest project documentation and image assets
8
+
9
+ ## Version 0.2.4 Engineering Release 2 RC4
10
+ - Removed debugging statements from REST API Sinatra app
11
+ - Updated Gemfile with a new dependency Typhoeus
12
+ - Implemented push notification system
13
+ - Implemented testing scheme for the push notifications
14
+ - Implemented system for placing an Ardtweeno::Node in a watchlist
15
+ - Implemented testing scheme for watchlist
16
+ - Implemented test script to add a Node to a watchlist
17
+ - Removed debug statements from rescue blocks
18
+
19
+ ## Version 0.2.3 Engineering Release 2 RC3
20
+ - Slightly edited output from topology generator
21
+ - Removed some debug statements from punchcard generator code
22
+ - Added image assets for documentation
23
+ - Updated project documentation to the latest versions
24
+ - Removing debug statements
25
+ - Implemented node punchcard graph generator
26
+ - CHANGELOG updated to contain 0.2.2 featureset
27
+
28
+ ## Version 0.2.2 Engineering Release 2 RC2
29
+ - Implemented tests to cover the post creation system
30
+ - Implemented manual post update system
31
+ - Added code highlighting to code blocks in posts
32
+ - Added skeleton page for manually adding posts
33
+ - Implemented skeleton API functionality for adding posts
34
+ - Updated CSS
35
+
36
+ ## Version 0.2.1 Engineering Release 2 RC2
37
+ - Latest codebase for the Ardtweeno project
38
+ - Updated Arduino FIO firmware sketch for node1 to light led on detection of movement
39
+ - Added new firmware for node1 movement sensor platform
40
+ - Resolved issue with params not being passed correctly between methods
41
+ - Implemented multiple zone statistics graphs being produced by the tech-demo
42
+ - Added skeleton framework for handling contact form submits
43
+ - Implemented statistics graph displaying on front of tech-demo - Removed a lot of unneeded javascript
44
+ - Updated node sensor graph view to now correctly display the name of the node being graphed - Added link to return to the previous view from the node sensor graph view - Added a number of javascript libraries which will possibly be used later
45
+ - Sensor graphs produced through /data/:node now use the last 60 packet data
46
+ - Updated the node.js serialparser script to buffer fragmented data input better
47
+ - Updated Arduino FIO firmware
48
+
49
+ ## Version 0.2.0 Engineering Release 2 RC1
50
+ - Updated tech demo to return 503 Service Unavailable should the gateway be unavailable
51
+ - Deleted nodejs compiled modules
52
+ - Updated Ardtweeno RESTAPI to the latest codebase
53
+ - Updated project documentation sections: API Spec, Iteration Plan and Project Backlog to the latest versions
54
+ - Built latest version of the documentation
55
+ - Fixed issue with the Twitter section of the tech demo being unaccessible through the sidebar menu
56
+ - Implemented graph view
57
+ - Implemented tech demo graphing code
58
+ - Fleshed out node graphing skeleton code
59
+ - Skeleton implementation of node graphs
60
+ - Refactored tech-demo packets api call
61
+ - Altered the api calls to the packets interface to retrieve the last 5 packets in the tech-demo
62
+ - Updated project sections bibliography, iteration plan and backlog
63
+ - Implemented dynamic generation of topology graph being loaded into the topology section of the tech-demo app
64
+ - Deleted proof of concept topology generator script
65
+
66
+ ## Version 0.1.13 Minimum Viable Product Engineering Release 1 RC13
67
+ - Updated README.md to include screenshot of the Topology Generator
68
+ - Implemented dynamic topology graph generator using data pulled from the Ardtweeno API
69
+ - Skeleton implementation of /gateway/topology in the tech-demo application
70
+ - Updated project documentation section iteration plan to latest version
71
+ - Updated tech demo with sample Raphael.js code for constructing a network topology graph
72
+ - Implemented tests for /api/:version/system/status API calls
73
+ - Implemented query for nodes - Implemented query for packets - Modified layout of control panel
74
+
75
+ ## Version 0.1.12 Minimum Viable Product Engineering Release 1 RC12
76
+ - Updated sample Arduino FIO sketch
77
+ - Implemented simple query for the zones api
78
+ - Updated documentation sections api specification and iteration plan
79
+ - Implemented gateway control panel system
80
+ - Implemented addition to the rest api to include system status
81
+ - Implemented basic ajax calls in the gateway control panel
82
+ - Extending tech demo with control panel interface to control the gateway
83
+ - Added CSS styling for URLS in the links section of the Ardtweeno Tech Demo
84
+ - Updated tech-demo style to ensure forkme ribbon is in the correct place
85
+ - Updated image assets used in tech-demo
86
+ - Implemented Skeleton Tech Demo web app for the Ardtweeno system
87
+
88
+ ## Version 0.1.11 Minimum Viable Product Engineering Release 1 RC11
89
+ - Implemented basic system for writing packets to the MongoDB Database
90
+ - Implemented skeleton code to handle the database connection and recover from connection errors
91
+ - Fixed bug with sorting of the packets being returned by the retrieve_packets REST API function
92
+ - Added latest information on API specification documentation
93
+ - Updated documentation to latest revisions
94
+
95
+
96
+ ## Version 0.1.10 Minimum Viable Product Engineering Release 1 RC10
97
+ - Added API implementation and tests for zones
98
+ - Added /api/v1/zones and /api/v1/zones/:zonename
99
+ - Skeleton implementation of zones
100
+ - Implemented /api/v1/system/config interface
101
+ - Implemented tests for the system/config hook
102
+ - Updated layout of the conf.yaml file to incorporate future zones data
103
+ - Implemented testing suite for nodes filtering parameters
104
+ - Implemented Ardtweeno::API functions to handle RESTAPI calls to filter nodes data
105
+
106
+
107
+ ## Version 0.1.9 Minimum Viable Product Engineering Release 1 RC9
108
+ - Implemented /api/v1/nodes REST API target
109
+ - Implemented Ardtweeno::API functions to handle nodes lookup
110
+ - Implemented test suite to test newly added API nodes functions
111
+ - Resolved previously unknown bug with newly constructed nodes not being passed initial parameters correctly
112
+ - Updated project documentation to latest revisions
113
+
114
+
115
+ ## Version 0.1.8 Minimum Viable Product Engineering Release 1 RC8
116
+ - Implemented REST API tests for date, hour and minute API calls
117
+ - Implemented tests for the seqNo API calls
118
+ - Implemented API handling of seqno, date, minute and hour
119
+ - Implemented internal testing of seqno, date, minute and hour API features
120
+ - Updated CHANGELOG file permissions to 644
121
+ - Added latest version of the section-iteration-plan documentation file
122
+ - Removed resources/rest-api from the repo as it has now been successfully integrated elsewhere in the system
123
+
124
+
125
+ ## Version 0.1.7 Minimum Viable Product Engineering Release 1 RC7
126
+ - Refactored RESTAPI system to ensure it can be executed directly from the gem root directory using the foreman Procfile launcher
127
+ - Updated Ardtweeno gemspec
128
+ - Updated image assets - Updated section-iteration-plan to latest revision
129
+
130
+
131
+ ## Version 0.1.6 Minimum Viable Product Engineering Release 1 RC6
132
+ - Added rack-test, test-unit and removed simplecov gem requirements from Gemfile
133
+ - Added empty bin folder to fix issues with gem build failing on Mac Ruby 1.8.7
134
+ - Updated require statements in the serialparser.rb
135
+ - Updated gemspec to remove the bin folder
136
+ - Added timing measurement functions to the API lookup function
137
+ - Updated documentation section-iteration-plan and section-api-specification
138
+ - Updated RESTAPI to ensure the rufus-scheduler continues to operate after being moved over to the foreman system
139
+ - Updated REST API routes to best practices, API calls are now formatted like: /api/{version}/{target}
140
+ - Updated the node.js serialparser implementation to work with the new REST API routes
141
+ - Fixed issues with the REST API tests failing
142
+ - Updated presentation-assets - Updated section-iteration-plan documentation to latest revision
143
+ - Updated INSTALL instructions to the latest revision
144
+
145
+
146
+ ## Version 0.1.5 Minimum Viable Product Engineering Release 1 RC5
147
+ - Added bundler configuration file for the REST API
148
+ - Added foreman configuration file for launching the REST API
149
+ - Renamed resources/rest-api/ardtweeno.rb -> web.rb to allow execution on the heroku.com paas
150
+ - Updated image assets being used in project poster
151
+ - Updated documentation section-iteration-plan to latest revision
152
+ - Updated ardtweeno rest-api app scheduling to run serialisation every hour
153
+
154
+ ## Version 0.1.4 Minimum Viable Product Engineering Release 1 RC4
155
+ - Implemented MVP functionality to write packets to ~/.ardtweeno/packetdb.yaml
156
+ - Updated Gemfile dependency list to latest revision
157
+
158
+ ## Version 0.1.3 Minimum Viable Product Engineering Release 1 RC3
159
+ - Updated Rakefile with exception handling to fail gracefully should a system not have bundler installed
160
+ - Added exception handling to packet storage calls
161
+ - Implemented the basic function structure for flushing packet data to disk - Updated dependencies to include rufus-scheduler
162
+ - Updated CHANGELOG to the latest revision
163
+
164
+ ## Version 0.1.2 Minimum Viable Product Engineering Release 1 RC2
165
+ - Added section-mvp-installation
166
+ - Updated section-minimum-system-requirements
167
+ - Updated section-project-deliverables
168
+ - Switched method of handling dependencies to Bundler, added support files to enable change
169
+ - Updated INSTALL instructions
170
+ - Updated section-iteration-plan and section-api-specification to latest revisions
171
+
172
+ ## Version 0.1.1 Minimum Viable Product Engineering Release 1 RC1
173
+ - Fixed issue with resultset transformation prioritisation, resultset sorting now performed last thing as intended
174
+ - Updated README.md
175
+
176
+ ## Version 0.1.0
177
+ - MVP featureset implemented
178
+
1
179
  ## Version 0.0.2
2
180
  - Fixed typo in gemspec description
3
181
 
4
182
  ## Version 0.0.1
5
- - Placeholder framework in place
183
+ - Placeholder gem in place
6
184
 
data/COPYING CHANGED
@@ -1,6 +1,7 @@
1
- This software is released under the creative commons attribution-sharealike 3.0 unported (cc by-sa 3.0) licence.
2
- for more information see: http://creativecommons.org/licenses/by-sa/3.0/
1
+ This software is released under the Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) licence.
2
+ for more information see: http://creativecommons.org/licenses/by-nc/3.0/
3
3
 
4
4
  All code is distributed in the hope that it will be useful, but WITHOUT
5
5
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6
- FITNESS FOR A PARTICULAR PURPOSE.
6
+ FITNESS FOR A PARTICULAR PURPOSE.
7
+
data/Gemfile ADDED
@@ -0,0 +1,29 @@
1
+ source "http://rubygems.org"
2
+
3
+ # The Ardtweeno Application Gateway
4
+ gem "ardtweeno"
5
+
6
+ # Utility
7
+ gem "rake"
8
+ gem "nokogiri"
9
+ gem "rack", ">= 1.1"
10
+ gem "foreman"
11
+ gem "json"
12
+ gem "typhoeus", ">= 0.6.3"
13
+
14
+ # For the Database
15
+ gem "mongo", ">= 1.6.2"
16
+ gem "bson_ext", ">= 1.6.2"
17
+
18
+ # For Testing
19
+ gem "rack-test"
20
+ gem "test-unit"
21
+ gem "rspec", :require => "spec"
22
+
23
+ # For the SerialParser
24
+ gem "serialport", ">= 1.1.0"
25
+
26
+ # For the HTTP REST API
27
+ gem "sinatra", ">= 1.3.3"
28
+ gem "thin", ">= 1.5.0"
29
+ gem "rufus-scheduler", ">= 2.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ ardtweeno (0.2.1)
5
+ bundler (>= 1.2.3)
6
+ bson (1.8.5)
7
+ bson_ext (1.8.5)
8
+ bson (~> 1.8.5)
9
+ daemons (1.1.9)
10
+ diff-lcs (1.2.4)
11
+ dotenv (0.7.0)
12
+ ethon (0.5.12)
13
+ ffi (>= 1.3.0)
14
+ mime-types (~> 1.18)
15
+ eventmachine (1.0.3)
16
+ ffi (1.8.1)
17
+ foreman (0.63.0)
18
+ dotenv (>= 0.7)
19
+ thor (>= 0.13.6)
20
+ json (1.7.7)
21
+ mime-types (1.23)
22
+ mongo (1.8.5)
23
+ bson (~> 1.8.5)
24
+ nokogiri (1.5.9)
25
+ rack (1.5.2)
26
+ rack-protection (1.5.0)
27
+ rack
28
+ rack-test (0.6.2)
29
+ rack (>= 1.0)
30
+ rake (10.0.4)
31
+ rspec (2.13.0)
32
+ rspec-core (~> 2.13.0)
33
+ rspec-expectations (~> 2.13.0)
34
+ rspec-mocks (~> 2.13.0)
35
+ rspec-core (2.13.1)
36
+ rspec-expectations (2.13.0)
37
+ diff-lcs (>= 1.1.3, < 2.0)
38
+ rspec-mocks (2.13.1)
39
+ rufus-scheduler (2.0.18)
40
+ tzinfo (>= 0.3.23)
41
+ serialport (1.1.0)
42
+ sinatra (1.4.2)
43
+ rack (~> 1.5, >= 1.5.2)
44
+ rack-protection (~> 1.4)
45
+ tilt (~> 1.3, >= 1.3.4)
46
+ test-unit (2.5.4)
47
+ thin (1.5.1)
48
+ daemons (>= 1.0.9)
49
+ eventmachine (>= 0.12.6)
50
+ rack (>= 1.0.0)
51
+ thor (0.18.1)
52
+ tilt (1.3.7)
53
+ typhoeus (0.6.3)
54
+ ethon (~> 0.5.11)
55
+ tzinfo (0.3.37)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ ardtweeno
62
+ bson_ext (>= 1.6.2)
63
+ foreman
64
+ json
65
+ mongo (>= 1.6.2)
66
+ nokogiri
67
+ rack (>= 1.1)
68
+ rack-test
69
+ rake
70
+ rspec
71
+ rufus-scheduler (>= 2.0)
72
+ serialport (>= 1.1.0)
73
+ sinatra (>= 1.3.3)
74
+ test-unit
75
+ thin (>= 1.5.0)
76
+ typhoeus (>= 0.6.3)
data/INSTALL ADDED
@@ -0,0 +1,12 @@
1
+ # Ardtweeno MVP - Installation instructions
2
+ The Ardtweeno system can be installed from https://rubygems.org/gems/ardtweeno through the _gem_ utility, or by checking
3
+ out the codebase from the git repository on https://github.com/davidkirwan/ardtweeno and then building and installing the
4
+ gem using the _rake install_ command.
5
+
6
+ System gem dependencies can be installed using the _bundler install_ command from the git repository root directory.
7
+
8
+ Tests can be run with the _rake test_ command from the root of the git repository. The tests may require the tty0tty null
9
+ serial modem to have been compiled prior to the tests being executed. This system is bundled with the gem in the following
10
+ directory: _tests/tty0tty/pts_. Enter the directory and compile the library with the _make_.
11
+
12
+ To launch the system, simply type _foreman start -f Procfile -p <port>_
data/Procfile ADDED
@@ -0,0 +1 @@
1
+ web: bundle exec thin start -p $PORT
data/README.md CHANGED
@@ -1,10 +1,34 @@
1
1
  # Ardtweeno
2
- Ardtweeno is a simple parser system for gathering data from a serial interface which can then be used to generate graphs, statistics
3
- and reports from this data suitible for sharing over HTTP through a Ruby on Rails gateway application.
2
+ Ardtweeno is a distributed sensor mesh network gateway which bridges devices connected through an XBee Mesh
3
+ Network link to those on the internet over IP. The system is modular in nature with the interface to the
4
+ gateway from the mesh network accessible through a HTTP REST API. This allows many different mesh networks
5
+ potentially at multiple sites to communicate with the centeral gateway over the internet or to a serial
6
+ device connected locally as would be the case with a directly connected XBee Coordinator.
7
+
8
+ All data is logged to a local database to allow statistical analysis and graphs to be generated for
9
+ inclusion in hourly/daily reports which can be attached to the systems twitter feed.
10
+
11
+ The core system is wrapped in a Ruby Sinatra webbapp which exposes a HTTP REST API and allows interaction
12
+ with the gateway over RESTful HTTP calls on the IP network. This has been designed with a Raspberry Pi in
13
+ mind and has been tested to work correctly on the Raspbian distribution.
14
+
15
+ In future releases, I hope to make the service interactable so that it may respond to commands received
16
+ on twitter, or through web hooks and possibly an IRC bot. I plan to develop a fully featured Ruby
17
+ on Rails web application to act as an end user front end to the system and display generated reports and
18
+ graphs from data recieved on the mesh network, while also extending the feature set of the HTTP REST API
19
+ and eventually offer the means to manage and upload updated firmwares to the mesh network nodes.
20
+
21
+ This is a work in progress! The Wiki associated will soon contain the instructions for accessing the REST
22
+ API and installation instructions shortly. Any bugs encountered can be raised on the issue tracker.
23
+
24
+
4
25
 
5
26
  # COPYING / Licence
6
27
  This software is released under the creative commons attribution-sharealike 3.0 unported (cc by-sa 3.0) licence.
7
28
  for more information see: http://creativecommons.org/licenses/by-sa/3.0/
29
+ For information regarding commercial use of the Ardtweeno Gateway, please contact the author at:
30
+ davidkirwanirl (_at_) gmail dot com
31
+
8
32
 
9
33
  # DISCLAIMER
10
34
  All code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
data/Rakefile CHANGED
@@ -1,4 +1,14 @@
1
- require 'bundler'
1
+ require 'rubygems'
2
+
3
+ begin
4
+ require 'bundler'
5
+ rescue Exception => e
6
+ puts 'bundler gem not found, please install bundler and try again.'
7
+ exit
8
+ end
9
+
10
+
11
+
2
12
  Bundler::GemHelper.install_tasks
3
13
 
4
14
  task :default => 'menu'
@@ -7,16 +17,13 @@ task :menu do
7
17
  puts welcomeMsg = <<-MSG
8
18
  rake build # Build ardtweeno-x.x.x.gem into the pkg directory
9
19
  rake install # Build and install ardtweeno-x.x.x.gem into system gems
10
- rake release # Create tag vx.x.x and build and push ardtweeno-x.x.x.gem to http://rubygems.org/
11
20
  rake test # Run the unit testing suite on this gem.
12
21
  MSG
13
22
  end
14
23
 
15
24
  desc "Run the unit testing suite on this gem."
16
25
  task :test do
17
- $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
18
- require 'ardtweeno.rb'
19
- Dir.glob("./test/*_test.rb").each do |file|
20
- require file
21
- end
26
+
27
+ require "./test/test_helper.rb"
28
+
22
29
  end