Class: SetInputMode
Constant Summary
collapse
- INPUT_PORTS =
{
one: 0x00,
two: 0x01,
three: 0x02,
four: 0x03
}
- SENSOR_TYPES =
{}
- SENSOR_MODES =
{
:rawmode => 0x00,
:booleanmode => 0x20,
:transitioncntmode => 0x40,
:periodcountermode => 0x60,
:pctfullscalemode => 0x80,
:celsiusmode => 0xA0,
:fahrenheitmode => 0xC0,
:anglestepmode => 0xE0,
:slopemask => 0x1F,
:modemask => 0xE0
}
Instance Attribute Summary collapse
#command
Attributes inherited from Telegram
#type
Class Method Summary
collapse
Instance Method Summary
collapse
#require_response=, #require_response?
Methods inherited from Telegram
#max_size_in_bytes
Constructor Details
#initialize(input_port, sensor_type, sensor_mode, response_required = true) ⇒ SetInputMode
Returns a new instance of SetInputMode.
13
14
15
16
17
18
19
20
21
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 13
def initialize(input_port, sensor_type, sensor_mode, response_required=true)
super(response_required)
@command = 0x05
validate_arguments(input_port, sensor_type, sensor_mode)
@input_port = input_port
@sensor_type = sensor_type
@sensor_mode = sensor_mode
end
|
Instance Attribute Details
Returns the value of attribute input_port.
11
12
13
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 11
def input_port
@input_port
end
|
#sensor_mode ⇒ Object
Returns the value of attribute sensor_mode.
11
12
13
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 11
def sensor_mode
@sensor_mode
end
|
#sensor_type ⇒ Object
Returns the value of attribute sensor_type.
11
12
13
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 11
def sensor_type
@sensor_type
end
|
Class Method Details
6
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 6
def input_ports; INPUT_PORTS.keys; end
|
.sensor_modes ⇒ Object
8
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 8
def sensor_modes; SENSOR_MODES.keys; end
|
.sensor_types ⇒ Object
7
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 7
def sensor_types; SENSOR_TYPES.keys; end
|
Instance Method Details
#as_bytes ⇒ Object
78
79
80
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 78
def as_bytes
super << INPUT_PORTS[@input_port] << SENSOR_TYPES[@sensor_type] << SENSOR_MODES[@sensor_mode]
end
|
74
75
76
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 74
def input_ports
self.class.input_ports
end
|
#sensor_modes ⇒ Object
70
71
72
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 70
def sensor_modes
self.class.sensor_modes
end
|
#sensor_types ⇒ Object
66
67
68
|
# File 'lib/telegrams/commands/direct/set_input_mode.rb', line 66
def sensor_types
self.class.sensor_types
end
|