Class: TimexDatalinkClient::Protocol9::Eeprom

Inherits:
Object
  • Object
show all
Includes:
Helpers::CpacketPaginator, Helpers::CrcPacketsWrapper
Defined in:
lib/timex_datalink_client/protocol_9/eeprom.rb,
lib/timex_datalink_client/protocol_9/eeprom/chrono.rb,
lib/timex_datalink_client/protocol_9/eeprom/phone_number.rb

Defined Under Namespace

Classes: Chrono, PhoneNumber

Constant Summary collapse

CPACKET_MEM =
[0x70]
CPACKET_JMPMEM =
[0x23]
CPACKET_SECT =
[0x60]
CPACKET_DATA =
[0x61]
CPACKET_END =
[0x62]
SETUP_PACKETS =
[
  CPACKET_MEM + [
    0x02, 0x40, 0x05, 0xa9, 0x22, 0x5f, 0xe6, 0xb2, 0xe8, 0xbb, 0xe7, 0xb2, 0xe8, 0xbb, 0xe7, 0xbb, 0xe8, 0xb2,
    0xe7, 0xb2, 0x5c, 0xa3, 0x09, 0x26, 0xed, 0x15, 0xa9, 0x01
  ],
  CPACKET_MEM + [0x02, 0x5a, 0xa9, 0x02, 0x14, 0xa9, 0xb6, 0xa9, 0xa4, 0x07, 0x47, 0xb7, 0xa9, 0xcc, 0x74, 0x6f],
  CPACKET_JMPMEM + [0x02, 0x40]
]
PAYLOAD_HEADER =
[0x00, 0x0e, 0x00]
CPACKET_DATA_LENGTH =
27
START_INDEX =
14
APPOINTMENT_NO_NOTIFICATION =
0xff

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CpacketPaginator

#paginate_cpackets

Constructor Details

#initialize(chrono: nil, phone_numbers: []) ⇒ Eeprom

Create an Eeprom instance.

Parameters:

  • chrono (Chrono) (defaults to: nil)

    Chrono to be added to EEPROM data.

  • phone_numbers (Array<PhoneNumber>) (defaults to: [])

    Phone numbers to be added to EEPROM data.



44
45
46
47
# File 'lib/timex_datalink_client/protocol_9/eeprom.rb', line 44

def initialize(chrono: nil, phone_numbers: [])
  @chrono = chrono || self.class.empty_chrono
  @phone_numbers = phone_numbers
end

Instance Attribute Details

#chronoObject

Returns the value of attribute chrono.



37
38
39
# File 'lib/timex_datalink_client/protocol_9/eeprom.rb', line 37

def chrono
  @chrono
end

#phone_numbersObject

Returns the value of attribute phone_numbers.



37
38
39
# File 'lib/timex_datalink_client/protocol_9/eeprom.rb', line 37

def phone_numbers
  @phone_numbers
end

Class Method Details

.empty_chronoObject



33
34
35
# File 'lib/timex_datalink_client/protocol_9/eeprom.rb', line 33

def self.empty_chrono
  Chrono.new(label: "chrono", laps: 2)
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for EEPROM data.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



52
53
54
# File 'lib/timex_datalink_client/protocol_9/eeprom.rb', line 52

def packets
  SETUP_PACKETS + [header] + payloads + [CPACKET_END]
end