Class: TimexDatalinkClient::Protocol6::Sync

Inherits:
Object
  • Object
show all
Defined in:
lib/timex_datalink_client/protocol_6/sync.rb

Constant Summary collapse

PING_BYTE =
[0x78]
FAST_MODE_BYTE =
[0x56]
SYNC_1_BYTE =
[0x55]
SYNC_2_BYTE =
[0xaa]
SYNC_2_LENGTH =
40

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length: 300) ⇒ Sync

Create a Sync instance.

Parameters:

  • length (Integer) (defaults to: 300)

    Number of 0x55 sync bytes to use.



19
20
21
# File 'lib/timex_datalink_client/protocol_6/sync.rb', line 19

def initialize(length: 300)
  @length = length
end

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



13
14
15
# File 'lib/timex_datalink_client/protocol_6/sync.rb', line 13

def length
  @length
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for syncronization data.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



26
27
28
# File 'lib/timex_datalink_client/protocol_6/sync.rb', line 26

def packets
  [PING_BYTE + FAST_MODE_BYTE + render_sync_1 + render_sync_2]
end