timex_datalink_client 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/timex_datalink_client/helpers/char_encoders.rb +1 -1
  3. data/lib/timex_datalink_client/helpers/lsb_msb_formatter.rb +11 -0
  4. data/lib/timex_datalink_client/protocol_1/alarm.rb +48 -0
  5. data/lib/timex_datalink_client/protocol_1/eeprom/list.rb +17 -1
  6. data/lib/timex_datalink_client/protocol_1/eeprom.rb +27 -6
  7. data/lib/timex_datalink_client/protocol_1/time.rb +11 -0
  8. data/lib/timex_datalink_client/protocol_1/time_name.rb +11 -0
  9. data/lib/timex_datalink_client/protocol_3/alarm.rb +11 -0
  10. data/lib/timex_datalink_client/protocol_3/eeprom/list.rb +18 -2
  11. data/lib/timex_datalink_client/protocol_3/eeprom.rb +27 -6
  12. data/lib/timex_datalink_client/protocol_3/time.rb +16 -0
  13. data/lib/timex_datalink_client/protocol_4/alarm.rb +11 -0
  14. data/lib/timex_datalink_client/protocol_4/eeprom/list.rb +17 -1
  15. data/lib/timex_datalink_client/protocol_4/eeprom.rb +27 -6
  16. data/lib/timex_datalink_client/protocol_4/time.rb +16 -0
  17. data/lib/timex_datalink_client/protocol_7/eeprom/calendar/event.rb +5 -1
  18. data/lib/timex_datalink_client/protocol_7/eeprom/calendar.rb +6 -4
  19. data/lib/timex_datalink_client/protocol_7/eeprom/games.rb +4 -2
  20. data/lib/timex_datalink_client/protocol_7/eeprom/speech.rb +7 -2
  21. data/lib/timex_datalink_client/protocol_7/eeprom.rb +0 -3
  22. data/lib/timex_datalink_client/protocol_9/alarm.rb +48 -0
  23. data/lib/timex_datalink_client/protocol_9/eeprom/chrono.rb +11 -0
  24. data/lib/timex_datalink_client/protocol_9/time.rb +11 -0
  25. data/lib/timex_datalink_client/protocol_9/time_name.rb +11 -0
  26. data/lib/timex_datalink_client/version.rb +1 -1
  27. data/lib/timex_datalink_client.rb +5 -5
  28. metadata +64 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efa331ee9142b5392695a07a8f904f6c967584bb2b39abe1a5fd3577150f4eaf
4
- data.tar.gz: ba994a959bb3156a218bfe1faef05c8a51223b911c6c926152d15182178ade1d
3
+ metadata.gz: 10adb86fd981a90fa2e764e3dd63bbaf0b1ffa1c37b5210d510ea6aa29b76edb
4
+ data.tar.gz: 2d2b67b5b10a8a6bd7bbefd4423e9e7b661a4824649e241df0e4e3ca45e17290
5
5
  SHA512:
6
- metadata.gz: 69b09f2da57887e8ca4cc8c4f4186c21a9bb10b57d05e839d0122a0158ffde4fe7896268c74d525cdff2caf941dd1506b54d4db4ce4cd620d7bbbffb6d4cfa2a
7
- data.tar.gz: 4cc7a686c22c7aa1b2a987286b2ecf023b3a36b423ba2d6a47665b743b8e989a3d29ab718466634893ac7d559f8b4e9e67d25d3797bdea8e8a1a399d67fa9f37
6
+ metadata.gz: 3a2fca239d0220cc056a7577ec7b17d1e4e9cf9f2c706af832b38ec0d0eb5522ae4df970369fa7be882eea686fa0da0bb0f063d86f8ce3736ba24c9c0f1acca2
7
+ data.tar.gz: 4c8296686c59d03b8da2970cda23c8c525f2376a1d8bca2094c3b44955c37d59625d9cf8e9a8c9545a600421514e584a32e53d52fa537f40af0a035041f140b6
@@ -20,7 +20,7 @@ class TimexDatalinkClient
20
20
  end
21
21
 
22
22
  def eeprom_chars_for(string_chars, length: 31)
23
- chars = chars_for(string_chars, char_map: EEPROM_CHARS, length: length).append(EEPROM_TERMINATOR)
23
+ chars = chars_for(string_chars, char_map: EEPROM_CHARS, length:).append(EEPROM_TERMINATOR)
24
24
 
25
25
  packed_int = chars.each_with_index.sum do |char, index|
26
26
  char << (6 * index)
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class TimexDatalinkClient
4
+ class Helpers
5
+ module LsbMsbFormatter
6
+ def lsb_msb_format_for(value)
7
+ value.divmod(256).reverse
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol1
8
10
  class Alarm
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -14,8 +17,50 @@ class TimexDatalinkClient
14
17
 
15
18
  ALARM_SILENT_START_INDEX = 0x61
16
19
 
