Class: TimexDatalinkClient::Protocol9::Timer
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol9::Timer
- Includes:
- Helpers::CharEncoders, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_9/timer.rb
Constant Summary collapse
- CPACKET_TIMER =
[0x43]
- ACTION_AT_END_MAP =
{ stop_timer: 0, repeat_timer: 1, start_chrono: 2 }.freeze
Constants included from Helpers::CharEncoders
Helpers::CharEncoders::CHARS, Helpers::CharEncoders::CHARS_PROTOCOL_6, Helpers::CharEncoders::EEPROM_CHARS, Helpers::CharEncoders::EEPROM_TERMINATOR, Helpers::CharEncoders::INVALID_CHAR, Helpers::CharEncoders::PHONE_CHARS
Instance Attribute Summary collapse
-
#action_at_end ⇒ Object
Returns the value of attribute action_at_end.
-
#label ⇒ Object
Returns the value of attribute label.
-
#number ⇒ Object
Returns the value of attribute number.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(number:, label:, time:, action_at_end:) ⇒ Timer
constructor
Create a Timer instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for a timer.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for
Constructor Details
#initialize(number:, label:, time:, action_at_end:) ⇒ Timer
Create a Timer instance.
29 30 31 32 33 34 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 29 def initialize(number:, label:, time:, action_at_end:) @number = number @label = label @time = time @action_at_end = action_at_end end |
Instance Attribute Details
#action_at_end ⇒ Object
Returns the value of attribute action_at_end.
20 21 22 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 20 def action_at_end @action_at_end end |
#label ⇒ Object
Returns the value of attribute label.
20 21 22 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 20 def label @label end |
#number ⇒ Object
Returns the value of attribute number.
20 21 22 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 20 def number @number end |
#time ⇒ Object
Returns the value of attribute time.
20 21 22 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 20 def time @time end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for a timer.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/timex_datalink_client/protocol_9/timer.rb', line 39 def packets [ [ CPACKET_TIMER, number, time.hour, time.min, time.sec, action_at_end_value, label_characters ].flatten ] end |