Class: TimexDatalinkClient::Protocol4::Eeprom::List

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, Helpers::CharEncoders, Helpers::LengthPacketWrapper
Defined in:
lib/timex_datalink_client/protocol_4/eeprom/list.rb

Constant Summary

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

Instance Method Summary collapse

Methods included from Helpers::CharEncoders

#chars_for, #eeprom_chars_for, #phone_chars_for, #protocol_6_chars_for

Constructor Details

#initialize(list_entry:, priority:) ⇒ List

Create a List instance.

Parameters:

  • list_entry (String)

    List entry text.

  • priority (Integer)

    List priority.



29
30
31
32
# File 'lib/timex_datalink_client/protocol_4/eeprom/list.rb', line 29

def initialize(list_entry:, priority:)
  @list_entry = list_entry
  @priority = priority
end

Instance Attribute Details

#list_entryObject

Returns the value of attribute list_entry.



16
17
18
# File 'lib/timex_datalink_client/protocol_4/eeprom/list.rb', line 16

def list_entry
  @list_entry
end

#priorityObject

Returns the value of attribute priority.



16
17
18
# File 'lib/timex_datalink_client/protocol_4/eeprom/list.rb', line 16

def priority
  @priority
end

Instance Method Details

#packetArray<Integer>

Compile a packet for a list.

Returns:

  • (Array<Integer>)

    Array of integers that represent bytes.

Raises:

  • (ActiveModel::ValidationError)

    One or more model values are invalid.



38
39
40
41
42
43
44
45
# File 'lib/timex_datalink_client/protocol_4/eeprom/list.rb', line 38

def packet
  validate!

  [
    priority_value,
    list_entry_characters
  ].flatten
end