srv8 improvements
This commit is contained in:
parent
9cbc1a18b8
commit
be8913efea
@ -59,8 +59,7 @@ ReturnValue_t Service5EventReporting::generateEventReport(
|
||||
}
|
||||
|
||||
ReturnValue_t Service5EventReporting::handleRequest(uint8_t subservice) {
|
||||
switch(subservice)
|
||||
{
|
||||
switch(subservice) {
|
||||
case Subservice::ENABLE: {
|
||||
enableEventReport = true;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <framework/pus/Service8FunctionManagement.h>
|
||||
#include <framework/pus/servicepackets/Service8Packets.h>
|
||||
|
||||
#include <framework/action/ActionMessage.h>
|
||||
#include <framework/objectmanager/SystemObjectIF.h>
|
||||
#include <framework/action/HasActionsIF.h>
|
||||
#include <framework/devicehandlers/DeviceHandlerIF.h>
|
||||
@ -54,13 +53,9 @@ ReturnValue_t Service8FunctionManagement::checkInterfaceAndAcquireMessageQueue(
|
||||
ReturnValue_t Service8FunctionManagement::prepareCommand(
|
||||
CommandMessage* message, uint8_t subservice, const uint8_t* tcData,
|
||||
size_t tcDataLen, uint32_t* state, object_id_t objectId) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||
if(subservice == static_cast<uint8_t>(Subservice::DIRECT_COMMANDING)) {
|
||||
result = prepareDirectCommand(dynamic_cast<CommandMessage*>(message),
|
||||
return prepareDirectCommand(dynamic_cast<CommandMessage*>(message),
|
||||
tcData, tcDataLen);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t Service8FunctionManagement::prepareDirectCommand(
|
||||
CommandMessage *message, const uint8_t *tcData, size_t tcDataLen) {
|
||||
@ -100,18 +95,7 @@ ReturnValue_t Service8FunctionManagement::handleReply(
|
||||
break;
|
||||
}
|
||||
case ActionMessage::DATA_REPLY: {
|
||||
store_address_t storeId = ActionMessage::getStoreId(reply);
|
||||
size_t size = 0;
|
||||
const uint8_t * buffer = nullptr;
|
||||
result = IPCStore->getData(storeId, &buffer, &size);
|
||||
if(result != RETURN_OK) {
|
||||
sif::error << "Service 8: Could not retrieve data for data reply";
|
||||
return result;
|
||||
}
|
||||
DataReply dataReply(objectId,actionId,buffer,size);
|
||||
sendTmPacket(static_cast<uint8_t>(
|
||||
Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply);
|
||||
result = IPCStore ->deleteData(storeId);
|
||||
result = handleDataReply(reply, objectId, actionId);
|
||||
break;
|
||||
}
|
||||
case ActionMessage::STEP_FAILED:
|
||||
@ -126,4 +110,26 @@ ReturnValue_t Service8FunctionManagement::handleReply(
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t Service8FunctionManagement::handleDataReply(
|
||||
const CommandMessage* reply, object_id_t objectId,
|
||||
ActionId_t actionId) {
|
||||
store_address_t storeId = ActionMessage::getStoreId(reply);
|
||||
size_t size = 0;
|
||||
const uint8_t * buffer = nullptr;
|
||||
ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size);
|
||||
if(result != RETURN_OK) {
|
||||
sif::error << "Service 8: Could not retrieve data for data reply"
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
DataReply dataReply(objectId, actionId, buffer, size);
|
||||
result = sendTmPacket(static_cast<uint8_t>(
|
||||
Subservice::DIRECT_COMMANDING_DATA_REPLY), &dataReply);
|
||||
|
||||
auto deletionResult = IPCStore->deleteData(storeId);
|
||||
if(deletionResult != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "Service8FunctionManagement::handleReply: Deletion"
|
||||
<< " of data in pool failed." << std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
||||
#define FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_
|
||||
|
||||
#include <framework/action/ActionMessage.h>
|
||||
#include <framework/tmtcservices/CommandingServiceBase.h>
|
||||
|
||||
/**
|
||||
@ -59,6 +60,8 @@ private:
|
||||
MessageQueueId_t* messageQueueToSet, object_id_t* objectId);
|
||||
ReturnValue_t prepareDirectCommand(CommandMessage* message,
|
||||
const uint8_t* tcData, size_t tcDataLen);
|
||||
ReturnValue_t handleDataReply(const CommandMessage* reply,
|
||||
object_id_t objectId, ActionId_t actionId);
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ */
|
||||
|
@ -17,21 +17,17 @@ class StorageAccessor: public ConstStorageAccessor {
|
||||
public:
|
||||
StorageAccessor(store_address_t storeId);
|
||||
StorageAccessor(store_address_t storeId, StorageManagerIF* store);
|
||||
|
||||
/**
|
||||
* @brief Move ctor and move assignment allow returning accessors as
|
||||
* a returnvalue. They prevent resource being free prematurely.
|
||||
* Refer to: https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/
|
||||
* a returnvalue. They prevent resource being freed prematurely.
|
||||
* See: https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/cpp/
|
||||
* move-constructors-and-move-assignment-operators-cpp.md
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
<<<<<<< Updated upstream
|
||||
StorageAccessor& operator=(StorageAccessor&&);
|
||||
StorageAccessor(StorageAccessor&&);
|
||||
=======
|
||||
StorageAccessor& operator=(StorageAccessor&&);
|
||||
StorageAccessor(StorageAccessor&&);
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
ReturnValue_t write(uint8_t *data, size_t size,
|
||||
uint16_t offset = 0);
|
||||
|
Loading…
Reference in New Issue
Block a user