Class: TimexDatalinkClient::Protocol9::Eeprom::Chrono
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol9::Eeprom::Chrono
- Includes:
- ActiveModel::Validations, Helpers::CharEncoders
- Defined in:
- lib/timex_datalink_client/protocol_9/eeprom/chrono.rb
Constant Summary collapse
- CHRONO_LABEL_LENGTH =
8
- CHRONO_INITIAL_SIZE =
14
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
-
#label ⇒ Object
Returns the value of attribute label.
-
#laps ⇒ Object
Returns the value of attribute laps.
Instance Method Summary collapse
- #chrono_bytesize ⇒ Object
-
#initialize(label:, laps:) ⇒ Chrono
constructor
Create a Chrono instance.
-
#packet ⇒ Array<Integer>
Compile a packet for a chrono.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for
Constructor Details
#initialize(label:, laps:) ⇒ Chrono
Create a Chrono instance.
29 30 31 32 |
# File 'lib/timex_datalink_client/protocol_9/eeprom/chrono.rb', line 29 def initialize(label:, laps:) @label = label @laps = laps end |
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_9/eeprom/chrono.rb', line 17 def label @label end |
#laps ⇒ Object
Returns the value of attribute laps.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_9/eeprom/chrono.rb', line 17 def laps @laps end |
Instance Method Details
#chrono_bytesize ⇒ Object
44 45 46 |
# File 'lib/timex_datalink_client/protocol_9/eeprom/chrono.rb', line 44 def chrono_bytesize CHRONO_INITIAL_SIZE + laps * 4 end |
#packet ⇒ Array<Integer>
Compile a packet for a chrono.
38 39 40 41 42 |
# File 'lib/timex_datalink_client/protocol_9/eeprom/chrono.rb', line 38 def packet validate! label_characters end |