Class: ADAM6050::Handler::Status

Inherits:
Object
  • Object
show all
Includes:
ADAM6050::Handler
Defined in:
lib/adam6050/handler/status.rb

Overview

Allows registed senders to read the IO status.

I have so far not been able to find any documentation around this feature. The meaning of the rely is therefore currently unknown.

Constant Summary collapse

MESSAGE_PREAMBLE =

Returns see Handler::MESSAGE_PREAMBLE.

Returns:

  • (String)

    see Handler::MESSAGE_PREAMBLE.

'$01C'

Instance Method Summary collapse

Methods included from ADAM6050::Handler

#handles?, #validate?

Instance Method Details

#handle(msg, state) ⇒ Integer, String

Parameters:

  • msg (String)

    the incomming message.

  • state (Integer)

    the current state.

Returns:

  • (Integer)

    the next state (always unchanged).

  • (String)

    the reply.



19
20
21
22
23
24
25
26
27
28
# File 'lib/adam6050/handler/status.rb', line 19

def handle(msg, state, *)
  reply =
    if msg == MESSAGE_PREAMBLE + "\r"
      '!01' + '000000000000' + '000000000000' + '000000000000'
    else
      '>'
    end

  [state, reply]
end