eive-obsw/dummies/BatteryDummy.cpp

54 lines
2.1 KiB
C++

#include "BatteryDummy.h"
BatteryDummy::BatteryDummy(DhbConfig cfg)
: FreshDeviceHandlerBase(cfg), cfgSet(this), hkSet(this) {}
void BatteryDummy::performDeviceOperation(uint8_t opCode) {}
LocalPoolDataSetBase* BatteryDummy::getDataSetHandle(sid_t sid) {
if (sid == hkSet.getSid()) {
return &hkSet;
}
if (sid == cfgSet.getSid()) {
return &cfgSet;
}
return nullptr;
}
ReturnValue_t BatteryDummy::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) {
localDataPoolMap.emplace(bpxBat::BATT_TEMP_1, &battTemp1);
localDataPoolMap.emplace(bpxBat::BATT_TEMP_2, &battTemp2);
localDataPoolMap.emplace(bpxBat::BATT_TEMP_3, &battTemp3);
localDataPoolMap.emplace(bpxBat::BATT_TEMP_4, &battTemp4);
localDataPoolMap.emplace(bpxBat::CHARGE_CURRENT, &chargeCurrent);
localDataPoolMap.emplace(bpxBat::DISCHARGE_CURRENT, &dischargeCurrent);
localDataPoolMap.emplace(bpxBat::HEATER_CURRENT, &heaterCurrent);
localDataPoolMap.emplace(bpxBat::BATT_VOLTAGE, &battVolt);
localDataPoolMap.emplace(bpxBat::REBOOT_COUNTER, &rebootCounter);
localDataPoolMap.emplace(bpxBat::BOOTCAUSE, &bootCause);
localDataPoolMap.emplace(bpxBat::BATTERY_HEATER_MODE, &battheatMode);
localDataPoolMap.emplace(bpxBat::BATTHEAT_LOW_LIMIT, &battheatLow);
localDataPoolMap.emplace(bpxBat::BATTHEAT_HIGH_LIMIT, &battheatHigh);
poolManager.subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams(hkSet.getSid(), true, 20.0));
poolManager.subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams(cfgSet.getSid(), false, 30.0));
return returnvalue::OK;
}
ReturnValue_t BatteryDummy::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
return returnvalue::OK;
}
ReturnValue_t BatteryDummy::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
const uint8_t* data, size_t size) {
return returnvalue::OK;
}
ReturnValue_t BatteryDummy::handleCommandMessage(CommandMessage* message) {
return returnvalue::FAILED;
}