Module: Ardtweeno
- Defined in:
- lib/ardtweeno.rb,
lib/ardtweeno/db.rb,
lib/ardtweeno/api.rb,
lib/ardtweeno/node.rb,
lib/ardtweeno/packet.rb,
lib/ardtweeno/dispatcher.rb,
lib/ardtweeno/exceptions.rb,
lib/ardtweeno/nodemanager.rb,
lib/ardtweeno/configreader.rb,
lib/ardtweeno/serialparser.rb
Overview
Ardtweeno Mesh Network Application Gateway
Software Gateway to allow collecting/broadcasting to/from a Mesh Network over serial. All data is stored to a database by default to allow later analysis and inclusion in automated reports generated by the system.
Defined Under Namespace
Classes: API, ConfigReader, DB, DBError, Dispatcher, InvalidData, ManagerNotDefined, Node, NodeManager, NodeNotAuthorised, NotANode, NotAPacket, NotInNodeList, Packet, PacketListEmpty, SerialDeviceNotFound, SerialParser
Constant Summary collapse
- VERSION =
Constants
"0.2.5"
- CONFIGPATH =
ENV['HOME'] + "/.ardtweeno"
- DBPATH =
Ardtweeno::CONFIGPATH + "/conf.yaml"
- NODEPATH =
Ardtweeno::CONFIGPATH + "/nodelist.yaml"
- @@seqCount =
Class Variables
0
- @@options =
{}
Class Method Summary collapse
-
.nextSeq ⇒ Object
Ardtweeno#nextSeq returns the next available sequence number.
-
.options ⇒ Object
Ardtweeno#options returns the options hash.
-
.setup(options = {}) ⇒ Object
Setup the system for the first time.
Class Method Details
.nextSeq ⇒ Object
Ardtweeno#nextSeq returns the next available sequence number
-
Args :
-
++ ->
-
-
Returns :
-
Fixnum
-
-
Raises : -
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ardtweeno.rb', line 70 def nextSeq() @log = @@options[:log] ||= Logger.new(STDOUT) @log.level = @@options[:level] ||= Logger::DEBUG @log.debug "Current Sequence Number: " + @@seqCount.to_s theSeq = @@seqCount @@seqCount += 1 @log.debug "Current Sequence Number Incremented: " + @@seqCount.to_s return theSeq end |
.options ⇒ Object
Ardtweeno#options returns the options hash
-
Args :
-
++ ->
-
-
Returns :
-
Hash
-
-
Raises : -
55 56 57 |
# File 'lib/ardtweeno.rb', line 55 def () return @@options end |
.setup(options = {}) ⇒ Object
Setup the system for the first time
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ardtweeno.rb', line 84 def setup(={}) @@options = @log = @@options[:log] ||= Logger.new(STDOUT) @log.level = @@options[:level] ||= Logger::DEBUG @log.debug "Checking to see if the configuration folder exists." resourceDir = Ardtweeno::CONFIGPATH @log.debug resourceDir if File.directory?(resourceDir) @log.debug "The folder already exists, do nothing." else @log.debug "Creating ~/.ardtweeno/ and installing the resources there." begin FileUtils.mkdir(resourceDir) dbpath = File.(File.dirname(__FILE__) + '/../resources/conf.yaml') nodepath = File.(File.dirname(__FILE__) + '/../resources/nodelist.yaml') FileUtils.cp(dbpath, resourceDir) FileUtils.cp(nodepath, resourceDir) @log.debug "Successfully copied ~/.ardtweeno/conf.yaml" @log.debug "Successfully copied ~/.ardtweeno/nodelist.yaml" rescue Exception => e @log.fatal e. @log.fatal e.backtrace exit() end end end |