61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
#include "CoreController.h"
|
|
#include "../memory/SdCardManager.h"
|
|
|
|
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;
|
|
}
|
|
|
|
ReturnValue_t CoreController::initialize() {
|
|
// Find a way to store this non-volatile outside of SD cards (ProASIC?)
|
|
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
|
|
std::string printoutString;
|
|
if(preferredSdCard == sd::SdCard::SLOT_0) {
|
|
printoutString = "0";
|
|
}
|
|
else {
|
|
printoutString = "1";
|
|
}
|
|
// 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;
|
|
}
|
|
|
|
sif::info << "Switching on SD card " << printoutString << ".." << std::endl;
|
|
|
|
result = SdCardManager::instance()->switchOnSdCard(preferredSdCard);
|
|
if(result == SdCardManager::ALREADY_ON) {
|
|
sif::info << "SD card " << printoutString << " is already on" << std::endl;
|
|
}
|
|
else if(result != HasReturnvaluesIF::RETURN_OK) {
|
|
sif::warning << "CoreController::initialize: Turning SD card on failed"
|
|
<< std::endl;
|
|
}
|
|
else {
|
|
sif::info << "SD card " << printoutString << " was switched on" << std::endl;
|
|
}
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
}
|
|
|
|
ReturnValue_t CoreController::checkModeCommand(Mode_t mode, Submode_t submode,
|
|
uint32_t *msToReachTheMode) {
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
}
|