csrv200 improvements

This commit is contained in:
Robin Müller 2020-07-10 03:16:08 +02:00
parent bdc6e88198
commit 9cbc1a18b8
2 changed files with 26 additions and 35 deletions

View File

@ -27,36 +27,26 @@ ReturnValue_t CService200ModeCommanding::isValidSubservice(uint8_t subservice) {
ReturnValue_t CService200ModeCommanding::getMessageQueueAndObject( ReturnValue_t CService200ModeCommanding::getMessageQueueAndObject(
uint8_t subservice, const uint8_t *tcData, size_t tcDataLen, uint8_t subservice, const uint8_t *tcData, size_t tcDataLen,
MessageQueueId_t *id, object_id_t *objectId) MessageQueueId_t *id, object_id_t *objectId) {
{ if(tcDataLen < sizeof(object_id_t)) {
ReturnValue_t result = checkAndAcquireTargetID(objectId,tcData,tcDataLen); return CommandingServiceBase::INVALID_TC;
if (result != RETURN_OK) { }
return result; SerializeAdapter::deSerialize(objectId, &tcData, &tcDataLen,
} SerializeIF::Endianness::BIG);
result = checkInterfaceAndAcquireMessageQueue(id,objectId);
return result;
}
ReturnValue_t CService200ModeCommanding::checkAndAcquireTargetID( return checkInterfaceAndAcquireMessageQueue(id,objectId);
object_id_t* objectIdToSet, const uint8_t* tcData, uint32_t tcDataLen) {
size_t size = tcDataLen;
if (SerializeAdapter::deSerialize(objectIdToSet, &tcData, &size,
SerializeIF::Endianness::BIG)
!= HasReturnvaluesIF::RETURN_OK)
return CommandingServiceBase::INVALID_TC;
else
return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t CService200ModeCommanding::checkInterfaceAndAcquireMessageQueue( ReturnValue_t CService200ModeCommanding::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* MessageQueueToSet, object_id_t* objectId) { MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
HasModesIF * possibleTarget = objectManager->get<HasModesIF>(*objectId); HasModesIF * destination = objectManager->get<HasModesIF>(*objectId);
if(possibleTarget!=NULL){ if(destination == nullptr) {
*MessageQueueToSet = possibleTarget->getCommandQueue(); return CommandingServiceBase::INVALID_OBJECT;
return HasReturnvaluesIF::RETURN_OK;
} else { }
return CommandingServiceBase::INVALID_OBJECT;
} *messageQueueToSet = destination->getCommandQueue();
return HasReturnvaluesIF::RETURN_OK;
} }
@ -69,12 +59,11 @@ ReturnValue_t CService200ModeCommanding::prepareCommand(
if (result != RETURN_OK) { if (result != RETURN_OK) {
return result; return result;
} }
else {
ModeMessage::setModeMessage(dynamic_cast<CommandMessage*>(message), ModeMessage::setModeMessage(dynamic_cast<CommandMessage*>(message),
ModeMessage::CMD_MODE_COMMAND, modeCommandPacket.getMode(), ModeMessage::CMD_MODE_COMMAND, modeCommandPacket.getMode(),
modeCommandPacket.getSubmode()); modeCommandPacket.getSubmode());
return result; return result;
}
} }
@ -128,6 +117,3 @@ ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(
return sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, return sendTmPacket(Subservice::REPLY_CANT_REACH_MODE,
&cantReachModePacket); &cantReachModePacket);
} }

View File

@ -25,8 +25,13 @@ public:
* @param * @param
* @return * @return
*/ */
<<<<<<< Updated upstream
StorageAccessor& operator= (StorageAccessor&&); StorageAccessor& operator= (StorageAccessor&&);
StorageAccessor (StorageAccessor&&); StorageAccessor (StorageAccessor&&);
=======
StorageAccessor& operator=(StorageAccessor&&);
StorageAccessor(StorageAccessor&&);
>>>>>>> Stashed changes
ReturnValue_t write(uint8_t *data, size_t size, ReturnValue_t write(uint8_t *data, size_t size,
uint16_t offset = 0); uint16_t offset = 0);