timex_datalink_client 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timex_datalink_client/helpers/char_encoders.rb +2 -2
- data/lib/timex_datalink_client/protocol_1/eeprom/anniversary.rb +44 -0
- data/lib/timex_datalink_client/protocol_1/eeprom/appointment.rb +49 -0
- data/lib/timex_datalink_client/protocol_1/eeprom/list.rb +43 -0
- data/lib/timex_datalink_client/protocol_1/eeprom/phone_number.rb +56 -0
- data/lib/timex_datalink_client/protocol_1/end.rb +12 -2
- data/lib/timex_datalink_client/protocol_1/sync.rb +33 -3
- data/lib/timex_datalink_client/protocol_3/eeprom/anniversary.rb +44 -0
- data/lib/timex_datalink_client/protocol_3/eeprom/appointment.rb +49 -0
- data/lib/timex_datalink_client/protocol_3/eeprom/list.rb +43 -0
- data/lib/timex_datalink_client/protocol_3/eeprom/phone_number.rb +56 -0
- data/lib/timex_datalink_client/protocol_3/end.rb +12 -2
- data/lib/timex_datalink_client/protocol_3/sync.rb +33 -3
- data/lib/timex_datalink_client/protocol_4/alarm.rb +59 -0
- data/lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb +44 -0
- data/lib/timex_datalink_client/protocol_4/eeprom/appointment.rb +49 -0
- data/lib/timex_datalink_client/protocol_4/eeprom/list.rb +43 -0
- data/lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb +56 -0
- data/lib/timex_datalink_client/protocol_4/eeprom.rb +95 -0
- data/lib/timex_datalink_client/protocol_4/end.rb +20 -0
- data/lib/timex_datalink_client/protocol_4/sound_options.rb +42 -0
- data/lib/timex_datalink_client/protocol_4/sound_theme.rb +65 -0
- data/lib/timex_datalink_client/protocol_4/start.rb +20 -0
- data/lib/timex_datalink_client/protocol_4/sync.rb +40 -0
- data/lib/timex_datalink_client/protocol_4/time.rb +77 -0
- data/lib/timex_datalink_client/protocol_4/wrist_app.rb +67 -0
- data/lib/timex_datalink_client/protocol_9/alarm.rb +63 -0
- data/lib/timex_datalink_client/protocol_9/eeprom/chrono.rb +47 -0
- data/lib/timex_datalink_client/protocol_9/eeprom/phone_number.rb +74 -0
- data/lib/timex_datalink_client/protocol_9/eeprom.rb +85 -0
- data/lib/timex_datalink_client/protocol_9/end.rb +20 -0
- data/lib/timex_datalink_client/protocol_9/sound_options.rb +42 -0
- data/lib/timex_datalink_client/protocol_9/start.rb +20 -0
- data/lib/timex_datalink_client/protocol_9/sync.rb +40 -0
- data/lib/timex_datalink_client/protocol_9/time.rb +61 -0
- data/lib/timex_datalink_client/protocol_9/time_name.rb +46 -0
- data/lib/timex_datalink_client/protocol_9/timer.rb +54 -0
- data/lib/timex_datalink_client/version.rb +1 -1
- data/lib/timex_datalink_client.rb +42 -9
- metadata +35 -9
- data/lib/timex_datalink_client/eeprom/anniversary.rb +0 -42
- data/lib/timex_datalink_client/eeprom/appointment.rb +0 -47
- data/lib/timex_datalink_client/eeprom/list.rb +0 -41
- data/lib/timex_datalink_client/eeprom/phone_number.rb +0 -56
- data/lib/timex_datalink_client/end.rb +0 -18
- data/lib/timex_datalink_client/sync.rb +0 -37
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/char_encoders"
|
4
|
+
require "timex_datalink_client/helpers/length_packet_wrapper"
|
5
|
+
|
6
|
+
class TimexDatalinkClient
|
7
|
+
class Protocol9
|
8
|
+
class Eeprom
|
9
|
+
class PhoneNumber
|
10
|
+
include Helpers::CharEncoders
|
11
|
+
prepend Helpers::LengthPacketWrapper
|
12
|
+
|
13
|
+
NAME_CHARS = 15
|
14
|
+
PHONE_DIGITS = 12
|
15
|
+
TYPE_DIGITS = 2
|
16
|
+
|
17
|
+
attr_accessor :name, :number, :type
|
18
|
+
|
19
|
+
# Create a PhoneNumber instance.
|
20
|
+
#
|
21
|
+
# @param name [String] Name associated to phone number.
|
22
|
+
# @param number [String] Phone number text.
|
23
|
+
# @param type [String] Phone number type.
|
24
|
+
# @return [PhoneNumber] PhoneNumber instance.
|
25
|
+
def initialize(name:, number:, type: " ")
|
26
|
+
@name = name
|
27
|
+
@number = number
|
28
|
+
@type = type
|
29
|
+
end
|
30
|
+
|
31
|
+
# Compile a packet for a phone number.
|
32
|
+
#
|
33
|
+
# @return [Array<Integer>] Array of integers that represent bytes.
|
34
|
+
def packet
|
35
|
+
[
|
36
|
+
number_with_type_characters,
|
37
|
+
name_characters
|
38
|
+
].flatten
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def number_with_type_characters
|
44
|
+
phone_chars_for(number_with_type_padded)
|
45
|
+
end
|
46
|
+
|
47
|
+
def name_characters
|
48
|
+
eeprom_chars_for(name_with_number_rollover, length: NAME_CHARS)
|
49
|
+
end
|
50
|
+
|
51
|
+
def number_with_type_padded
|
52
|
+
type_padded = type.rjust(TYPE_DIGITS)
|
53
|
+
number_with_type = "#{number}#{type_padded}"
|
54
|
+
|
55
|
+
number_with_type.rjust(PHONE_DIGITS)
|
56
|
+
end
|
57
|
+
|
58
|
+
def number_rollover
|
59
|
+
"-" + number[PHONE_DIGITS..]
|
60
|
+
end
|
61
|
+
|
62
|
+
def name_with_number_rollover
|
63
|
+
return name unless number.length > PHONE_DIGITS
|
64
|
+
|
65
|
+
truncate_length = NAME_CHARS - (name.length + number_rollover.length)
|
66
|
+
|
67
|
+
return "#{name}#{number_rollover}" unless truncate_length.negative?
|
68
|
+
|
69
|
+
"#{name[..truncate_length - 1]}#{number_rollover}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/cpacket_paginator"
|
4
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
5
|
+
|
6
|
+
class TimexDatalinkClient
|
7
|
+
class Protocol9
|
8
|
+
class Eeprom
|
9
|
+
include Helpers::CpacketPaginator
|
10
|
+
prepend Helpers::CrcPacketsWrapper
|
11
|
+
|
12
|
+
CPACKET_MEM = [0x70]
|
13
|
+
CPACKET_JMPMEM = [0x23]
|
14
|
+
CPACKET_SECT = [0x60]
|
15
|
+
CPACKET_DATA = [0x61]
|
16
|
+
CPACKET_END = [0x62]
|
17
|
+
|
18
|
+
SETUP_PACKETS = [
|
19
|
+
CPACKET_MEM + [
|
20
|
+
0x02, 0x40, 0x05, 0xa9, 0x22, 0x5f, 0xe6, 0xb2, 0xe8, 0xbb, 0xe7, 0xb2, 0xe8, 0xbb, 0xe7, 0xbb, 0xe8, 0xb2,
|
21
|
+
0xe7, 0xb2, 0x5c, 0xa3, 0x09, 0x26, 0xed, 0x15, 0xa9, 0x01
|
22
|
+
],
|
23
|
+
CPACKET_MEM + [0x02, 0x5a, 0xa9, 0x02, 0x14, 0xa9, 0xb6, 0xa9, 0xa4, 0x07, 0x47, 0xb7, 0xa9, 0xcc, 0x74, 0x6f],
|
24
|
+
CPACKET_JMPMEM + [0x02, 0x40]
|
25
|
+
]
|
26
|
+
|
27
|
+
PAYLOAD_HEADER = [0x00, 0x0e, 0x00]
|
28
|
+
|
29
|
+
CPACKET_DATA_LENGTH = 27
|
30
|
+
START_INDEX = 14
|
31
|
+
APPOINTMENT_NO_NOTIFICATION = 0xff
|
32
|
+
|
33
|
+
def self.empty_chrono
|
34
|
+
Chrono.new(label: "chrono", laps: 2)
|
35
|
+
end
|
36
|
+
|
37
|
+
attr_accessor :chrono, :phone_numbers
|
38
|
+
|
39
|
+
# Create an Eeprom instance.
|
40
|
+
#
|
41
|
+
# @param chrono [Chrono] Chrono to be added to EEPROM data.
|
42
|
+
# @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
|
43
|
+
# @return [Eeprom] Eeprom instance.
|
44
|
+
def initialize(chrono: nil, phone_numbers: [])
|
45
|
+
@chrono = chrono || self.class.empty_chrono
|
46
|
+
@phone_numbers = phone_numbers
|
47
|
+
end
|
48
|
+
|
49
|
+
# Compile packets for EEPROM data.
|
50
|
+
#
|
51
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
52
|
+
def packets
|
53
|
+
SETUP_PACKETS + [header] + payloads + [CPACKET_END]
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def header
|
59
|
+
CPACKET_SECT + [payloads.length]
|
60
|
+
end
|
61
|
+
|
62
|
+
def payload
|
63
|
+
[
|
64
|
+
PAYLOAD_HEADER,
|
65
|
+
chrono.chrono_bytesize,
|
66
|
+
chrono.laps,
|
67
|
+
phone_numbers.length,
|
68
|
+
all_packets
|
69
|
+
].flatten
|
70
|
+
end
|
71
|
+
|
72
|
+
def payloads
|
73
|
+
paginate_cpackets(header: CPACKET_DATA, length: CPACKET_DATA_LENGTH, cpackets: payload)
|
74
|
+
end
|
75
|
+
|
76
|
+
def all_items
|
77
|
+
[[chrono], phone_numbers]
|
78
|
+
end
|
79
|
+
|
80
|
+
def all_packets
|
81
|
+
all_items.flatten.map(&:packet).flatten
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
4
|
+
|
5
|
+
class TimexDatalinkClient
|
6
|
+
class Protocol9
|
7
|
+
class End
|
8
|
+
prepend Helpers::CrcPacketsWrapper
|
9
|
+
|
10
|
+
CPACKET_SKIP = [0x21]
|
11
|
+
|
12
|
+
# Compile packets for data end command.
|
13
|
+
#
|
14
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
15
|
+
def packets
|
16
|
+
[CPACKET_SKIP]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
4
|
+
|
5
|
+
class TimexDatalinkClient
|
6
|
+
class Protocol9
|
7
|
+
class SoundOptions
|
8
|
+
prepend Helpers::CrcPacketsWrapper
|
9
|
+
|
10
|
+
CPACKET_BEEPS = [0x32]
|
11
|
+
|
12
|
+
attr_accessor :hourly_chime, :button_beep
|
13
|
+
|
14
|
+
# Create a SoundOptions instance.
|
15
|
+
#
|
16
|
+
# @param hourly_chime [Boolean] Toggle hourly chime sounds.
|
17
|
+
# @param button_beep [Boolean] Toggle button beep sounds.
|
18
|
+
# @return [SoundOptions] SoundOptions instance.
|
19
|
+
def initialize(hourly_chime:, button_beep:)
|
20
|
+
@hourly_chime = hourly_chime
|
21
|
+
@button_beep = button_beep
|
22
|
+
end
|
23
|
+
|
24
|
+
# Compile packets for sound options.
|
25
|
+
#
|
26
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
27
|
+
def packets
|
28
|
+
[
|
29
|
+
CPACKET_BEEPS + [hourly_chime_value + button_beep_value]
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def hourly_chime_value
|
34
|
+
hourly_chime ? 1 : 0
|
35
|
+
end
|
36
|
+
|
37
|
+
def button_beep_value
|
38
|
+
button_beep ? 2 : 0
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
4
|
+
|
5
|
+
class TimexDatalinkClient
|
6
|
+
class Protocol9
|
7
|
+
class Start
|
8
|
+
prepend Helpers::CrcPacketsWrapper
|
9
|
+
|
10
|
+
CPACKET_START = [0x20, 0x00, 0x00, 0x09]
|
11
|
+
|
12
|
+
# Compile packets for data start command.
|
13
|
+
#
|
14
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
15
|
+
def packets
|
16
|
+
[CPACKET_START]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class TimexDatalinkClient
|
4
|
+
class Protocol9
|
5
|
+
class Sync
|
6
|
+
PING_BYTE = [0x78]
|
7
|
+
SYNC_1_BYTE = [0x55]
|
8
|
+
SYNC_2_BYTE = [0xaa]
|
9
|
+
|
10
|
+
SYNC_2_LENGTH = 40
|
11
|
+
|
12
|
+
attr_accessor :length
|
13
|
+
|
14
|
+
# Create a Sync instance.
|
15
|
+
#
|
16
|
+
# @param length [Integer] Number of 0x55 sync bytes to use.
|
17
|
+
# @return [Sync] Sync instance.
|
18
|
+
def initialize(length: 300)
|
19
|
+
@length = length
|
20
|
+
end
|
21
|
+
|
22
|
+
# Compile packets for syncronization data.
|
23
|
+
#
|
24
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
25
|
+
def packets
|
26
|
+
[PING_BYTE + render_sync_1 + render_sync_2]
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def render_sync_1
|
32
|
+
SYNC_1_BYTE * length
|
33
|
+
end
|
34
|
+
|
35
|
+
def render_sync_2
|
36
|
+
SYNC_2_BYTE * SYNC_2_LENGTH
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
4
|
+
|
5
|
+
class TimexDatalinkClient
|
6
|
+
class Protocol9
|
7
|
+
class Time
|
8
|
+
prepend Helpers::CrcPacketsWrapper
|
9
|
+
|
10
|
+
CPACKET_TIME = [0x30]
|
11
|
+
|
12
|
+
attr_accessor :zone, :is_24h, :time
|
13
|
+
|
14
|
+
# Create a Time instance.
|
15
|
+
#
|
16
|
+
# @param zone [Integer] Time zone number (1 or 2).
|
17
|
+
# @param is_24h [Boolean] Toggle 24 hour time.
|
18
|
+
# @param time [::Time] Time to set.
|
19
|
+
# @return [Time] Time instance.
|
20
|
+
def initialize(zone:, is_24h:, time:)
|
21
|
+
@zone = zone
|
22
|
+
@is_24h = is_24h
|
23
|
+
@time = time
|
24
|
+
end
|
25
|
+
|
26
|
+
# Compile packets for a time.
|
27
|
+
#
|
28
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
29
|
+
def packets
|
30
|
+
[
|
31
|
+
[
|
32
|
+
CPACKET_TIME,
|
33
|
+
zone,
|
34
|
+
time.hour,
|
35
|
+
time.min,
|
36
|
+
time.month,
|
37
|
+
time.day,
|
38
|
+
year_mod_1900,
|
39
|
+
wday_from_monday,
|
40
|
+
time.sec,
|
41
|
+
is_24h_value
|
42
|
+
].flatten
|
43
|
+
]
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def year_mod_1900
|
49
|
+
time.year % 100
|
50
|
+
end
|
51
|
+
|
52
|
+
def wday_from_monday
|
53
|
+
(time.wday + 6) % 7
|
54
|
+
end
|
55
|
+
|
56
|
+
def is_24h_value
|
57
|
+
is_24h ? 2 : 1
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/char_encoders"
|
4
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
5
|
+
|
6
|
+
class TimexDatalinkClient
|
7
|
+
class Protocol9
|
8
|
+
class TimeName
|
9
|
+
include Helpers::CharEncoders
|
10
|
+
prepend Helpers::CrcPacketsWrapper
|
11
|
+
|
12
|
+
CPACKET_NAME = [0x31]
|
13
|
+
|
14
|
+
attr_accessor :zone, :name
|
15
|
+
|
16
|
+
# Create a TimeName instance.
|
17
|
+
#
|
18
|
+
# @param zone [Integer] Time zone number (1 or 2).
|
19
|
+
# @param name [String] Name of time zone (3 chars max)
|
20
|
+
# @return [TimeName] TimeName instance.
|
21
|
+
def initialize(zone:, name:)
|
22
|
+
@zone = zone
|
23
|
+
@name = name
|
24
|
+
end
|
25
|
+
|
26
|
+
# Compile packets for a time name.
|
27
|
+
#
|
28
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
29
|
+
def packets
|
30
|
+
[
|
31
|
+
[
|
32
|
+
CPACKET_NAME,
|
33
|
+
zone,
|
34
|
+
name_characters
|
35
|
+
].flatten
|
36
|
+
]
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def name_characters
|
42
|
+
chars_for(name, length: 3, pad: true)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "timex_datalink_client/helpers/char_encoders"
|
4
|
+
require "timex_datalink_client/helpers/crc_packets_wrapper"
|
5
|
+
|
6
|
+
class TimexDatalinkClient
|
7
|
+
class Protocol9
|
8
|
+
class Timer
|
9
|
+
include Helpers::CharEncoders
|
10
|
+
prepend Helpers::CrcPacketsWrapper
|
11
|
+
|
12
|
+
CPACKET_TIMER = [0x43]
|
13
|
+
|
14
|
+
attr_accessor :number, :label, :time, :action_at_end
|
15
|
+
|
16
|
+
# Create a Timer instance.
|
17
|
+
#
|
18
|
+
# @param number [Integer] Entry number for timer.
|
19
|
+
# @param label [String] Label for timer.
|
20
|
+
# @param time [Time] Time of timer.
|
21
|
+
# @param action_at_end [Integer] Action at end of timer.
|
22
|
+
# @return [Timer] Timer instance.
|
23
|
+
def initialize(number:, label:, time:, action_at_end:)
|
24
|
+
@number = number
|
25
|
+
@label = label
|
26
|
+
@time = time
|
27
|
+
@action_at_end = action_at_end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Compile packets for a timer.
|
31
|
+
#
|
32
|
+
# @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
33
|
+
def packets
|
34
|
+
[
|
35
|
+
[
|
36
|
+
CPACKET_TIMER,
|
37
|
+
number,
|
38
|
+
time.hour,
|
39
|
+
time.min,
|
40
|
+
time.sec,
|
41
|
+
action_at_end,
|
42
|
+
label_characters
|
43
|
+
].flatten
|
44
|
+
]
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def label_characters
|
50
|
+
chars_for(label, length: 8, pad: true)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "timex_datalink_client/version"
|
4
3
|
require "timex_datalink_client/notebook_adapter"
|
5
|
-
|
6
|
-
require "timex_datalink_client/eeprom/anniversary"
|
7
|
-
require "timex_datalink_client/eeprom/appointment"
|
8
|
-
require "timex_datalink_client/eeprom/list"
|
9
|
-
require "timex_datalink_client/eeprom/phone_number"
|
4
|
+
require "timex_datalink_client/version"
|
10
5
|
|
11
6
|
require "timex_datalink_client/protocol_1/alarm"
|
12
7
|
require "timex_datalink_client/protocol_1/eeprom"
|
8
|
+
require "timex_datalink_client/protocol_1/eeprom/anniversary"
|
9
|
+
require "timex_datalink_client/protocol_1/eeprom/appointment"
|
10
|
+
require "timex_datalink_client/protocol_1/eeprom/list"
|
11
|
+
require "timex_datalink_client/protocol_1/eeprom/phone_number"
|
13
12
|
require "timex_datalink_client/protocol_1/end"
|
14
13
|
require "timex_datalink_client/protocol_1/start"
|
15
14
|
require "timex_datalink_client/protocol_1/sync"
|
@@ -18,6 +17,10 @@ require "timex_datalink_client/protocol_1/time_name"
|
|
18
17
|
|
19
18
|
require "timex_datalink_client/protocol_3/alarm"
|
20
19
|
require "timex_datalink_client/protocol_3/eeprom"
|
20
|
+
require "timex_datalink_client/protocol_3/eeprom/anniversary"
|
21
|
+
require "timex_datalink_client/protocol_3/eeprom/appointment"
|
22
|
+
require "timex_datalink_client/protocol_3/eeprom/list"
|
23
|
+
require "timex_datalink_client/protocol_3/eeprom/phone_number"
|
21
24
|
require "timex_datalink_client/protocol_3/end"
|
22
25
|
require "timex_datalink_client/protocol_3/sound_options"
|
23
26
|
require "timex_datalink_client/protocol_3/sound_theme"
|
@@ -26,15 +29,45 @@ require "timex_datalink_client/protocol_3/sync"
|
|
26
29
|
require "timex_datalink_client/protocol_3/time"
|
27
30
|
require "timex_datalink_client/protocol_3/wrist_app"
|
28
31
|
|
32
|
+
require "timex_datalink_client/protocol_4/alarm"
|
33
|
+
require "timex_datalink_client/protocol_4/eeprom"
|
34
|
+
require "timex_datalink_client/protocol_4/eeprom/anniversary"
|
35
|
+
require "timex_datalink_client/protocol_4/eeprom/appointment"
|
36
|
+
require "timex_datalink_client/protocol_4/eeprom/list"
|
37
|
+
require "timex_datalink_client/protocol_4/eeprom/phone_number"
|
38
|
+
require "timex_datalink_client/protocol_4/end"
|
39
|
+
require "timex_datalink_client/protocol_4/sound_options"
|
40
|
+
require "timex_datalink_client/protocol_4/sound_theme"
|
41
|
+
require "timex_datalink_client/protocol_4/start"
|
42
|
+
require "timex_datalink_client/protocol_4/sync"
|
43
|
+
require "timex_datalink_client/protocol_4/time"
|
44
|
+
require "timex_datalink_client/protocol_4/wrist_app"
|
45
|
+
|
46
|
+
require "timex_datalink_client/protocol_9/alarm"
|
47
|
+
require "timex_datalink_client/protocol_9/eeprom"
|
48
|
+
require "timex_datalink_client/protocol_9/eeprom/chrono"
|
49
|
+
require "timex_datalink_client/protocol_9/eeprom/phone_number"
|
50
|
+
require "timex_datalink_client/protocol_9/end"
|
51
|
+
require "timex_datalink_client/protocol_9/sound_options"
|
52
|
+
require "timex_datalink_client/protocol_9/start"
|
53
|
+
require "timex_datalink_client/protocol_9/sync"
|
54
|
+
require "timex_datalink_client/protocol_9/time"
|
55
|
+
require "timex_datalink_client/protocol_9/time_name"
|
56
|
+
require "timex_datalink_client/protocol_9/timer"
|
57
|
+
|
29
58
|
class TimexDatalinkClient
|
30
59
|
attr_accessor :serial_device, :models, :byte_sleep, :packet_sleep, :verbose
|
31
60
|
|
32
61
|
# Create a TimexDatalinkClient instance.
|
33
62
|
#
|
34
63
|
# @param serial_device [String] Path to serial device.
|
35
|
-
# @param models [Array<
|
36
|
-
#
|
37
|
-
#
|
64
|
+
# @param models [Array<Protocol1::Sync, Protocol1::Start, Protocol1::Time, Protocol1::TimeName, Protocol1::Alarm,
|
65
|
+
# Protocol1::Eeprom, Protocol1::End, Protocol3::Sync, Protocol3::Start, Protocol3::Time, Protocol3::Alarm,
|
66
|
+
# Protocol3::Eeprom, Protocol3::SoundTheme, Protocol3::SoundOptions, Protocol3::WristApp, Protocol3::End,
|
67
|
+
# Protocol4::Sync, Protocol4::Start, Protocol4::Time, Protocol4::Alarm, Protocol4::Eeprom, Protocol4::SoundTheme,
|
68
|
+
# Protocol4::SoundOptions, Protocol4::WristApp, Protocol4::End, Protocol9::Sync, Protocol9::Start, Protocol9::Time,
|
69
|
+
# Protocol9::TimeName, Protocol9::Timer, Protocol9::Alarm, Protocol9::Eeprom, Protocol9::SoundOptions,
|
70
|
+
# Protocol9::End>] Models to compile data for.
|
38
71
|
# @param byte_sleep [Integer, nil] Time to sleep after sending byte.
|
39
72
|
# @param packet_sleep [Integer, nil] Time to sleep after sending packet of bytes.
|
40
73
|
# @param verbose [Boolean] Write verbose output to console.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timex_datalink_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxwell Pray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crc
|
@@ -87,11 +87,6 @@ extensions: []
|
|
87
87
|
extra_rdoc_files: []
|
88
88
|
files:
|
89
89
|
- lib/timex_datalink_client.rb
|
90
|
-
- lib/timex_datalink_client/eeprom/anniversary.rb
|
91
|
-
- lib/timex_datalink_client/eeprom/appointment.rb
|
92
|
-
- lib/timex_datalink_client/eeprom/list.rb
|
93
|
-
- lib/timex_datalink_client/eeprom/phone_number.rb
|
94
|
-
- lib/timex_datalink_client/end.rb
|
95
90
|
- lib/timex_datalink_client/helpers/char_encoders.rb
|
96
91
|
- lib/timex_datalink_client/helpers/cpacket_paginator.rb
|
97
92
|
- lib/timex_datalink_client/helpers/crc_packets_wrapper.rb
|
@@ -99,6 +94,10 @@ files:
|
|
99
94
|
- lib/timex_datalink_client/notebook_adapter.rb
|
100
95
|
- lib/timex_datalink_client/protocol_1/alarm.rb
|
101
96
|
- lib/timex_datalink_client/protocol_1/eeprom.rb
|
97
|
+
- lib/timex_datalink_client/protocol_1/eeprom/anniversary.rb
|
98
|
+
- lib/timex_datalink_client/protocol_1/eeprom/appointment.rb
|
99
|
+
- lib/timex_datalink_client/protocol_1/eeprom/list.rb
|
100
|
+
- lib/timex_datalink_client/protocol_1/eeprom/phone_number.rb
|
102
101
|
- lib/timex_datalink_client/protocol_1/end.rb
|
103
102
|
- lib/timex_datalink_client/protocol_1/start.rb
|
104
103
|
- lib/timex_datalink_client/protocol_1/sync.rb
|
@@ -106,6 +105,10 @@ files:
|
|
106
105
|
- lib/timex_datalink_client/protocol_1/time_name.rb
|
107
106
|
- lib/timex_datalink_client/protocol_3/alarm.rb
|
108
107
|
- lib/timex_datalink_client/protocol_3/eeprom.rb
|
108
|
+
- lib/timex_datalink_client/protocol_3/eeprom/anniversary.rb
|
109
|
+
- lib/timex_datalink_client/protocol_3/eeprom/appointment.rb
|
110
|
+
- lib/timex_datalink_client/protocol_3/eeprom/list.rb
|
111
|
+
- lib/timex_datalink_client/protocol_3/eeprom/phone_number.rb
|
109
112
|
- lib/timex_datalink_client/protocol_3/end.rb
|
110
113
|
- lib/timex_datalink_client/protocol_3/sound_options.rb
|
111
114
|
- lib/timex_datalink_client/protocol_3/sound_theme.rb
|
@@ -113,9 +116,32 @@ files:
|
|
113
116
|
- lib/timex_datalink_client/protocol_3/sync.rb
|
114
117
|
- lib/timex_datalink_client/protocol_3/time.rb
|
115
118
|
- lib/timex_datalink_client/protocol_3/wrist_app.rb
|
116
|
-
- lib/timex_datalink_client/
|
119
|
+
- lib/timex_datalink_client/protocol_4/alarm.rb
|
120
|
+
- lib/timex_datalink_client/protocol_4/eeprom.rb
|
121
|
+
- lib/timex_datalink_client/protocol_4/eeprom/anniversary.rb
|
122
|
+
- lib/timex_datalink_client/protocol_4/eeprom/appointment.rb
|
123
|
+
- lib/timex_datalink_client/protocol_4/eeprom/list.rb
|
124
|
+
- lib/timex_datalink_client/protocol_4/eeprom/phone_number.rb
|
125
|
+
- lib/timex_datalink_client/protocol_4/end.rb
|
126
|
+
- lib/timex_datalink_client/protocol_4/sound_options.rb
|
127
|
+
- lib/timex_datalink_client/protocol_4/sound_theme.rb
|
128
|
+
- lib/timex_datalink_client/protocol_4/start.rb
|
129
|
+
- lib/timex_datalink_client/protocol_4/sync.rb
|
130
|
+
- lib/timex_datalink_client/protocol_4/time.rb
|
131
|
+
- lib/timex_datalink_client/protocol_4/wrist_app.rb
|
132
|
+
- lib/timex_datalink_client/protocol_9/alarm.rb
|
133
|
+
- lib/timex_datalink_client/protocol_9/eeprom.rb
|
134
|
+
- lib/timex_datalink_client/protocol_9/eeprom/chrono.rb
|
135
|
+
- lib/timex_datalink_client/protocol_9/eeprom/phone_number.rb
|
136
|
+
- lib/timex_datalink_client/protocol_9/end.rb
|
137
|
+
- lib/timex_datalink_client/protocol_9/sound_options.rb
|
138
|
+
- lib/timex_datalink_client/protocol_9/start.rb
|
139
|
+
- lib/timex_datalink_client/protocol_9/sync.rb
|
140
|
+
- lib/timex_datalink_client/protocol_9/time.rb
|
141
|
+
- lib/timex_datalink_client/protocol_9/time_name.rb
|
142
|
+
- lib/timex_datalink_client/protocol_9/timer.rb
|
117
143
|
- lib/timex_datalink_client/version.rb
|
118
|
-
homepage: https://github.com/synthead/timex_datalink_client/tree/v0.
|
144
|
+
homepage: https://github.com/synthead/timex_datalink_client/tree/v0.7.0
|
119
145
|
licenses:
|
120
146
|
- MIT
|
121
147
|
metadata: {}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "timex_datalink_client/helpers/char_encoders"
|
4
|
-
require "timex_datalink_client/helpers/length_packet_wrapper"
|
5
|
-
|
6
|
-
class TimexDatalinkClient
|
7
|
-
class Eeprom
|
8
|
-
class Anniversary
|
9
|
-
include Helpers::CharEncoders
|
10
|
-
prepend Helpers::LengthPacketWrapper
|
11
|
-
|
12
|
-
attr_accessor :time, :anniversary
|
13
|
-
|
14
|
-
# Create an Anniversary instance.
|
15
|
-
#
|
16
|
-
# @param time [::Time] Time of anniversary.
|
17
|
-
# @param anniversary [String] Anniversary text.
|
18
|
-
# @return [Anniversary] Anniversary instance.
|
19
|
-
def initialize(time:, anniversary:)
|
20
|
-
@time = time
|
21
|
-
@anniversary = anniversary
|
22
|
-
end
|
23
|
-
|
24
|
-
# Compile a packet for an anniversary.
|
25
|
-
#
|
26
|
-
# @return [Array<Integer>] Array of integers that represent bytes.
|
27
|
-
def packet
|
28
|
-
[
|
29
|
-
time.month,
|
30
|
-
time.day,
|
31
|
-
anniversary_characters
|
32
|
-
].flatten
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def anniversary_characters
|
38
|
-
eeprom_chars_for(anniversary)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|