increased srv2 readability

This commit is contained in:
Robin Müller 2020-07-07 17:25:52 +02:00
parent 684b56ac88
commit 06d389ed1e
2 changed files with 6 additions and 20 deletions

View File

@ -34,29 +34,17 @@ ReturnValue_t Service2DeviceAccess::isValidSubservice(uint8_t subservice) {
ReturnValue_t Service2DeviceAccess::getMessageQueueAndObject(
uint8_t subservice, const uint8_t* tcData, size_t tcDataLen,
MessageQueueId_t* id, object_id_t* objectId) {
ReturnValue_t result = checkAndAcquireTargetID(objectId,tcData,tcDataLen);
if(result != HasReturnvaluesIF::RETURN_OK) {
return result;
}
if(tcDataLen < sizeof(object_id_t)) {
return CommandingServiceBase::INVALID_TC;
}
SerializeAdapter::deSerialize(objectId, &tcData,
&tcDataLen, SerializeIF::Endianness::BIG);
result = checkInterfaceAndAcquireMessageQueue(id,objectId);
ReturnValue_t result = checkInterfaceAndAcquireMessageQueue(id,objectId);
return result;
}
ReturnValue_t Service2DeviceAccess::checkAndAcquireTargetID(
object_id_t* objectIdToSet, const uint8_t* tcData, size_t tcDataLen) {
if(SerializeAdapter::deSerialize(objectIdToSet, &tcData,
&tcDataLen, SerializeIF::Endianness::BIG) != RETURN_OK) {
sif::error << "Service 2: Target ID not found. ID: " <<
std::hex << objectIdToSet ;
return CommandingServiceBase::INVALID_TC;
}
else {
return HasReturnvaluesIF::RETURN_OK;
}
}
ReturnValue_t Service2DeviceAccess::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t * messageQueueToSet, object_id_t *objectId) {
DeviceHandlerIF* possibleTarget =

View File

@ -73,8 +73,6 @@ private:
*/
void sendWiretappingTm(CommandMessage* reply,uint8_t subservice);
ReturnValue_t checkAndAcquireTargetID(object_id_t* objectIdToSet,
const uint8_t* tcData, size_t tcDataLen);
ReturnValue_t checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId);