timex_datalink_client 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e16031b6fb7be30fcf5e298caff20e113ecd967a50e1e17ea91c4b2481024df
|
4
|
+
data.tar.gz: ba659cd2a69837466c6d7941dd8f7e8a9f9fecd9b0cd9cdfafebcc05b4e8bc93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0f3d7c37ded477f631813a1f09f0c069ca55c54432b292a5a60bd73a6cd37c3f0983b6236ac062215445ba34583d3ac31aa5c779cd66572f422bd0f99bc6942
|
7
|
+
data.tar.gz: be703b74bc4fa90993fcf8bcc81ec978b6022b9e6846a347c491d8750de36269e42d4fbf4994150ec59ec9ef7e0d805086459a1d07263bde82e5afab1e6419be
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "uart"
|
4
4
|
|
5
5
|
class TimexDatalinkClient
|
6
6
|
class NotebookAdapter
|
@@ -28,25 +28,21 @@ class TimexDatalinkClient
|
|
28
28
|
# @param packets [Array<Array<Integer>>] Two-dimensional array of integers that represent bytes.
|
29
29
|
# @return [void]
|
30
30
|
def write(packets)
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
UART.open(serial_device) do |serial_port|
|
32
|
+
packets.each do |packet|
|
33
|
+
packet.each do |byte|
|
34
|
+
printf("%.2X ", byte) if verbose
|
34
35
|
|
35
|
-
|
36
|
+
serial_port.write(byte.chr)
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
sleep(byte_sleep)
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
+
sleep(packet_sleep)
|
41
42
|
|
42
|
-
|
43
|
+
puts if verbose
|
44
|
+
end
|
43
45
|
end
|
44
46
|
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def serial_port
|
49
|
-
@serial_port ||= SerialPort.new(serial_device)
|
50
|
-
end
|
51
47
|
end
|
52
48
|
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/lsb_msb_formatter"
|
4
6
|
|
5
7
|
class TimexDatalinkClient
|
@@ -7,16 +9,23 @@ class TimexDatalinkClient
|
|
7
9
|
class Eeprom
|
8
10
|
class Calendar
|
9
11
|
class Event
|
12
|
+
include ActiveModel::Validations
|
10
13
|
include Helpers::LsbMsbFormatter
|
11
14
|
|
12
15
|
FIVE_MINUTES_SECONDS = 300
|
13
16
|
|
14
|
-
|
17
|
+
validates :time, comparison: {
|
18
|
+
greater_than_or_equal_to: :device_time,
|
19
|
+
message: "%{value} must be greater or equal to device time!"
|
20
|
+
}
|
21
|
+
|
22
|
+
attr_accessor :time, :phrase, :device_time
|
15
23
|
|
16
24
|
# Create an Event instance.
|
17
25
|
#
|
18
26
|
# @param time [::Time] Time of event.
|
19
27
|
# @param phrase [Array<Integer>] Phrase for event.
|
28
|
+
# @raise [ActiveModel::ValidationError] One or more model values are invalid.
|
20
29
|
# @return [Event] Event instance.
|
21
30
|
def initialize(time:, phrase:)
|
22
31
|
@time = time
|
@@ -24,6 +33,10 @@ class TimexDatalinkClient
|
|
24
33
|
end
|
25
34
|
|
26
35
|
def time_formatted(device_time)
|
36
|
+
@device_time = device_time
|
37
|
+
|
38
|
+
validate!
|
39
|
+
|
27
40
|
device_time_midnight = Time.new(device_time.year, device_time.month, device_time.day)
|
28
41
|
seconds = (time - device_time_midnight).to_i
|
29
42
|
five_minutes = seconds / FIVE_MINUTES_SECONDS
|
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.12.
|
4
|
+
version: 0.12.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxwell Pray
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.5.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: uart
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.
|
68
|
+
version: 1.0.0
|
69
69
|
description:
|
70
70
|
email: synthead@gmail.com
|
71
71
|
executables: []
|
@@ -150,7 +150,7 @@ files:
|
|
150
150
|
- lib/timex_datalink_client/protocol_9/time_name.rb
|
151
151
|
- lib/timex_datalink_client/protocol_9/timer.rb
|
152
152
|
- lib/timex_datalink_client/version.rb
|
153
|
-
homepage: https://github.com/synthead/timex_datalink_client/tree/v0.12.
|
153
|
+
homepage: https://github.com/synthead/timex_datalink_client/tree/v0.12.4
|
154
154
|
licenses:
|
155
155
|
- MIT
|
156
156
|
metadata: {}
|
@@ -162,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
162
|
requirements:
|
163
163
|
- - ">="
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: 3.1.0
|
166
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
167
|
requirements:
|
168
168
|
- - ">="
|