Class: XBee::Config::ApiEnableMode

Inherits:
RFModuleParameter show all
Defined in:
lib/ruxbee/config.rb

Instance Attribute Summary

Attributes inherited from RFModuleParameter

#at_name, #default_value, #operation_mode, #retrieved, #value

Instance Method Summary collapse

Constructor Details

#initialize(default = 0x01) ⇒ ApiEnableMode

Returns a new instance of ApiEnableMode.



79
80
81
82
83
84
# File 'lib/ruxbee/config.rb', line 79

def initialize(default = 0x01)
  unless default == 0x01 or default == 0x02
    raise "XBee AP parameter range can be 1-2; 1 = API-enabled; 2 = API-enabled (with escaped control characters)"
  end
  super("AP", default)
end

Instance Method Details

#in_symbolObject



86
87
88
89
90
91
92
# File 'lib/ruxbee/config.rb', line 86

def in_symbol
  unless self.value == 0x01 or self.value == 0x02
    raise "XBee AP parameter invalid range! Valid range 1-2; Set to: #{self.value}"
  end
  return :API1 if self.value == 0x01
  return :API2 if self.value == 0x02
end