Class: SerialCanBus::ISOTP::Single

Inherits:
BitStruct
  • Object
show all
Defined in:
lib/serial_can_bus/iso-tp.rb

Overview

Single frame

Instance Method Summary collapse

Instance Method Details

#dataObject

:attr_accessor: data frame data (binary)


27
# File 'lib/serial_can_bus/iso-tp.rb', line 27

rest     :data

#dlengthObject

:attr_accessor: dlength data length (Fixnum, 4 bits)


22
# File 'lib/serial_can_bus/iso-tp.rb', line 22

unsigned :dlength, 4, 'data length'

#errorsObject


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/serial_can_bus/iso-tp.rb', line 29

def errors
  errors = []

  unless (0..7).include?(dlength)
    errors << "invalid length (#{dlength} != 0-7)"
  end

  if data.size > 7
    errors << "excessive data length (#{data.size} > 7)"
  end

  errors
end