|
|
|
@ -7,7 +7,7 @@
|
|
|
|
|
#include <mission/devices/PcduHandler.h>
|
|
|
|
|
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
|
|
|
|
|
|
|
|
|
|
PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
|
|
|
|
|
PcduHandler::PcduHandler(object_id_t setObjectId, size_t cmdQueueSize)
|
|
|
|
|
: SystemObject(setObjectId),
|
|
|
|
|
poolManager(this, nullptr),
|
|
|
|
|
p60CoreHk(objects::P60DOCK_HANDLER),
|
|
|
|
@ -22,9 +22,9 @@ PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize)
|
|
|
|
|
std::memset(switchStates, SWITCH_STATE_UNKNOWN, sizeof(switchStates));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PCDUHandler::~PCDUHandler() {}
|
|
|
|
|
PcduHandler::~PcduHandler() {}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::performOperation(uint8_t counter) {
|
|
|
|
|
ReturnValue_t PcduHandler::performOperation(uint8_t counter) {
|
|
|
|
|
if (counter == DeviceHandlerIF::PERFORM_OPERATION) {
|
|
|
|
|
readCommandQueue();
|
|
|
|
|
}
|
|
|
|
@ -52,7 +52,7 @@ ReturnValue_t PCDUHandler::performOperation(uint8_t counter) {
|
|
|
|
|
return returnvalue::OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::initialize() {
|
|
|
|
|
ReturnValue_t PcduHandler::initialize() {
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
|
|
|
|
|
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
|
|
|
@ -100,7 +100,7 @@ ReturnValue_t PCDUHandler::initialize() {
|
|
|
|
|
return returnvalue::OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::initializeSwitchStates() {
|
|
|
|
|
void PcduHandler::initializeSwitchStates() {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
try {
|
|
|
|
|
for (uint8_t idx = 0; idx < NUMBER_OF_SWITCHES; idx++) {
|
|
|
|
@ -117,7 +117,7 @@ void PCDUHandler::initializeSwitchStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::readCommandQueue() {
|
|
|
|
|
void PcduHandler::readCommandQueue() {
|
|
|
|
|
ReturnValue_t result = returnvalue::OK;
|
|
|
|
|
CommandMessage command;
|
|
|
|
|
|
|
|
|
@ -130,9 +130,9 @@ void PCDUHandler::readCommandQueue() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MessageQueueId_t PCDUHandler::getCommandQueue() const { return commandQueue->getId(); }
|
|
|
|
|
MessageQueueId_t PcduHandler::getCommandQueue() const { return commandQueue->getId(); }
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
|
|
|
|
|
void PcduHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) {
|
|
|
|
|
if (sid == sid_t(objects::PDU2_HANDLER, static_cast<uint32_t>(P60System::SetIds::CORE))) {
|
|
|
|
|
updateHkTableDataset(storeId, &pdu2CoreHk, &timeStampPdu2HkDataset);
|
|
|
|
|
updatePdu2SwitchStates();
|
|
|
|
@ -144,7 +144,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId, bool*
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
|
|
|
|
|
void PcduHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSetBase* dataset,
|
|
|
|
|
CCSDSTime::CDS_short* datasetTimeStamp) {
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
|
|
|
|
@ -170,7 +170,7 @@ void PCDUHandler::updateHkTableDataset(store_address_t storeId, LocalPoolDataSet
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::updatePdu2SwitchStates() {
|
|
|
|
|
void PcduHandler::updatePdu2SwitchStates() {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
using namespace PDU2;
|
|
|
|
|
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
|
|
|
|
@ -207,7 +207,7 @@ void PCDUHandler::updatePdu2SwitchStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::updatePdu1SwitchStates() {
|
|
|
|
|
void PcduHandler::updatePdu1SwitchStates() {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
using namespace PDU1;
|
|
|
|
|
PoolReadGuard rg0(&switcherSet);
|
|
|
|
@ -244,9 +244,9 @@ void PCDUHandler::updatePdu1SwitchStates() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LocalDataPoolManager* PCDUHandler::getHkManagerHandle() { return &poolManager; }
|
|
|
|
|
LocalDataPoolManager* PcduHandler::getHkManagerHandle() { return &poolManager; }
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
|
|
|
|
|
ReturnValue_t PcduHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
ReturnValue_t result;
|
|
|
|
|
uint16_t memoryAddress = 0;
|
|
|
|
@ -396,9 +396,9 @@ ReturnValue_t PCDUHandler::sendSwitchCommand(uint8_t switchNr, ReturnValue_t onO
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; }
|
|
|
|
|
ReturnValue_t PcduHandler::sendFuseOnCommand(uint8_t fuseNr) { return returnvalue::OK; }
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
|
|
|
|
|
ReturnValue_t PcduHandler::getSwitchState(uint8_t switchNr) const {
|
|
|
|
|
if (switchNr >= pcdu::NUMBER_OF_SWITCHES) {
|
|
|
|
|
sif::debug << "PCDUHandler::getSwitchState: Invalid switch number" << std::endl;
|
|
|
|
|
return returnvalue::FAILED;
|
|
|
|
@ -409,7 +409,7 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
|
|
|
|
|
currentState = switchStates[switchNr];
|
|
|
|
|
}
|
|
|
|
|
if (currentState == SWITCH_STATE_UNKNOWN) {
|
|
|
|
|
return returnvalue::FAILED;
|
|
|
|
|
return PowerSwitchIF::SWITCH_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
if (currentState == 1) {
|
|
|
|
|
return PowerSwitchIF::SWITCH_ON;
|
|
|
|
@ -418,13 +418,13 @@ ReturnValue_t PCDUHandler::getSwitchState(uint8_t switchNr) const {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; }
|
|
|
|
|
ReturnValue_t PcduHandler::getFuseState(uint8_t fuseNr) const { return returnvalue::OK; }
|
|
|
|
|
|
|
|
|
|
uint32_t PCDUHandler::getSwitchDelayMs(void) const { return 20000; }
|
|
|
|
|
uint32_t PcduHandler::getSwitchDelayMs(void) const { return 20000; }
|
|
|
|
|
|
|
|
|
|
object_id_t PCDUHandler::getObjectId() const { return SystemObject::getObjectId(); }
|
|
|
|
|
object_id_t PcduHandler::getObjectId() const { return SystemObject::getObjectId(); }
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
|
|
|
|
ReturnValue_t PcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
|
|
|
|
LocalDataPoolManager& poolManager) {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
localDataPoolMap.emplace(PoolIds::PDU1_SWITCHES, &pdu1Switches);
|
|
|
|
@ -435,7 +435,7 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool& localDat
|
|
|
|
|
return returnvalue::OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReturnValue_t PCDUHandler::initializeAfterTaskCreation() {
|
|
|
|
|
ReturnValue_t PcduHandler::initializeAfterTaskCreation() {
|
|
|
|
|
if (executingTask != nullptr) {
|
|
|
|
|
pstIntervalMs = executingTask->getPeriodMs();
|
|
|
|
|
}
|
|
|
|
@ -446,11 +446,11 @@ ReturnValue_t PCDUHandler::initializeAfterTaskCreation() {
|
|
|
|
|
return returnvalue::OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t PCDUHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; }
|
|
|
|
|
uint32_t PcduHandler::getPeriodicOperationFrequency() const { return pstIntervalMs; }
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; }
|
|
|
|
|
void PcduHandler::setTaskIF(PeriodicTaskIF* task) { executingTask = task; }
|
|
|
|
|
|
|
|
|
|
LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
|
|
|
|
|
LocalPoolDataSetBase* PcduHandler::getDataSetHandle(sid_t sid) {
|
|
|
|
|
if (sid == switcherSet.getSid()) {
|
|
|
|
|
return &switcherSet;
|
|
|
|
|
} else {
|
|
|
|
@ -459,7 +459,7 @@ LocalPoolDataSetBase* PCDUHandler::getDataSetHandle(sid_t sid) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PCDUHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
|
|
|
|
|
void PcduHandler::checkAndUpdatePduSwitch(GOMSPACE::Pdu pdu, pcdu::Switches switchIdx,
|
|
|
|
|
uint8_t setValue) {
|
|
|
|
|
using namespace pcdu;
|
|
|
|
|
if (switchStates[switchIdx] != setValue) {
|
|
|
|
|