Class: LXP::Packet::ReadInput

Inherits:
Base
  • Object
show all
Defined in:
lib/lxp/packet/read_input.rb

Overview

Input packets are a stream of values related to energy flows (inputs?)

Direct Known Subclasses

ReadInput1, ReadInput2, ReadInput3

Instance Attribute Summary

Attributes inherited from Base

#chksum, #data, #header

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#bytes, #data_length, #data_length=, #datalog_serial, #datalog_serial=, #device_function, #device_function=, #inverter_serial, #inverter_serial=, #packet_length, #packet_length=, #protocol, #protocol=, #register, #register=, #tcp_function, #tcp_function=, #to_bin, #update_checksum, #value=, #value_length, #values

Constructor Details

#initialize ⇒ ReadInput

Returns a new instance of ReadInput.



9
10
11
12
13
14
15
16
# File 'lib/lxp/packet/read_input.rb', line 9

def initialize
  super

  self.tcp_function = TcpFunctions::TRANSLATED_DATA
  self.device_function = DeviceFunctions::READ_INPUT

  self.data_length = 18
end

Class Method Details

.parse(ascii) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/lxp/packet/read_input.rb', line 18

def self.parse(ascii)
  i = super

  if i.packet_length != 111 || i.data_length != 97
    raise 'unexpected packet length'
  end

  i
end