Class: TimexDatalinkClient::Protocol7::Eeprom

Inherits:
Object
  • Object
show all
Includes:
Helpers::CpacketPaginator, Helpers::CrcPacketsWrapper
Defined in:
lib/timex_datalink_client/protocol_7/eeprom.rb,
lib/timex_datalink_client/protocol_7/eeprom/games.rb,
lib/timex_datalink_client/protocol_7/eeprom/speech.rb,
lib/timex_datalink_client/protocol_7/eeprom/activity.rb,
lib/timex_datalink_client/protocol_7/eeprom/calendar.rb,
lib/timex_datalink_client/protocol_7/eeprom/phone_number.rb,
lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb

Defined Under Namespace

Classes: Activity, Calendar, Games, PhoneNumber, Speech

Constant Summary collapse

CPACKET_SECT =
[0x90, 0x05]
CPACKET_DATA =
[0x91, 0x05]
CPACKET_END =
[0x92, 0x05]
CPACKET_SECT_WELCOME =
[
  0x44, 0x53, 0x49, 0x20, 0x54, 0x6f, 0x79, 0x73, 0x20, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x73, 0x2e,
  0x2e, 0x2e, 0x65, 0x42, 0x72, 0x61, 0x69, 0x6e, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00
]
CPACKET_DATA_LENGTH =
32

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CpacketPaginator

#paginate_cpackets

Constructor Details

#initialize(activities: nil, games: nil, calendar: nil, phone_numbers: nil, speech: nil) ⇒ Eeprom

Create an Eeprom instance.

Parameters:

  • activities (Array<Activity>, nil) (defaults to: nil)

    Activities to be added to EEPROM data.

  • games (Games, nil) (defaults to: nil)

    Games to be added to EEPROM data.

  • calendar (Array<Calendar>, nil) (defaults to: nil)

    Calendar to be added to EEPROM data.

  • phone_numbers (Array<PhoneNumber>, nil) (defaults to: nil)

    Phone numbers to be added to EEPROM data.

  • speech (Speech, nil) (defaults to: nil)

    Speech to be added to EEPROM data.



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

def initialize(activities: nil, games: nil, calendar: nil, phone_numbers: nil, speech: nil)
  @activities = activities
  @games = games
  @calendar = calendar
  @phone_numbers = phone_numbers
  @speech = speech
end

Instance Attribute Details

#activitiesObject

Returns the value of attribute activities.



23
24
25
# File 'lib/timex_datalink_client/protocol_7/eeprom.rb', line 23

def activities
  @activities
end

#calendarObject

Returns the value of attribute calendar.



23
24
25
# File 'lib/timex_datalink_client/protocol_7/eeprom.rb', line 23

def calendar
  @calendar
end

#gamesObject

Returns the value of attribute games.



23
24
25
# File 'lib/timex_datalink_client/protocol_7/eeprom.rb', line 23

def games
  @games
end

#phone_numbersObject

Returns the value of attribute phone_numbers.



23
24
25
# File 'lib/timex_datalink_client/protocol_7/eeprom.rb', line 23

def phone_numbers
  @phone_numbers
end

#speechObject

Returns the value of attribute speech.



23
24
25
# File 'lib/timex_datalink_client/protocol_7/eeprom.rb', line 23

def speech
  @speech
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for EEPROM data.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



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

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