class LXP::Packet::WriteSingle

Public Class Methods

new() click to toggle source
Calls superclass method LXP::Packet::Base::new
# File lib/lxp/packet/write_single.rb, line 8
def initialize
  super

  self.tcp_function = TcpFunctions::TRANSLATED_DATA
  self.device_function = DeviceFunctions::WRITE_SINGLE
  self.data_length = 18
end

Public Instance Methods

discharge_cut_off=(value) click to toggle source
# File lib/lxp/packet/write_single.rb, line 21
def discharge_cut_off=(value)
  self.register = Registers::DISCHG_CUT_OFF_SOC_EOD
  self.value = value
end
discharge_rate=(value) click to toggle source
# File lib/lxp/packet/write_single.rb, line 16
def discharge_rate=(value)
  self.register = Registers::DISCHG_POWER_PERCENT_CMD
  self.value = value
end
value() click to toggle source

WriteSingle packets should always (I think) have two byte values.

Raise if not, as that is not expected?

# File lib/lxp/packet/write_single.rb, line 30
def value
  raise 'value_length not 2?' unless value_length == 2

  Utils.int(values[0, 2])
end