conitniue sus polling
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
11f476878d
commit
26aeb88d84
@ -18,7 +18,21 @@ ReturnValue_t SusPolling::performOperation(uint8_t operationCode) {
|
||||
state = InternalState::IDLE;
|
||||
ipcLock->unlockMutex();
|
||||
semaphore->acquire();
|
||||
// TODO: Perform SUS polling here.
|
||||
for(auto& susDev: susDevs) {
|
||||
acs::SimpleSensorMode mode;
|
||||
bool doPerformStartup = false;
|
||||
{
|
||||
MutexGuard mg(ipcLock);
|
||||
mode = susDev.mode;
|
||||
doPerformStartup = susDev.performStartup;
|
||||
}
|
||||
if (mode == acs::SimpleSensorMode::NORMAL) {
|
||||
if(doPerformStartup) {
|
||||
// Startup handling.
|
||||
}
|
||||
// Regular sensor polling.
|
||||
}
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -51,7 +65,14 @@ ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData,
|
||||
return FAILED;
|
||||
}
|
||||
const auto* susReq = reinterpret_cast<const acs::SusRequest*>(sendData);
|
||||
MutexGuard mg(ipcLock);
|
||||
if (susDevs[susIdx].mode != susReq->mode) {
|
||||
if(susReq->mode == acs::SimpleSensorMode::NORMAL) {
|
||||
susDevs[susIdx].performStartup = true;
|
||||
} else {
|
||||
susDevs[susIdx].ownReply.dataWasSet = false;
|
||||
}
|
||||
susDevs[susIdx].mode = susReq->mode;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -61,6 +82,18 @@ ReturnValue_t SusPolling::getSendSuccess(CookieIF* cookie) { return OK; }
|
||||
ReturnValue_t SusPolling::requestReceiveMessage(CookieIF* cookie, size_t requestLen) { return OK; }
|
||||
|
||||
ReturnValue_t SusPolling::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
||||
auto* spiCookie = dynamic_cast<SpiCookie*>(cookie);
|
||||
if (spiCookie == nullptr) {
|
||||
return FAILED;
|
||||
}
|
||||
int susIdx = addressToIndex(spiCookie->getSpiAddress());
|
||||
if (susIdx < 0) {
|
||||
return FAILED;
|
||||
}
|
||||
MutexGuard mg(ipcLock);
|
||||
std::memcpy(&susDevs[susIdx].readerReply, &susDevs[susIdx].ownReply, sizeof(acs::SusReply));
|
||||
*buffer = reinterpret_cast<uint8_t*>(&susDevs[susIdx].readerReply);
|
||||
*size = sizeof(acs::SusReply);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user