sappho-heatmiser-proxy 0.0.4 → 0.0.5

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.
@@ -29,12 +29,20 @@ module Sappho
29
29
  begin
30
30
  timeout 20 do
31
31
  command = read 5
32
- @log.debug "header: #{TraceLog.hex command}" if @log.debug?
33
- packetSize = (command[1] & 0xFF) | ((command[2] << 8) & 0x0F00)
34
- command += read(packetSize - 5)
35
- CommandQueue.instance.push @ip, command unless (command[0] & 0xFF) == 0x93
36
- @status.get { @client.write @status.raw.pack('c*') if @status.valid }
37
- @log.info "command received from client #{@ip} so it is alive"
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"
@@ -7,7 +7,7 @@ module Sappho
7
7
  module Heatmiser
8
8
  module Proxy
9
9
  NAME = "sappho-heatmiser-proxy"
10
- VERSION = "0.0.4"
10
+ VERSION = "0.0.5"
11
11
  AUTHORS = ["Andrew Heald"]
12
12
  EMAILS = ["andrew@heald.co.uk"]
13
13
  HOMEPAGE = "https://github.com/sappho/sappho-heatmiser-proxy/wiki"
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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-28 00:00:00 Z
18
+ date: 2012-02-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake