eive-obsw/bsp_q7s/core/CoreController.cpp

61 lines
2.0 KiB
C++
Raw Normal View History

2021-05-26 14:16:16 +02:00
#include "CoreController.h"
2021-07-08 12:07:39 +02:00
#include "../memory/SdCardManager.h"
2021-05-26 14:16:16 +02:00
CoreController::CoreController(object_id_t objectId):
ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) {
}
ReturnValue_t CoreController::handleCommandMessage(CommandMessage *message) {
return HasReturnvaluesIF::RETURN_OK;
}
void CoreController::performControlOperation() {
}
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
return HasReturnvaluesIF::RETURN_OK;
}
LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) {
return nullptr;
}
2021-07-08 12:07:39 +02:00
ReturnValue_t CoreController::initialize() {
// Find a way to store this non-volatile outside of SD cards (ProASIC?)
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
2021-07-09 17:54:32 +02:00
std::string printoutString;
if(preferredSdCard == sd::SdCard::SLOT_0) {
printoutString = "0";
}
else {
printoutString = "1";
}
2021-07-08 12:07:39 +02:00
// Creator or update status file
ReturnValue_t result = SdCardManager::instance()->updateSdCardStateFile();
if(result != HasReturnvaluesIF::RETURN_OK) {
sif::warning << "CoreController::initialize: Updating SD card state file failed"
<< std::endl;
}
2021-07-09 17:54:32 +02:00
sif::info << "Switching on SD card " << printoutString << ".." << std::endl;
2021-07-08 12:07:39 +02:00
result = SdCardManager::instance()->switchOnSdCard(preferredSdCard);
2021-07-09 17:54:32 +02:00
if(result == SdCardManager::ALREADY_ON) {
sif::info << "SD card " << printoutString << " is already on" << std::endl;
}
else if(result != HasReturnvaluesIF::RETURN_OK) {
2021-07-08 12:07:39 +02:00
sif::warning << "CoreController::initialize: Turning SD card on failed"
<< std::endl;
}
2021-07-09 17:54:32 +02:00
else {
sif::info << "SD card " << printoutString << " was switched on" << std::endl;
}
2021-07-08 12:07:39 +02:00
return HasReturnvaluesIF::RETURN_OK;
}
2021-05-26 14:16:16 +02:00
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode) {
return HasReturnvaluesIF::RETURN_OK;
}