class Simms::Beacon
Constants
- CG_ELECTRIC
- CG_GLOBAL
Command group codes
- CG_HVAC
- CG_IRRIGATION
- CG_PULSER
- CG_SENSOR
- DC_CONFIG
- DC_DATA
Device commands
- DC_GLOBAL_CONFIG
Attributes
command_group_id[RW]
Attributes
device_command_id[RW]
Attributes
timestamp[RW]
Attributes
uuid[RW]
Attributes
Public Class Methods
class_for(group, command)
click to toggle source
Find the appropriate beacon class for a given group + command tuple
# File lib/simms/beacon.rb, line 23 def self.class_for(group, command) case group when CG_GLOBAL then case command when DC_GLOBAL_CONFIG then return Simms::GlobalConfigBeacon end when CG_ELECTRIC then case command when DC_DATA then return Simms::ElectricityDataBeacon when DC_CONFIG then return Simms::ElectricityConfigBeacon end end # None found! nil end
new(bytes)
click to toggle source
# File lib/simms/beacon.rb, line 46 def initialize(bytes) @bytes = bytes end
Public Instance Methods
config?()
click to toggle source
# File lib/simms/beacon.rb, line 76 def config? type == :config end
data?()
click to toggle source
# File lib/simms/beacon.rb, line 72 def data? type == :data end
group()
click to toggle source
# File lib/simms/beacon.rb, line 50 def group case @command_group_id when CG_GLOBAL then :global when CG_SENSOR then :sensor when CG_ELECTRIC then :electric when CG_HVAC then :hvac when CG_PULSER then :pulser when CG_IRRIGATION then :irrigation else :unknown end end
type()
click to toggle source
# File lib/simms/beacon.rb, line 63 def type case @device_command_id when DC_DATA then :data when DC_CONFIG, DC_GLOBAL_CONFIG then :config else :unknown end end