Class: TimexDatalinkClient::Protocol1::TimeName
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol1::TimeName
- Includes:
- ActiveModel::Validations, Helpers::CharEncoders, Helpers::CrcPacketsWrapper
- Defined in:
- lib/timex_datalink_client/protocol_1/time_name.rb
Constant Summary collapse
- CPACKET_NAME =
[0x31]
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
-
#name ⇒ Object
Returns the value of attribute name.
-
#zone ⇒ Object
Returns the value of attribute zone.
Instance Method Summary collapse
-
#initialize(zone:, name:) ⇒ TimeName
constructor
Create a TimeName instance.
-
#packets ⇒ Array<Array<Integer>>
Compile packets for a time name.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for
Constructor Details
#initialize(zone:, name:) ⇒ TimeName
Create a TimeName instance.
29 30 31 32 |
# File 'lib/timex_datalink_client/protocol_1/time_name.rb', line 29 def initialize(zone:, name:) @zone = zone @name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_1/time_name.rb', line 17 def name @name end |
#zone ⇒ Object
Returns the value of attribute zone.
17 18 19 |
# File 'lib/timex_datalink_client/protocol_1/time_name.rb', line 17 def zone @zone end |
Instance Method Details
#packets ⇒ Array<Array<Integer>>
Compile packets for a time name.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/timex_datalink_client/protocol_1/time_name.rb', line 38 def packets validate! [ [ CPACKET_NAME, zone, name_characters ].flatten ] end |