Class: TimexDatalinkClient::Protocol7::Eeprom::PhoneNumber
- Inherits:
-
Object
- Object
- TimexDatalinkClient::Protocol7::Eeprom::PhoneNumber
- Includes:
- Helpers::FourByteFormatter
- Defined in:
- lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb
Constant Summary collapse
- PHONE_NUMBER_DIGITS_MAP =
{ "0" => 0x001, "1" => 0x002, "2" => 0x003, "3" => 0x004, "4" => 0x005, "5" => 0x006, "6" => 0x007, "7" => 0x008, "8" => 0x009, "9" => 0x00a }.freeze
- PACKETS_TERMINATOR =
0x03
Constants included from Helpers::FourByteFormatter
Helpers::FourByteFormatter::BYTE_NULL, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDF, Helpers::FourByteFormatter::BYTE_TERMINATOR_ENDR
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
Class Method Summary collapse
-
.packets(phone_numbers) ⇒ Array
Compile data for all phone numbers.
Instance Method Summary collapse
-
#initialize(name: [], number:) ⇒ PhoneNumber
constructor
Create a PhoneNumber instance.
-
#name_and_number ⇒ Array<Integer>
Compile an unformatted name and phone number.
Methods included from Helpers::FourByteFormatter
Constructor Details
#initialize(name: [], number:) ⇒ PhoneNumber
Create a PhoneNumber instance.
56 57 58 59 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb', line 56 def initialize(name: [], number:) @name = name @number = number end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
49 50 51 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb', line 49 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
49 50 51 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb', line 49 def number @number end |
Class Method Details
.packets(phone_numbers) ⇒ Array
Compile data for all phone numbers.
30 31 32 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb', line 30 def self.packets(phone_numbers) header(phone_numbers) + names_and_numbers(phone_numbers) + [PACKETS_TERMINATOR] end |
Instance Method Details
#name_and_number ⇒ Array<Integer>
Compile an unformatted name and phone number.
64 65 66 67 68 69 |
# File 'lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb', line 64 def name_and_number [ name, number_characters ] end |