Class: TimexDatalinkClient::Protocol4::SoundTheme

Inherits:
Object
  • Object
show all
Includes:
Helpers::CpacketPaginator, Helpers::CrcPacketsWrapper
Defined in:
lib/timex_datalink_client/protocol_4/sound_theme.rb

Constant Summary collapse

CPACKET_SECT =
[0x90, 0x03]
CPACKET_DATA =
[0x91, 0x03]
CPACKET_END =
[0x92, 0x03]
CPACKET_DATA_LENGTH =
32
SOUND_DATA_HEADER =
"\x25\x04\x19\x69"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CpacketPaginator

#paginate_cpackets

Constructor Details

#initialize(sound_theme_data: nil, spc_file: nil) ⇒ SoundTheme

Create a SoundTheme instance.

Parameters:

  • sound_theme_data (String, nil) (defaults to: nil)

    Sound theme data.

  • spc_file (String, nil) (defaults to: nil)

    Path to SPC file.



26
27
28
29
# File 'lib/timex_datalink_client/protocol_4/sound_theme.rb', line 26

def initialize(sound_theme_data: nil, spc_file: nil)
  @sound_theme_data = sound_theme_data
  @spc_file = spc_file
end

Instance Attribute Details

#spc_fileObject

Returns the value of attribute spc_file.



19
20
21
# File 'lib/timex_datalink_client/protocol_4/sound_theme.rb', line 19

def spc_file
  @spc_file
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for a sound theme.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



34
35
36
# File 'lib/timex_datalink_client/protocol_4/sound_theme.rb', line 34

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