Class: TimexDatalinkClient::Protocol6::Eeprom::PhoneNumber
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol6::Eeprom::PhoneNumber
- Defined in:
- lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb
Constant Summary collapse
- PHONE_DIGITS =
12
- NAME_MAX_LENGTH =
31
- NUMBER_NAME_DELIMITER =
"-"
- NUMBER_NAME_MAX_NUMBER_LENGTH =
30
- TERMINATOR =
0x5c
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.
-
#number ⇒ Object
Returns the value of attribute number.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name:, number:, type: " ") ⇒ PhoneNumber
constructor
Create a PhoneNumber instance.
-
#packet ⇒ Array<Integer>
Compile a packet for a phone number.
Methods included from Helpers::CharEncoders
#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for
Constructor Details
#initialize(name:, number:, type: " ") ⇒ PhoneNumber
Create a PhoneNumber instance.
29 30 31 32 33 |
# File 'lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb', line 29 def initialize(name:, number:, type: " ") @name = name @number = number @type = type end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb', line 21 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
21 22 23 |
# File 'lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb', line 21 def number @number end |
#type ⇒ Object
Returns the value of attribute type.
21 22 23 |
# File 'lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb', line 21 def type @type end |
Instance Method Details
#packet ⇒ Array<Integer>
Compile a packet for a phone number.
38 39 40 41 42 43 44 |
# File 'lib/timex_datalink_client/protocol_6/eeprom/phone_number.rb', line 38 def packet [ number_with_type_characters, name_characters, TERMINATOR ].flatten end |