Lines Matching refs:sensor
362 bool ContextHub::CalibrateSingleSensor(const SensorSpec& sensor) { in CalibrateSingleSensor() argument
366 req.config.sensor_type = static_cast<uint8_t>(sensor.sensor_type); in CalibrateSingleSensor()
370 LOGI("Issuing calibration request to sensor %d (%s)", sensor.sensor_type, in CalibrateSingleSensor()
371 ContextHub::SensorTypeToAbbrevName(sensor.sensor_type).c_str()); in CalibrateSingleSensor()
374 LOGE("Failed to calibrate sensor %d", sensor.sensor_type); in CalibrateSingleSensor()
379 auto cal_event_handler = [this, &sensor, &success](const AppToHostEvent &event) -> bool { in CalibrateSingleSensor()
380 if (event.IsCalibrationEventForSensor(sensor.sensor_type)) { in CalibrateSingleSensor()
381 success = HandleCalibrationResult(sensor, event); in CalibrateSingleSensor()
396 bool ContextHub::TestSingleSensor(const SensorSpec& sensor) { in TestSingleSensor() argument
400 req.config.sensor_type = static_cast<uint8_t>(sensor.sensor_type); in TestSingleSensor()
404 LOGI("Issuing test request to sensor %d (%s)", sensor.sensor_type, in TestSingleSensor()
405 ContextHub::SensorTypeToAbbrevName(sensor.sensor_type).c_str()); in TestSingleSensor()
408 LOGE("Failed to test sensor %d", sensor.sensor_type); in TestSingleSensor()
413 auto test_event_handler = [this, &sensor, &success](const AppToHostEvent &event) -> bool { in TestSingleSensor()
414 if (event.IsTestEventForSensor(sensor.sensor_type)) { in TestSingleSensor()
415 success = HandleTestResult(sensor, event); in TestSingleSensor()
441 bool ContextHub::HandleCalibrationResult(const SensorSpec& sensor, in HandleCalibrationResult() argument
446 sensor.sensor_type, in HandleCalibrationResult()
447 ContextHub::SensorTypeToAbbrevName(sensor.sensor_type).c_str(), in HandleCalibrationResult()
453 switch (sensor.sensor_type) { in HandleCalibrationResult()
458 success = SetCalibration(sensor.sensor_type, result->xBias, in HandleCalibrationResult()
466 if (sensor.have_cal_ref) { in HandleCalibrationResult()
467 success = SetCalibration(sensor.sensor_type, in HandleCalibrationResult()
468 (sensor.cal_ref - result->value)); in HandleCalibrationResult()
476 success = SetCalibration(sensor.sensor_type, result->xBias, in HandleCalibrationResult()
484 if (sensor.have_cal_ref && (result->value != 0.0f)) { in HandleCalibrationResult()
485 success = SetCalibration(sensor.sensor_type, in HandleCalibrationResult()
486 (sensor.cal_ref / result->value)); in HandleCalibrationResult()
493 static_cast<int>(sensor.sensor_type)); in HandleCalibrationResult()
499 bool ContextHub::HandleTestResult(const SensorSpec& sensor, in HandleTestResult() argument
504 sensor.sensor_type, in HandleTestResult()
505 ContextHub::SensorTypeToAbbrevName(sensor.sensor_type).c_str()); in HandleTestResult()
509 sensor.sensor_type, in HandleTestResult()
510 ContextHub::SensorTypeToAbbrevName(sensor.sensor_type).c_str(), in HandleTestResult()