20
+ VALID_DAYS_IN_MONTH = {
21
+ 1 => 1..31,
22
+ 2 => 1..29,
23
+ 3 => 1..31,
24
+ 4 => 1..30,
25
+ 5 => 1..31,
26
+ 6 => 1..30,
27
+ 7 => 1..31,
28
+ 8 => 1..31,
29
+ 9 => 1..30,
30
+ 10 => 1..31,
31
+ 11 => 1..30,
32
+ 12 => 1..31
33
+ }.freeze
34
+
17
35
  attr_accessor :number, :audible, :time, :message, :month, :day
18
36
 
37
+ validates :number, inclusion: {
38
+ in: 1..5,
39
+ message: "value %{value} is invalid! Valid number values are 1..5."
40
+ }
41
+
42
+ validates :month, inclusion: {
43
+ in: 1..12,
44
+ allow_nil: true,
45
+ message: "%{value} is invalid! Valid months are 1..12 and nil."
46
+ }
47
+
48
+ validates :day, inclusion: {
49
+ if: ->(alarm) { alarm.month.nil? },
50
+ in: 1..31,
51
+ allow_nil: true,
52
+ message: "%{value} is invalid! Valid days are 1..31 and nil."
53
+ }
54
+
55
+ validates :day, inclusion: {
56
+ if: ->(alarm) { alarm.day && alarm.month },
57
+ in: ->(alarm) { VALID_DAYS_IN_MONTH[alarm.month] },
58
+ message: ->(alarm, _attributes) do
59
+ "#{alarm.day} is invalid for month #{alarm.month}! " \
60
+ "Valid days are #{VALID_DAYS_IN_MONTH[alarm.month]} and nil when month is #{alarm.month}."
61
+ end
62
+ }
63
+
19
64
  # Create an Alarm instance.
20
65
  #
21
66
  # @param number [Integer] Alarm number (from 1 to 5).
@@ -36,8 +81,11 @@ class TimexDatalinkClient
36
81
 
37
82
  # Compile packets for an alarm.
38
83
  #
84
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
39
85
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
40
86
  def packets
87
+ validate!
88
+
41
89
  [alarm_data_packet].tap do |packets|
42
90
  packets << alarm_silent_packet unless audible
43
91
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/length_packet_wrapper"
5
7
 
@@ -7,11 +9,18 @@ class TimexDatalinkClient
7
9
  class Protocol1
8
10
  class Eeprom
9
11
  class List
12
+ include ActiveModel::Validations
10
13
  include Helpers::CharEncoders
11
14
  prepend Helpers::LengthPacketWrapper
12
15
 
13
16
  attr_accessor :list_entry, :priority
14
17
 
18
+ validates :priority, inclusion: {
19
+ in: 1..5,
20
+ allow_nil: true,
21
+ message: "%{value} is invalid! Valid priorities are 1..5 or nil."
22
+ }
23
+
15
24
  # Create a List instance.
16
25
  #
17
26
  # @param list_entry [String] List entry text.
@@ -24,10 +33,13 @@ class TimexDatalinkClient
24
33
 
25
34
  # Compile a packet for a list.
26
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
27
37
  # @return [Array<Integer>] Array of integers that represent bytes.
28
38
  def packet
39
+ validate!
40
+
29
41
  [
30
- priority,
42
+ priority_value,
31
43
  list_entry_characters
32
44
  ].flatten
33
45
  end
@@ -37,6 +49,10 @@ class TimexDatalinkClient
37
49
  def list_entry_characters
38
50
  eeprom_chars_for(list_entry)
39
51
  end
52
+
53
+ def priority_value
54
+ priority.nil? ? 0 : priority
55
+ end
40
56
  end
41
57
  end
42
58
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/cpacket_paginator"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol1
8
10
  class Eeprom
11
+ include ActiveModel::Validations
9
12
  include Helpers::CpacketPaginator
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -16,8 +19,16 @@ class TimexDatalinkClient
16
19
  CPACKET_DATA_LENGTH = 27
17
20
  START_INDEX = 14
18
21
  APPOINTMENT_NO_NOTIFICATION = 0xff
22
+ APPOINTMENT_NOTIFICATION_VALID_MINUTES = (0..30).step(5)
23
+
24
+ attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification_minutes
19
25
 
20
- attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification
26
+ validates :appointment_notification_minutes, inclusion: {
27
+ in: APPOINTMENT_NOTIFICATION_VALID_MINUTES,
28
+ allow_nil: true,
29
+ message: "value %{value} is invalid! Valid appointment notification minutes values are" \
30
+ " #{APPOINTMENT_NOTIFICATION_VALID_MINUTES.to_a} or nil."
31
+ }
21
32
 
22
33
  # Create an Eeprom instance.
23
34
  #
@@ -25,21 +36,25 @@ class TimexDatalinkClient
25
36
  # @param anniversaries [Array<Anniversary>] Anniversaries to be added to EEPROM data.
26
37
  # @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
27
38
  # @param lists [Array<List>] Lists to be added to EEPROM data.
28
- # @param appointment_notification [Integer] Appointment notification (intervals of 15 minutes, 255 for no
29
- # notification)
39
+ # @param appointment_notification_minutes [Integer, nil] Appointment notification in minutes.
30
40
  # @return [Eeprom] Eeprom instance.
31
- def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
41
+ def initialize(
42
+ appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification_minutes: nil
43
+ )
32
44
  @appointments = appointments
