Class: McProtocolE::Frame1e::BatchReadInWord
- Inherits:
-
Object
- Object
- McProtocolE::Frame1e::BatchReadInWord
- 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
-
#request_header ⇒ Object
readonly
Returns the value of attribute request_header.
Instance Method Summary collapse
-
#initialize(device_range:) ⇒ BatchReadInWord
constructor
Constructor.
-
#parse(res) ⇒ Object
Returns array of word.
Constructor Details
#initialize(device_range:) ⇒ BatchReadInWord
Constructor.
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_header ⇒ Object (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
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 |