| 511 | } |
| 512 | |
| 513 | void SensorDataProvider::createCalibrationFile() |
| 514 | { |
| 515 | uint8_t defaultValues = 0U; |
| 516 | const SensorChannelDefaultValue* sensorChannelDefaultValueList = Sensors::getSensorChannelDefaultValues(defaultValues); |
| 517 | |
| 518 | /* Use the default values. */ |
| 519 | if (nullptr != sensorChannelDefaultValueList) |
| 520 | { |
| 521 | uint8_t index = 0U; |
| 522 | |
| 523 | for (index = 0U; index < defaultValues; ++index) |
| 524 | { |
| 525 | const SensorChannelDefaultValue* value = &sensorChannelDefaultValueList[index]; |
| 526 | ISensor* sensor = getSensor(value->sensorId); |
| 527 | |
| 528 | if (nullptr == sensor) |
| 529 | { |
| 530 | LOG_ERROR("Sensor %u doesn't exists.", value->sensorId); |
| 531 | } |
| 532 | else |
| 533 | { |
| 534 | ISensorChannel* channel = sensor->getChannel(value->channelId); |
| 535 | |
| 536 | if (nullptr == channel) |
| 537 | { |
| 538 | LOG_ERROR("Sensor %u has no channel %u.", value->sensorId, value->channelId); |
| 539 | } |
| 540 | else |
| 541 | { |
| 542 | const size_t JSON_DOC_SIZE = 256U; |
| 543 | DynamicJsonDocument jsonDoc(JSON_DOC_SIZE); |
| 544 | |
| 545 | if (DeserializationError::Ok == deserializeJson(jsonDoc, value->jsonStrValue)) |
| 546 | { |
| 547 | channelOffsetFromJson(*channel, jsonDoc["offset"]); |
| 548 | } |
| 549 | } |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | (void)save(); |
| 555 | } |
| 556 | |
| 557 | void SensorDataProvider::registerSensorTopics() |
| 558 | { |
nothing calls this directly
no test coverage detected