class Rplidar::CurrentStateDataResponse

Implementation of response to the GET_HEALTH request.

Public Instance Methods

error_code() click to toggle source
# File lib/rplidar/current_state_data_response.rb, line 12
def error_code
  (raw_response[2] << 8) + raw_response[1]
end
response() click to toggle source
# File lib/rplidar/current_state_data_response.rb, line 4
def response
  case raw_response[0]
  when STATE_GOOD    then { state: :good,    error_code: error_code }
  when STATE_WARNING then { state: :warning, error_code: error_code }
  when STATE_ERROR   then { state: :error,   error_code: error_code }
  end
end