33
45
  @anniversaries = anniversaries
34
46
  @phone_numbers = phone_numbers
35
47
  @lists = lists
36
- @appointment_notification = appointment_notification
48
+ @appointment_notification_minutes = appointment_notification_minutes
37
49
  end
38
50
 
39
51
  # Compile packets for EEPROM data.
40
52
  #
53
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
41
54
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
42
55
  def packets
56
+ validate!
57
+
43
58
  [header] + payloads + [CPACKET_END]
44
59
  end
45
60
 
@@ -57,7 +72,7 @@ class TimexDatalinkClient
57
72
  items_indexes,
58
73
  items_lengths,
59
74
  earliest_appointment_year,
60
- appointment_notification,
75
+ appointment_notification_minutes_value,
61
76
  all_packets
62
77
  ].flatten
63
78
  end
@@ -95,6 +110,12 @@ class TimexDatalinkClient
95
110
 
96
111
  earliest_appointment.time.year % 100
97
112
  end
113
+
114
+ def appointment_notification_minutes_value
115
+ return APPOINTMENT_NO_NOTIFICATION unless appointment_notification_minutes
116
+
117
+ appointment_notification_minutes / 5
118
+ end
98
119
  end
99
120
  end
100
121
  end
@@ -1,16 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/crc_packets_wrapper"
4
6
 
5
7
  class TimexDatalinkClient
6
8
  class Protocol1
7
9
  class Time
10
+ include ActiveModel::Validations
8
11
  prepend Helpers::CrcPacketsWrapper
9
12
 
10
13
  CPACKET_TIME = [0x30]
11
14
 
12
15
  attr_accessor :zone, :is_24h, :time
13
16
 
17
+ validates :zone, inclusion: {
18
+ in: 1..2,
19
+ message: "%{value} is invalid! Valid zones are 1..2."
20
+ }
21
+
14
22
  # Create a Time instance.
15
23
  #
16
24
  # @param zone [Integer] Time zone number (1 or 2).
@@ -25,8 +33,11 @@ class TimexDatalinkClient
25
33
 
26
34
  # Compile packets for a time.
27
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
28
37
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
29
38
  def packets
