Class: MaxCube::Messages::UDP::Parser

Inherits:
Object
  • Object
show all
Includes:
Handler, Parser, MessageH, MessageI, MessageN
Defined in:
lib/maxcube/messages/udp/parser.rb,
lib/maxcube/messages/udp/type/h.rb,
lib/maxcube/messages/udp/type/i.rb,
lib/maxcube/messages/udp/type/n.rb

Defined Under Namespace

Modules: MessageH, MessageI, MessageN

Constant Summary collapse

KEYS =
i[prefix serial_number id].freeze
MSG_TYPES =
%w[I N h c].freeze
MSG_PREFIX =
(UDP::MSG_PREFIX + 'Ap').freeze

Constants included from MaxCube::Messages

DAYS_OF_WEEK, DEVICE_MODE, DEVICE_TYPE, PACK_FORMAT

Instance Method Summary collapse

Methods included from Parser

#parse_msg_body, #read

Methods included from Handler

#check_data_type, #check_hash, #check_hash_keys, #check_hash_msg_type, #check_hash_values, #check_msg, #check_msg_msg_type, #check_msg_type, #msg_type_hash_keys, #msg_type_hash_opt_keys, #valid_data_type, #valid_hash, #valid_hash_keys, #valid_hash_msg_type, #valid_hash_values, #valid_msg, #valid_msg_msg_type, #valid_msg_type

Instance Method Details

#parse_udp_msg(msg) ⇒ Object



23
24
25
26
27
28
# File 'lib/maxcube/messages/udp/parser.rb', line 23

def parse_udp_msg(msg)
  check_udp_msg(msg)
  hash = parse_udp_msg_head(msg)
  return hash unless parse_msg_body(@io.string, hash, 'udp')
  check_udp_hash(hash)
end