Class: TimexDatalinkClient::Protocol7::Sync

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

Constant Summary collapse

PING_BYTE =
[0x78]
SYNC_1_BYTE =
[0x55]
SYNC_2_BYTE =
[0xaa]
SYNC_2_LENGTH =
5

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.



18
19
20
# File 'lib/timex_datalink_client/protocol_7/sync.rb', line 18

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

Instance Attribute Details

#lengthObject

Returns the value of attribute length.



12
13
14
# File 'lib/timex_datalink_client/protocol_7/sync.rb', line 12

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.



25
26
27
# File 'lib/timex_datalink_client/protocol_7/sync.rb', line 25

def packets
  [PING_BYTE + render_sync_1 + render_sync_2]
end