Class: McProtocolE::Frame1e::BatchReadInWord

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mc_protocol_e/frame_1e/batch_read_in_word.rb

Overview

This class shows a command to batch read in word.

Constant Summary collapse

REQUEST_HEADER =
"\x01".b
RESPONSE_HEADER =
"\x81".b

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(device_range:) ⇒ BatchReadInWord

Constructor.

Parameters:



19
20
21
22
# File 'lib/mc_protocol_e/frame_1e/batch_read_in_word.rb', line 19

def initialize(device_range:)
  @request_header = REQUEST_HEADER
  @device_range = device_range
end

Instance Attribute Details

#request_headerObject (readonly)

Returns the value of attribute request_header.



14
15
16
# File 'lib/mc_protocol_e/frame_1e/batch_read_in_word.rb', line 14

def request_header
  @request_header
end

Instance Method Details

#parse(res) ⇒ Object

Returns array of word. @return array of word

Parameters:



27
28
29
# File 'lib/mc_protocol_e/frame_1e/batch_read_in_word.rb', line 27

def parse(res)
  res.data&.each_char&.each_slice(2)&.map(&:join)
end