Class: SerialCanBus::ISOTP::First

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

Overview

First frame of multi-frame packet

Instance Method Summary collapse

Instance Method Details

#dataObject

:attr_accessor: data frame data (binary)


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

rest     :data

#dlengthObject

:attr_accessor: dlength total data length Fixnum, 12 bits)


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

unsigned :dlength, 12, 'total data length'

#errorsObject


59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/serial_can_bus/iso-tp.rb', line 59

def errors
  errors = []

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

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

  errors
end