39
+ validate!
40
+
30
41
  [
31
42
  [
32
43
  CPACKET_TIME,
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol1
8
10
  class TimeName
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -13,6 +16,11 @@ class TimexDatalinkClient
13
16
 
14
17
  attr_accessor :zone, :name
15
18
 
19
+ validates :zone, inclusion: {
20
+ in: 1..2,
21
+ message: "%{value} is invalid! Valid zones are 1..2."
22
+ }
23
+
16
24
  # Create a TimeName instance.
17
25
  #
18
26
  # @param zone [Integer] Time zone number (1 or 2).
@@ -25,8 +33,11 @@ class TimexDatalinkClient
25
33
 
26
34
  # Compile packets for a time name.
27
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
28
37
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
29
38
  def packets
39
+ validate!
40
+
30
41
  [
31
42
  [
32
43
  CPACKET_NAME,
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol3
8
10
  class Alarm
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -13,6 +16,11 @@ class TimexDatalinkClient
13
16
 
14
17
  attr_accessor :number, :audible, :time, :message
15
18
 
19
+ validates :number, inclusion: {
20
+ in: 1..5,
21
+ message: "value %{value} is invalid! Valid number values are 1..5."
22
+ }
23
+
16
24
  # Create an Alarm instance.
17
25
  #
18
26
  # @param number [Integer] Alarm number (from 1 to 5).
@@ -29,8 +37,11 @@ class TimexDatalinkClient
29
37
 
30
38
  # Compile packets for an alarm.
31
39
  #
40
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
32
41
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
33
42
  def packets
43
+ validate!
44
+
34
45
  [
35
46
  [
36
47
  CPACKET_ALARM,
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/length_packet_wrapper"
5
7
 
@@ -7,15 +9,22 @@ class TimexDatalinkClient
7
9
  class Protocol3
8
10
  class Eeprom
9
11
  class List
12
+ include ActiveModel::Validations
10
13
  include Helpers::CharEncoders
11
14
  prepend Helpers::LengthPacketWrapper
12
15
 
13
16
  attr_accessor :list_entry, :priority
14
17
 
18
+ validates :priority, inclusion: {
19
+ in: 1..5,
20
+ allow_nil: true,
21
+ message: "%{value} is invalid! Valid priorities are 1..5 or nil."
22
+ }
23
+
15
24
  # Create a List instance.
16
25
  #
17
26
  # @param list_entry [String] List entry text.
18
- # @param priority [Integer] List priority.
27
+ # @param priority [Integer, nil] List priority.
19
28
  # @return [List] List instance.
20
29
  def initialize(list_entry:, priority:)
21
30
  @list_entry = list_entry
@@ -24,10 +33,13 @@ class TimexDatalinkClient
24
33
 
25
34
  # Compile a packet for a list.
26
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
27
37
  # @return [Array<Integer>] Array of integers that represent bytes.
28
38
  def packet
39
+ validate!
40
+
29
41
  [
30
- priority,
42
+ priority_value,
31
43
  list_entry_characters
32
44
  ].flatten
33
45
  end
@@ -37,6 +49,10 @@ class TimexDatalinkClient
37
49
  def list_entry_characters
38
50
  eeprom_chars_for(list_entry)
39
51
  end
52
+
53
+ def priority_value
54
+ priority.nil? ? 0 : priority
55
+ end
40
56
  end
41
57
  end
42
58
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/cpacket_paginator"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol3
8
10
  class Eeprom
11
+ include ActiveModel::Validations
9
12
  include Helpers::CpacketPaginator
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -17,8 +20,16 @@ class TimexDatalinkClient
17
20
  CPACKET_DATA_LENGTH = 32
18
21
  START_ADDRESS = 0x0236
19
22
  APPOINTMENT_NO_NOTIFICATION = 0xff
23
+ APPOINTMENT_NOTIFICATION_VALID_MINUTES = (0..30).step(5)
24
+
25
+ attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification_minutes
20
26
 
21
- attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification
27
+ validates :appointment_notification_minutes, inclusion: {
28
+ in: APPOINTMENT_NOTIFICATION_VALID_MINUTES,
29
+ allow_nil: true,
30
+ message: "value %{value} is invalid! Valid appointment notification minutes values are" \
31
+ " #{APPOINTMENT_NOTIFICATION_VALID_MINUTES.to_a} or nil."
32
+ }
22
33
 
23
34
  # Create an Eeprom instance.
24
35
  #
@@ -26,21 +37,25 @@ class TimexDatalinkClient
26
37
  # @param anniversaries [Array<Anniversary>] Anniversaries to be added to EEPROM data.
27
38
  # @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
28
39
  # @param lists [Array<List>] Lists to be added to EEPROM data.
29
- # @param appointment_notification [Integer] Appointment notification (intervals of 15 minutes, 255 for no
30
- # notification)
40
+ # @param appointment_notification_minutes [Integer, nil] Appointment notification in minutes.
31
41
  # @return [Eeprom] Eeprom instance.
32
- def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
42
+ def initialize(
43
+ appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification_minutes: nil
44
+ )
33
45
  @appointments = appointments
34
46
  @anniversaries = anniversaries
35
47
  @phone_numbers = phone_numbers
36
48
  @lists = lists
37
- @appointment_notification = appointment_notification
49
+ @appointment_notification_minutes = appointment_notification_minutes
38
50
  end
39
51
 
40
52
  # Compile packets for EEPROM data.
41
53
  #
54
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
42
55
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
43
56
  def packets
57
+ validate!
58
+
44
59
  [CPACKET_CLEAR, header] + payloads + [CPACKET_END]
45
60
  end
46
61
 
@@ -53,7 +68,7 @@ class TimexDatalinkClient
53
68
  items_addresses,
54
69
  items_lengths,
55
70
  earliest_appointment_year,
56
- appointment_notification
71
+ appointment_notification_minutes_value
57
72
  ].flatten
58
73
  end
59
74
 
@@ -90,6 +105,12 @@ class TimexDatalinkClient
90
105
 
91
106
  earliest_appointment.time.year % 100
92
107
  end
108
+
109
+ def appointment_notification_minutes_value
110
+ return APPOINTMENT_NO_NOTIFICATION unless appointment_notification_minutes
111
+
112
+ appointment_notification_minutes / 5
113
+ end
93
114
  end
94
115
  end
95
116
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol3
8
10
  class Time
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -20,6 +23,16 @@ class TimexDatalinkClient
20
23
  "%y.%m.%d" => 6
21
24
  }.freeze
22
25
 
26
+ validates :zone, inclusion: {
27
+ in: 1..2,
28
+ message: "%{value} is invalid! Valid zones are 1..2."
29
+ }
30
+
31
+ validates :date_format, inclusion: {
32
+ in: DATE_FORMAT_MAP.keys,
33
+ message: "%{value} is invalid! Valid date formats are #{DATE_FORMAT_MAP.keys}."
34
+ }
35
+
23
36
  attr_accessor :zone, :is_24h, :date_format, :time
24
37
 
25
38
  # Create a Time instance.
@@ -41,8 +54,11 @@ class TimexDatalinkClient
41
54
 
42
55
  # Compile packets for a time.
43
56
  #
57
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
44
58
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
45
59
  def packets
60
+ validate!
61
+
46
62
  [
47
63
  [
48
64
  CPACKET_TIME,
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol4
8
10
  class Alarm
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -13,6 +16,11 @@ class TimexDatalinkClient
13
16
 
14
17
  attr_accessor :number, :audible, :time, :message
15
18
 
19
+ validates :number, inclusion: {
20
+ in: 1..5,
21
+ message: "value %{value} is invalid! Valid number values are 1..5."
22
+ }
23
+
16
24
  # Create an Alarm instance.
17
25
  #
18
26
  # @param number [Integer] Alarm number (from 1 to 5).
@@ -29,8 +37,11 @@ class TimexDatalinkClient
29
37
 
30
38
  # Compile packets for an alarm.
31
39
  #
40
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
32
41
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
33
42
  def packets
43
+ validate!
44
+
34
45
  [
35
46
  [
36
47
  CPACKET_ALARM,
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/length_packet_wrapper"
5
7
 
@@ -7,11 +9,18 @@ class TimexDatalinkClient
7
9
  class Protocol4
8
10
  class Eeprom
9
11
  class List
12
+ include ActiveModel::Validations
10
13
  include Helpers::CharEncoders
11
14
  prepend Helpers::LengthPacketWrapper
12
15
 
13
16
  attr_accessor :list_entry, :priority
14
17
 
18
+ validates :priority, inclusion: {
19
+ in: 1..5,
20
+ allow_nil: true,
21
+ message: "%{value} is invalid! Valid priorities are 1..5 or nil."
22
+ }
23
+
15
24
  # Create a List instance.
16
25
  #
17
26
  # @param list_entry [String] List entry text.
@@ -24,10 +33,13 @@ class TimexDatalinkClient
24
33
 
25
34
  # Compile a packet for a list.
26
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
27
37
  # @return [Array<Integer>] Array of integers that represent bytes.
28
38
  def packet
39
+ validate!
40
+
29
41
  [
30
- priority,
42
+ priority_value,
31
43
  list_entry_characters
32
44
  ].flatten
33
45
  end
@@ -37,6 +49,10 @@ class TimexDatalinkClient
37
49
  def list_entry_characters
38
50
  eeprom_chars_for(list_entry)
39
51
  end
52
+
53
+ def priority_value
54
+ priority.nil? ? 0 : priority
55
+ end
40
56
  end
41
57
  end
42
58
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/cpacket_paginator"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol4
8
10
  class Eeprom
11
+ include ActiveModel::Validations
9
12
  include Helpers::CpacketPaginator
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -17,8 +20,16 @@ class TimexDatalinkClient
17
20
  CPACKET_DATA_LENGTH = 32
18
21
  START_ADDRESS = 0x0236
19
22
  APPOINTMENT_NO_NOTIFICATION = 0xff
23
+ APPOINTMENT_NOTIFICATION_VALID_MINUTES = (0..30).step(5)
24
+
25
+ attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification_minutes
20
26
 
21
- attr_accessor :appointments, :anniversaries, :phone_numbers, :lists, :appointment_notification
27
+ validates :appointment_notification_minutes, inclusion: {
28
+ in: APPOINTMENT_NOTIFICATION_VALID_MINUTES,
29
+ allow_nil: true,
30
+ message: "value %{value} is invalid! Valid appointment notification minutes values are" \
31
+ " #{APPOINTMENT_NOTIFICATION_VALID_MINUTES.to_a} or nil."
32
+ }
22
33
 
23
34
  # Create an Eeprom instance.
24
35
  #
@@ -26,21 +37,25 @@ class TimexDatalinkClient
26
37
  # @param anniversaries [Array<Anniversary>] Anniversaries to be added to EEPROM data.
27
38
  # @param phone_numbers [Array<PhoneNumber>] Phone numbers to be added to EEPROM data.
28
39
  # @param lists [Array<List>] Lists to be added to EEPROM data.
29
- # @param appointment_notification [Integer] Appointment notification (intervals of 15 minutes, 255 for no
30
- # notification)
40
+ # @param appointment_notification_minutes [Integer, nil] Appointment notification in minutes.
31
41
  # @return [Eeprom] Eeprom instance.
32
- def initialize(appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification: APPOINTMENT_NO_NOTIFICATION)
42
+ def initialize(
43
+ appointments: [], anniversaries: [], phone_numbers: [], lists: [], appointment_notification_minutes: nil
44
+ )
33
45
  @appointments = appointments
34
46
  @anniversaries = anniversaries
35
47
  @phone_numbers = phone_numbers
36
48
  @lists = lists
37
- @appointment_notification = appointment_notification
49
+ @appointment_notification_minutes = appointment_notification_minutes
38
50
  end
39
51
 
40
52
  # Compile packets for EEPROM data.
41
53
  #
54
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
42
55
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
43
56
  def packets
57
+ validate!
58
+
44
59
  [CPACKET_CLEAR, header] + payloads + [CPACKET_END]
45
60
  end
46
61
 
@@ -53,7 +68,7 @@ class TimexDatalinkClient
53
68
  items_addresses,
54
69
  items_lengths,
55
70
  earliest_appointment_year,
56
- appointment_notification
71
+ appointment_notification_minutes_value
57
72
  ].flatten
58
73
  end
59
74
 
@@ -90,6 +105,12 @@ class TimexDatalinkClient
90
105
 
91
106
  earliest_appointment.time.year % 100
92
107
  end
108
+
109
+ def appointment_notification_minutes_value
110
+ return APPOINTMENT_NO_NOTIFICATION unless appointment_notification_minutes
111
+
112
+ appointment_notification_minutes / 5
113
+ end
93
114
  end
94
115
  end
95
116
  end
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol4
8
10
  class Time
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -20,6 +23,16 @@ class TimexDatalinkClient
20
23
  "%y.%m.%d" => 6
21
24
  }.freeze
22
25
 
26
+ validates :zone, inclusion: {
27
+ in: 1..2,
28
+ message: "%{value} is invalid! Valid zones are 1..2."
29
+ }
30
+
31
+ validates :date_format, inclusion: {
32
+ in: DATE_FORMAT_MAP.keys,
33
+ message: "%{value} is invalid! Valid date formats are #{DATE_FORMAT_MAP.keys}."
34
+ }
35
+
23
36
  attr_accessor :zone, :is_24h, :date_format, :time
24
37
 
25
38
  # Create a Time instance.
@@ -41,8 +54,11 @@ class TimexDatalinkClient
41
54
 
42
55
  # Compile packets for a time.
43
56
  #
57
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
44
58
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
45
59
  def packets
60
+ validate!
61
+
46
62
  [
47
63
  [
48
64
  CPACKET_TIME,
@@ -1,10 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "timex_datalink_client/helpers/lsb_msb_formatter"
4
+
3
5
  class TimexDatalinkClient
4
6
  class Protocol7
5
7
  class Eeprom
6
8
  class Calendar
7
9
  class Event
10
+ include Helpers::LsbMsbFormatter
11
+
8
12
  FIVE_MINUTES_SECONDS = 300
9
13
 
10
14
  attr_accessor :time, :phrase
@@ -24,7 +28,7 @@ class TimexDatalinkClient
24
28
  seconds = (time - device_time_midnight).to_i
25
29
  five_minutes = seconds / FIVE_MINUTES_SECONDS
26
30
 
27
- five_minutes.divmod(256).reverse
31
+ lsb_msb_format_for(five_minutes)
28
32
  end
29
33
  end
30
34
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "timex_datalink_client/helpers/four_byte_formatter"
4
+ require "timex_datalink_client/helpers/lsb_msb_formatter"
4
5
 
5
6
  class TimexDatalinkClient
6
7
  class Protocol7
7
8
  class Eeprom
8
9
  class Calendar
9
10
  include Helpers::FourByteFormatter
11
+ include Helpers::LsbMsbFormatter
10
12
 
11
13
  DAY_START_TIME = Time.new(2000)
12
14
  DAY_SECONDS = 86400
@@ -48,7 +50,7 @@ class TimexDatalinkClient
48
50
  private
49
51
 
50
52
  def events_count
51
- events.count.divmod(256).reverse
53
+ lsb_msb_format_for(events.count)
52
54
  end
53
55
 
54
56
  def event_packets
@@ -57,7 +59,7 @@ class TimexDatalinkClient
57
59
 
58
60
  [].tap do |event_packets|
59
61
  events.each_with_index do |event, event_index|
60
- event_bytes_formatted = event_bytes.divmod(256).reverse
62
+ event_bytes_formatted = lsb_msb_format_for(event_bytes)
61
63
  event_time_formatted = event.time_formatted(time)
62
64
 
63
65
  event_packets << [event_time_formatted, event_bytes_formatted]
@@ -77,13 +79,13 @@ class TimexDatalinkClient
77
79
  since_start_time_seconds = time - DAY_START_TIME
78
80
  since_start_time_days = since_start_time_seconds.to_i / DAY_SECONDS
79
81
 
80
- since_start_time_days.divmod(256).reverse
82
+ lsb_msb_format_for(since_start_time_days)
81
83
  end
82
84
 
83
85
  def time_formatted
84
86
  five_mintes = (time.hour * 60 + time.min) / 5
85
87
 
86
- five_mintes.divmod(256).reverse
88
+ lsb_msb_format_for(five_mintes)
87
89
  end
88
90
  end
89
91
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "timex_datalink_client/helpers/four_byte_formatter"
4
+ require "timex_datalink_client/helpers/lsb_msb_formatter"
4
5
 
5
6
  class TimexDatalinkClient
6
7
  class Protocol7
7
8
  class Eeprom
8
9
  class Games
9
10
  include Helpers::FourByteFormatter
11
+ include Helpers::LsbMsbFormatter
10
12
 
11
13
  COUNTDOWN_TIMER_SECONDS_DEFAULT = 60
12
14
 
@@ -85,11 +87,11 @@ class TimexDatalinkClient
85
87
  game ? 1 << game_index : 0
86
88
  end
87
89
 
88
- bitmask.divmod(256).reverse
90
+ lsb_msb_format_for(bitmask)
89
91
  end
90
92
 
91
93
  def countdown_timer_time
92
- (countdown_timer_seconds * 10).divmod(256).reverse
94
+ lsb_msb_format_for(countdown_timer_seconds * 10)
93
95
  end
94
96
 
95
97
  def sounds
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "timex_datalink_client/helpers/four_byte_formatter"
4
+ require "timex_datalink_client/helpers/lsb_msb_formatter"
4
5
 
5
6
  class TimexDatalinkClient
6
7
  class Protocol7
7
8
  class Eeprom
8
9
  class Speech
9
10
  include Helpers::FourByteFormatter
11
+ include Helpers::LsbMsbFormatter
10
12
 
11
13
  NICKNAME_LENGTH_WITHOUT_DEVICE = 10
12
14
  NICKNAME_LENGTH_WITH_DEVICE = 14
@@ -123,7 +125,7 @@ class TimexDatalinkClient
123
125
  def header
124
126
  all_values = [header_value_1, header_value_2, header_value_3] + header_values_4 + header_values_5
125
127
 
126
- all_values.flat_map { |value| value.divmod(256).reverse }
128
+ all_values.flat_map { |value| lsb_msb_format_for(value) }
127
129
  end
128
130
 
129
131
  def header_value_1
@@ -153,7 +155,10 @@ class TimexDatalinkClient
153
155
  value_4_length = device_nickname.any? ? NICKNAME_LENGTH_WITH_DEVICE : NICKNAME_LENGTH_WITHOUT_DEVICE
154
156
 
155
157
  value_4_length.times.flat_map do |value_4_index|
156
- device_value = HEADER_VALUE_4_DEVICE_INDEXES[value_4_index].sum { |device_index| packet_lengths[device_index] }
158
+ device_value = HEADER_VALUE_4_DEVICE_INDEXES[value_4_index].sum do |device_index|
159
+ packet_lengths[device_index]
160
+ end
161
+
157
162
  device_value *= HEADER_VALUE_4_DEVICE_MULTIPLIERS[value_4_index]
158
163
 
159
164
  user_value = HEADER_VALUE_4_USER_INDEXES[value_4_index].sum { |device_index| packet_lengths[device_index] }
@@ -9,9 +9,6 @@ class TimexDatalinkClient
9
9
  include Helpers::CpacketPaginator
10
10
  prepend Helpers::CrcPacketsWrapper
11
11
 
12
- # FIXME use arrays for array models
13
- # FIXME: check Array<Integer> yardoc around places
14
-
15
12
  CPACKET_SECT = [0x90, 0x05]
16
13
  CPACKET_DATA = [0x91, 0x05]
17
14
  CPACKET_END = [0x92, 0x05]
@@ -1,18 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol9
8
10
  class Alarm
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
12
15
  CPACKET_ALARM = [0x50]
13
16
 
17
+ VALID_DAYS_IN_MONTH = {
18
+ 1 => 1..31,
19
+ 2 => 1..29,
20
+ 3 => 1..31,
21
+ 4 => 1..30,
22
+ 5 => 1..31,
23
+ 6 => 1..30,
24
+ 7 => 1..31,
25
+ 8 => 1..31,
26
+ 9 => 1..30,
27
+ 10 => 1..31,
28
+ 11 => 1..30,
29
+ 12 => 1..31
30
+ }.freeze
31
+
14
32
  attr_accessor :number, :audible, :time, :message, :month, :day
15
33
 
34
+ validates :number, inclusion: {
35
+ in: 1..10,
36
+ message: "value %{value} is invalid! Valid number values are 1..10."
37
+ }
38
+
39
+ validates :month, inclusion: {
40
+ in: 1..12,
41
+ allow_nil: true,
42
+ message: "%{value} is invalid! Valid months are 1..12 and nil."
43
+ }
44
+
45
+ validates :day, inclusion: {
46
+ if: ->(alarm) { alarm.month.nil? },
47
+ in: 1..31,
48
+ allow_nil: true,
49
+ message: "%{value} is invalid! Valid days are 1..31 and nil."
50
+ }
51
+
52
+ validates :day, inclusion: {
53
+ if: ->(alarm) { alarm.day && alarm.month },
54
+ in: ->(alarm) { VALID_DAYS_IN_MONTH[alarm.month] },
55
+ message: ->(alarm, _attributes) do
56
+ "#{alarm.day} is invalid for month #{alarm.month}! " \
57
+ "Valid days are #{VALID_DAYS_IN_MONTH[alarm.month]} and nil when month is #{alarm.month}."
58
+ end
59
+ }
60
+
16
61
  # Create an Alarm instance.
17
62
  #
18
63
  # @param number [Integer] Alarm number (from 1 to 10).
@@ -33,8 +78,11 @@ class TimexDatalinkClient
33
78
 
34
79
  # Compile packets for an alarm.
35
80
  #
81
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
36
82
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
37
83
  def packets
84
+ validate!
85
+
38
86
  [
39
87
  [
40
88
  CPACKET_ALARM,
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
 
5
7
  class TimexDatalinkClient
6
8
  class Protocol9
7
9
  class Eeprom
8
10
  class Chrono
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
 
11
14
  CHRONO_LABEL_LENGTH = 8
@@ -13,6 +16,11 @@ class TimexDatalinkClient
13
16
 
14
17
  attr_accessor :label, :laps
15
18
 
19
+ validates :laps, inclusion: {
20
+ in: 2..50,
21
+ message: "value %{value} is invalid! Valid laps values are 2..50."
22
+ }
23
+
16
24
  # Create a Chrono instance.
17
25
  #
18
26
  # @param label [String] Label for chrono.
@@ -25,8 +33,11 @@ class TimexDatalinkClient
25
33
 
26
34
  # Compile a packet for a chrono.
27
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
28
37
  # @return [Array<Integer>] Array of integers that represent bytes.
29
38
  def packet
39
+ validate!
40
+
30
41
  label_characters
31
42
  end
32
43
 
@@ -1,16 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/crc_packets_wrapper"
4
6
 
5
7
  class TimexDatalinkClient
6
8
  class Protocol9
7
9
  class Time
10
+ include ActiveModel::Validations
8
11
  prepend Helpers::CrcPacketsWrapper
9
12
 
10
13
  CPACKET_TIME = [0x30]
11
14
 
12
15
  attr_accessor :zone, :is_24h, :time
13
16
 
17
+ validates :zone, inclusion: {
18
+ in: 1..2,
19
+ message: "%{value} is invalid! Valid zones are 1..2."
20
+ }
21
+
14
22
  # Create a Time instance.
15
23
  #
16
24
  # @param zone [Integer] Time zone number (1 or 2).
@@ -25,8 +33,11 @@ class TimexDatalinkClient
25
33
 
26
34
  # Compile packets for a time.
27
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
28
37
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
29
38
  def packets
39
+ validate!
40
+
30
41
  [
31
42
  [
32
43
  CPACKET_TIME,
@@ -1,11 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_model"
4
+
3
5
  require "timex_datalink_client/helpers/char_encoders"
4
6
  require "timex_datalink_client/helpers/crc_packets_wrapper"
5
7
 
6
8
  class TimexDatalinkClient
7
9
  class Protocol9
8
10
  class TimeName
11
+ include ActiveModel::Validations
9
12
  include Helpers::CharEncoders
10
13
  prepend Helpers::CrcPacketsWrapper
11
14
 
@@ -13,6 +16,11 @@ class TimexDatalinkClient
13
16
 
14
17
  attr_accessor :zone, :name
15
18
 
19
+ validates :zone, inclusion: {
20
+ in: 1..2,
21
+ message: "%{value} is invalid! Valid zones are 1..2."
22
+ }
23
+
16
24
  # Create a TimeName instance.
17
25
  #
18
26
  # @param zone [Integer] Time zone number (1 or 2).
@@ -25,8 +33,11 @@ class TimexDatalinkClient
25
33
 
26
34
  # Compile packets for a time name.
27
35
  #
36
+ # @raise [ActiveModel::ValidationError] One or more model values are invalid.
28
37
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
29
38
  def packets
39
+ validate!
40
+
30
41
  [
31
42
  [
32
43
  CPACKET_NAME,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class TimexDatalinkClient
4
- VERSION = "0.9.0"
4
+ VERSION = "0.11.0"
5
5
  end
@@ -104,17 +104,17 @@ class TimexDatalinkClient
104
104
  #
105
105
  # @return [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
106
106
  def packets
107
- models.map(&:packets).flatten(1)
107
+ models.flat_map(&:packets)
108
108
  end
109
109
 
110
110
  private
111
111
 
112
112
  def notebook_adapter
113
113
  @notebook_adapter ||= NotebookAdapter.new(
114
- serial_device: serial_device,
115
- byte_sleep: byte_sleep,
116
- packet_sleep: packet_sleep,
117
- verbose: verbose
114
+ serial_device:,
115
+ byte_sleep:,
116
+ packet_sleep:,
117
+ verbose:
118
118
  )
119
119
  end
120
120
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timex_datalink_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.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-12-23 00:00:00.000000000 Z
11
+ date: 2022-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 7.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.4
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: crc
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +38,20 @@ dependencies:
24
38
  - - "~>"
25
39
  - !ruby/object:Gem::Version
26
40
  version: 0.4.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: mdb
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.5.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.0
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rubyserial
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -39,19 +67,19 @@ dependencies:
39
67
  - !ruby/object:Gem::Version
40
68
  version: 0.6.0
41
69
  - !ruby/object:Gem::Dependency
42
- name: mdb
70
+ name: mdl
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: 0.5.0
48
- type: :runtime
75
+ version: 0.12.0
76
+ type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: 0.5.0
82
+ version: 0.12.0
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rspec
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +94,34 @@ dependencies:
66
94
  - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: 3.11.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.41.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.41.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-github
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.20.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.20.0
69
125
  - !ruby/object:Gem::Dependency
70
126
  name: tzinfo
71
127
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +162,7 @@ files:
106
162
  - lib/timex_datalink_client/helpers/crc_packets_wrapper.rb
107
163
  - lib/timex_datalink_client/helpers/four_byte_formatter.rb
108
164
  - lib/timex_datalink_client/helpers/length_packet_wrapper.rb
165
+ - lib/timex_datalink_client/helpers/lsb_msb_formatter.rb
109
166
  - lib/timex_datalink_client/notebook_adapter.rb
110
167
  - lib/timex_datalink_client/protocol_1/alarm.rb
111
168
  - lib/timex_datalink_client/protocol_1/eeprom.rb
@@ -167,7 +224,7 @@ files:
167
224
  - lib/timex_datalink_client/protocol_9/time_name.rb
168
225
  - lib/timex_datalink_client/protocol_9/timer.rb
169
226
  - lib/timex_datalink_client/version.rb
170
- homepage: https://github.com/synthead/timex_datalink_client/tree/v0.9.0
227
+ homepage: https://github.com/synthead/timex_datalink_client/tree/v0.11.0
171
228
  licenses:
172
229
  - MIT
173
230
  metadata: {}