Class: TimexDatalinkClient::Protocol4::Eeprom

Inherits:
Object
  • Object
show all
Includes:
Helpers::CpacketPaginator, Helpers::CrcPacketsWrapper
Defined in:
lib/timex_datalink_client/protocol_4/eeprom.rb,
lib/timex_datalink_client/protocol_4/eeprom/list.rb,
lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb,
lib/timex_datalink_client/protocol_4/eeprom/appointment.rb,
lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb

Defined Under Namespace

Classes: Anniversary, Appointment, List, PhoneNumber

Constant Summary collapse

CPACKET_CLEAR =
[0x93, 0x01]
CPACKET_SECT =
[0x90, 0x01]
CPACKET_DATA =
[0x91, 0x01]
CPACKET_END =
[0x92, 0x01]
CPACKET_DATA_LENGTH =
32
START_ADDRESS =
0x0236
APPOINTMENT_NO_NOTIFICATION =
0xff

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CpacketPaginator

#paginate_cpackets

Constructor Details

#initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION) ⇒ Eeprom

Create an Eeprom instance.

Parameters:

  • appointments (Array<Appointment>) (defaults to: [])

    Appointments to be added to EEPROM data.

  • anniversaries (Array<Anniversary>) (defaults to: [])

    Anniversaries to be added to EEPROM data.

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

    Phone numbers to be added to EEPROM data.

  • lists (Array<List>) (defaults to: [])

    Lists to be added to EEPROM data.

  • appointment_notification (Integer) (defaults to: APPOINTMENT_NO_NOTIFICATION)

    Appointment notification (intervals of 15 minutes, 255 for no notification)



32
33
34
35
36
37
38
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 32

def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
  @appointments = appointments
  @anniversaries = anniversaries
  @phone_numbers = phone_numbers
  @lists = lists
  @appointment_notification = appointment_notification
end

Instance Attribute Details

#anniversariesObject

Returns the value of attribute anniversaries.



21
22
23
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 21

def anniversaries
  @anniversaries
end

#appointment_notificationObject

Returns the value of attribute appointment_notification.



21
22
23
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 21

def appointment_notification
  @appointment_notification
end

#appointmentsObject

Returns the value of attribute appointments.



21
22
23
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 21

def appointments
  @appointments
end

#listsObject

Returns the value of attribute lists.



21
22
23
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 21

def lists
  @lists
end

#phone_numbersObject

Returns the value of attribute phone_numbers.



21
22
23
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 21

def phone_numbers
  @phone_numbers
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for EEPROM data.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



43
44
45
# File 'lib/timex_datalink_client/protocol_4/eeprom.rb', line 43

def packets
  [CPACKET_CLEAR, header] + payloads + [CPACKET_END]
end