class Rplidar::DeviceInfoDataResponse

RPLIDAR will send out its device information: model, firmware version, hardware version, serial number.

Public Instance Methods

firmware() click to toggle source
# File lib/rplidar/device_info_data_response.rb, line 20
def firmware
  "#{firmware_major}.#{firmware_minor}"
end
firmware_major() click to toggle source

Firmware version number, the major value part.

# File lib/rplidar/device_info_data_response.rb, line 16
def firmware_major
  raw_response[2]
end
firmware_minor() click to toggle source

Firmware version number, the minor value part.

# File lib/rplidar/device_info_data_response.rb, line 11
def firmware_minor
  raw_response[1]
end
hardware() click to toggle source

Hardware version number.

# File lib/rplidar/device_info_data_response.rb, line 25
def hardware
  raw_response[3]
end
model() click to toggle source

RPLIDAR model ID.

# File lib/rplidar/device_info_data_response.rb, line 6
def model
  raw_response[0]
end
response() click to toggle source
# File lib/rplidar/device_info_data_response.rb, line 35
def response
  {
    model: model, firmware: firmware,
    hardware: hardware, serial_number: serial_number
  }
end
serial_number() click to toggle source

128bit unique serial number. When converting to text in hex, the Least Significant Byte prints first.

# File lib/rplidar/device_info_data_response.rb, line 31
def serial_number
  raw_response[4..-1].pack('c*').unpack('H*').first.upcase
end