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);
if (result != RETURN_OK) {
return result;
}
result = checkInterfaceAndAcquireMessageQueue(id,objectId);
return result;
}
ReturnValue_t CService200ModeCommanding::checkAndAcquireTargetID(
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; return CommandingServiceBase::INVALID_TC;
else }
return HasReturnvaluesIF::RETURN_OK; SerializeAdapter::deSerialize(objectId, &tcData, &tcDataLen,
SerializeIF::Endianness::BIG);
return checkInterfaceAndAcquireMessageQueue(id,objectId);
} }
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 HasReturnvaluesIF::RETURN_OK;
} else {
return CommandingServiceBase::INVALID_OBJECT; return CommandingServiceBase::INVALID_OBJECT;
} }
*messageQueueToSet = destination->getCommandQueue();
return HasReturnvaluesIF::RETURN_OK;
} }
@ -69,13 +59,12 @@ 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;
} }
}
ReturnValue_t CService200ModeCommanding::handleReply( ReturnValue_t CService200ModeCommanding::handleReply(
@ -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);