Class: GPSTool::Devices::RBT2300::Message
- Defined in:
- lib/gpstool/devices/rbt-2300.rb
Constant Summary collapse
- @@messages =
{ "LOG101" => [:date, :mode, :frames, :pointer], "LOG102" => [:data], "LOG108" => [:mode, nil, nil, :overwrite, nil, :rate, nil, :files, nil] }
Instance Attribute Summary
Attributes inherited from Message
Class Method Summary collapse
Methods inherited from Message
#[], checksum, checksum_hex, #initialize, parse, read, #structure, #to_hash, #to_s, validate
Constructor Details
This class inherits a constructor from GPSTool::Message
Class Method Details
.read_body(io, name, options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/gpstool/devices/rbt-2300.rb', line 21 def self.read_body(io, name, ) if (name == "LOG102") buffer = '$' + name buffer += io.readbytes(1) header_data = io.readbytes(3) buffer += header_data if header_data[0,2] == "0*" # This is sometimes a response when # an invalid segment is requested buffer += io.gets self.validate(buffer) return self.new([name, nil]) else header = header_data.unpack("CCC") # Frame count is in bytes data_size = header[2] data = io.readbytes(data_size) buffer += data buffer += io.gets # Check that the data was correct self.validate(buffer) return self.new([name, header_data + data]) end else return super(io, name, ) end end |