Module: MaxCube::Messages::TCP::Parser::MessageS

Defined in:
lib/maxcube/messages/tcp/type/s.rb

Overview

Response to send command message.

Constant Summary

LENGTHS =
[2, 1, 2].freeze
KEYS =

Mandatory hash keys.

%i[
  duty_cycle
  command_processed
  free_memory_slots
].freeze

Instance Method Summary collapse

Instance Method Details

#parse_tcp_s(body) ⇒ Object (private)



19
20
21
22
23
24
25
26
# File 'lib/maxcube/messages/tcp/type/s.rb', line 19

def parse_tcp_s(body)
  values = body.split(',')
  check_msg_part_lengths(LENGTHS, *values)
  values = to_ints(16, 'duty cycle, command result,' \
                       ' free memory slots', *values)
  values[1] = values[1].zero?
  KEYS.zip(values).to_h
end