sappho-heatmiser-proxy 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -29,12 +29,20 @@ module Sappho
|
|
29
29
|
begin
|
30
30
|
timeout 20 do
|
31
31
|
command = read 5
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
32
|
+
if command == 'check'
|
33
|
+
@client.write @status.get {
|
34
|
+
@status.timeSinceLastValid > 60 ?
|
35
|
+
'error: no response from heatmiser unit in last minute' :
|
36
|
+
@status.valid ? 'ok' : 'error: last response from heatmiser unit was invalid'
|
37
|
+
}
|
38
|
+
else
|
39
|
+
@log.debug "header: #{TraceLog.hex command}" if @log.debug?
|
40
|
+
packetSize = (command[1] & 0xFF) | ((command[2] << 8) & 0x0F00)
|
41
|
+
command += read(packetSize - 5)
|
42
|
+
CommandQueue.instance.push @ip, command unless (command[0] & 0xFF) == 0x93
|
43
|
+
@status.get { @client.write @status.raw.pack('c*') if @status.valid }
|
44
|
+
@log.info "command received from client #{@ip} so it is alive"
|
45
|
+
end
|
38
46
|
end
|
39
47
|
rescue Timeout::Error
|
40
48
|
@log.info "no command received from client #{@ip} so presuming it dormant"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sappho-heatmiser-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Heald
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-02-
|
18
|
+
date: 2012-02-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake
|