Class: TimexDatalinkClient::Protocol3::WristApp

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

Constant Summary collapse

CPACKET_CLEAR =
[0x93, 0x02]
CPACKET_SECT =
[0x90, 0x02]
CPACKET_DATA =
[0x91, 0x02]
CPACKET_END =
[0x92, 0x02]
CPACKET_DATA_LENGTH =
32
WRIST_APP_DELIMITER =
/\xac.*\r\n/n
WRIST_APP_CODE_INDEX =
8

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::CpacketPaginator

#paginate_cpackets

Constructor Details

#initialize(wrist_app_data: nil, zap_file: nil) ⇒ WristApp

Create a WristApp instance.

Parameters:

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

    WristApp data.

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

    Path to ZAP file.



28
29
30
31
# File 'lib/timex_datalink_client/protocol_3/wrist_app.rb', line 28

def initialize(wrist_app_data: nil, zap_file: nil)
  @wrist_app_data = wrist_app_data
  @zap_file = zap_file
end

Instance Attribute Details

#zap_fileObject

Returns the value of attribute zap_file.



21
22
23
# File 'lib/timex_datalink_client/protocol_3/wrist_app.rb', line 21

def zap_file
  @zap_file
end

Instance Method Details

#packetsArray<Array<Integer>>

Compile packets for an alarm.

Returns:

  • (Array<Array<Integer>>)

    Two-dimensional array of integers that represent bytes.



36
37
38
# File 'lib/timex_datalink_client/protocol_3/wrist_app.rb', line 36

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