balboa_worldwide_app 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bwa/client.rb +8 -3
- data/lib/bwa/message.rb +21 -8
- data/lib/bwa/messages/configuration.rb +1 -1
- data/lib/bwa/messages/configuration_request.rb +1 -1
- data/lib/bwa/messages/control_configuration.rb +2 -6
- data/lib/bwa/messages/control_configuration_request.rb +1 -1
- data/lib/bwa/messages/filter_cycles.rb +1 -1
- data/lib/bwa/messages/ready.rb +1 -1
- data/lib/bwa/messages/set_temperature_scale.rb +1 -1
- data/lib/bwa/messages/status.rb +2 -1
- data/lib/bwa/messages/toggle_item.rb +3 -1
- data/lib/bwa/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a309cfe60e168cb56a8a95ebdc80c6107428f4a700fc279889f6e27443a6c6f3
|
4
|
+
data.tar.gz: 9fcb57e4ea84ea69936eac347256df08af2bb0550efba9933487f7234160b8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97e1def1e19e8beb851d8a2db516720d3732fc05d36d8ac61b1f2c77c1c62db2b9b5f9aebf9516a2a881ba15f29c0740d94cd7dedcae9d207ca31717e562587c
|
7
|
+
data.tar.gz: 236c323cc0fe8e108eb4099ae19a86f9389f5a5b6aa92d0bb89f77ff5f244cbcf9130c6d24631e460ac445fe604e1ac86f470499e886ac29f5b8dd21e1dd58d2
|
data/lib/bwa/client.rb
CHANGED
@@ -25,10 +25,15 @@ module BWA
|
|
25
25
|
message = bytes_read = nil
|
26
26
|
loop do
|
27
27
|
message, bytes_read = Message.parse(@buffer)
|
28
|
-
|
29
|
-
|
28
|
+
# discard how much we read
|
29
|
+
@buffer = @buffer[bytes_read..-1] if bytes_read
|
30
30
|
unless message
|
31
|
-
|
31
|
+
begin
|
32
|
+
@buffer.concat(@io.readpartial(64 * 1024))
|
33
|
+
rescue EOFError
|
34
|
+
@io.wait_readable
|
35
|
+
retry
|
36
|
+
end
|
32
37
|
next
|
33
38
|
end
|
34
39
|
break
|
data/lib/bwa/message.rb
CHANGED
@@ -11,6 +11,9 @@ module BWA
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Message
|
14
|
+
class Unrecognized < Message
|
15
|
+
end
|
16
|
+
|
14
17
|
class << self
|
15
18
|
def inherited(klass)
|
16
19
|
@messages ||= []
|
@@ -42,21 +45,26 @@ module BWA
|
|
42
45
|
puts "discarding invalid data prior to message #{data[0...offset].unpack('H*').first}" unless offset == 0
|
43
46
|
#puts "read #{data.slice(offset, length + 2).unpack('H*').first}"
|
44
47
|
|
45
|
-
|
48
|
+
src = data[offset + 2].ord
|
49
|
+
message_type = data.slice(offset + 3, 2)
|
46
50
|
klass = @messages.find { |k| k::MESSAGE_TYPE == message_type }
|
47
51
|
|
48
52
|
|
49
53
|
return [nil, offset + length + 2] if [
|
50
|
-
"\
|
51
|
-
"\
|
52
|
-
"\
|
54
|
+
"\xbf\x00".force_encoding(Encoding::ASCII_8BIT),
|
55
|
+
"\xbf\xe1".force_encoding(Encoding::ASCII_8BIT),
|
56
|
+
"\xbf\x07".force_encoding(Encoding::ASCII_8BIT)].include?(message_type)
|
53
57
|
|
54
|
-
|
55
|
-
|
58
|
+
if klass
|
59
|
+
raise InvalidMessage.new("Unrecognized data length (#{length}) for message #{klass}", data) unless length - 5 == klass::MESSAGE_LENGTH
|
60
|
+
else
|
61
|
+
klass = Unrecognized
|
62
|
+
end
|
56
63
|
|
57
64
|
message = klass.new
|
58
65
|
message.parse(data.slice(offset + 5, length - 5))
|
59
66
|
message.instance_variable_set(:@raw_data, data.slice(offset, length + 2))
|
67
|
+
message.instance_variable_set(:@src, src)
|
60
68
|
[message, offset + length + 2]
|
61
69
|
end
|
62
70
|
|
@@ -76,14 +84,19 @@ module BWA
|
|
76
84
|
end
|
77
85
|
end
|
78
86
|
|
79
|
-
attr_reader :raw_data
|
87
|
+
attr_reader :raw_data, :src
|
88
|
+
|
89
|
+
def initialize
|
90
|
+
# most messages we're sending come from this address
|
91
|
+
@src = 0x0a
|
92
|
+
end
|
80
93
|
|
81
94
|
def parse(_data)
|
82
95
|
end
|
83
96
|
|
84
97
|
def serialize(message = "")
|
85
98
|
length = message.length + 5
|
86
|
-
full_message = "#{length.chr}#{self.class::MESSAGE_TYPE}#{message}".force_encoding(Encoding::ASCII_8BIT)
|
99
|
+
full_message = "#{length.chr}#{src.chr}#{self.class::MESSAGE_TYPE}#{message}".force_encoding(Encoding::ASCII_8BIT)
|
87
100
|
checksum = CRC.checksum(full_message)
|
88
101
|
"\x7e#{full_message}#{checksum.chr}\x7e".force_encoding(Encoding::ASCII_8BIT)
|
89
102
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BWA
|
2
2
|
module Messages
|
3
3
|
class ControlConfiguration < Message
|
4
|
-
MESSAGE_TYPE = "\
|
4
|
+
MESSAGE_TYPE = "\xbf\x24".force_encoding(Encoding::ASCII_8BIT)
|
5
5
|
MESSAGE_LENGTH = 21
|
6
6
|
|
7
7
|
attr_accessor :model, :version
|
@@ -20,13 +20,9 @@ module BWA
|
|
20
20
|
"#<BWA::Messages::ControlConfiguration #{model} #{version}>"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
end
|
24
|
-
end
|
25
23
|
|
26
|
-
module BWA
|
27
|
-
module Messages
|
28
24
|
class ControlConfiguration2 < Message
|
29
|
-
MESSAGE_TYPE = "\
|
25
|
+
MESSAGE_TYPE = "\xbf\x2e".force_encoding(Encoding::ASCII_8BIT)
|
30
26
|
MESSAGE_LENGTH = 6
|
31
27
|
|
32
28
|
attr_accessor :pumps, :lights, :circ_pump, :blower, :mister, :aux
|
@@ -5,7 +5,7 @@ module BWA
|
|
5
5
|
:filter2_enabled,
|
6
6
|
:filter2_hour, :filter2_minute, :filter2_duration_hours, :filter2_duration_minutes
|
7
7
|
|
8
|
-
MESSAGE_TYPE = "\
|
8
|
+
MESSAGE_TYPE = "\xbf\x23".force_encoding(Encoding::ASCII_8BIT)
|
9
9
|
MESSAGE_LENGTH = 8
|
10
10
|
|
11
11
|
def parse(data)
|
data/lib/bwa/messages/ready.rb
CHANGED
data/lib/bwa/messages/status.rb
CHANGED
@@ -17,10 +17,11 @@ module BWA
|
|
17
17
|
:aux,
|
18
18
|
:current_temperature, :set_temperature
|
19
19
|
|
20
|
-
MESSAGE_TYPE = "\
|
20
|
+
MESSAGE_TYPE = "\xaf\x13".force_encoding(Encoding::ASCII_8BIT)
|
21
21
|
MESSAGE_LENGTH = 24
|
22
22
|
|
23
23
|
def initialize
|
24
|
+
@src = 0xff
|
24
25
|
self.priming = false
|
25
26
|
self.heating_mode = :ready
|
26
27
|
@temperature_scale = :fahrenheit
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BWA
|
2
2
|
module Messages
|
3
3
|
class ToggleItem < Message
|
4
|
-
MESSAGE_TYPE = "\
|
4
|
+
MESSAGE_TYPE = "\xbf\x11".force_encoding(Encoding::ASCII_8BIT)
|
5
5
|
MESSAGE_LENGTH = 2
|
6
6
|
|
7
7
|
attr_accessor :item
|
@@ -15,8 +15,10 @@ module BWA
|
|
15
15
|
when 0x04; :pump1
|
16
16
|
when 0x05; :pump2
|
17
17
|
when 0x11; :light1
|
18
|
+
when 0x3c; :hold
|
18
19
|
when 0x50; :temperature_range
|
19
20
|
when 0x51; :heating_mode
|
21
|
+
else; data[0].ord
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
data/lib/bwa/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module BWA
|
2
|
-
VERSION = '1.1.
|
3
|
-
end
|
2
|
+
VERSION = '1.1.1'
|
3
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balboa_worldwide_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Cutrer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: digest-crc
|