Update FSFW #13
@ -266,23 +266,22 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki
|
|||||||
|
|
||||||
ReturnValue_t UartComIF::sendMessage(CookieIF *cookie,
|
ReturnValue_t UartComIF::sendMessage(CookieIF *cookie,
|
||||||
const uint8_t *sendData, size_t sendLen) {
|
const uint8_t *sendData, size_t sendLen) {
|
||||||
|
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
std::string deviceFile;
|
std::string deviceFile;
|
||||||
UartDeviceMapIter uartDeviceMapIter;
|
UartDeviceMapIter uartDeviceMapIter;
|
||||||
|
|
||||||
if(sendData == nullptr) {
|
|
||||||
sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl;
|
|
||||||
return RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sendLen == 0) {
|
if(sendLen == 0) {
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(sendData == nullptr) {
|
||||||
|
sif::warning << "UartComIF::sendMessage: Send data is nullptr" << std::endl;
|
||||||
|
return RETURN_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
UartCookie* uartCookie = dynamic_cast<UartCookie*>(cookie);
|
||||||
if(uartCookie == nullptr) {
|
if(uartCookie == nullptr) {
|
||||||
sif::debug << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
sif::warning << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl;
|
||||||
return NULLPOINTER;
|
return NULLPOINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
|
UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode,
|
||||||
uint32_t baudrate, size_t maxReplyLen):
|
uint32_t baudrate, size_t maxReplyLen):
|
||||||
handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), baudrate(baudrate),
|
handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode),
|
||||||
maxReplyLen(maxReplyLen) {
|
baudrate(baudrate), maxReplyLen(maxReplyLen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
UartCookie::~UartCookie() {}
|
UartCookie::~UartCookie() {}
|
||||||
|
@ -85,9 +85,10 @@ public:
|
|||||||
* Called by DHB in the GET_WRITE doGetWrite().
|
* Called by DHB in the GET_WRITE doGetWrite().
|
||||||
* Get send confirmation that the data in sendMessage() was sent successfully.
|
* Get send confirmation that the data in sendMessage() was sent successfully.
|
||||||
* @param cookie
|
* @param cookie
|
||||||
* @return - @c RETURN_OK if data was sent successfull
|
* @return
|
||||||
* - Everything else triggers falure event with
|
* - @c RETURN_OK if data was sent successfully but a reply is expected
|
||||||
* returnvalue as parameter 1
|
* - NO_REPLY_EXPECTED if data was sent successfully and no reply is expected
|
||||||
|
* - Everything else to indicate failure
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;
|
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) = 0;
|
||||||
|
|
||||||
|
@ -653,11 +653,11 @@ void DeviceHandlerBase::doGetWrite() {
|
|||||||
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
replyRawData(rawPacket, rawPacketLen, requestedRawTraffic, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//We need to distinguish here, because a raw command never expects a reply.
|
// We need to distinguish here, because a raw command never expects a reply.
|
||||||
//(Could be done in eRIRM, but then child implementations need to be careful.
|
// (Could be done in eRIRM, but then child implementations need to be careful.
|
||||||
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
result = enableReplyInReplyMap(cookieInfo.pendingCommand);
|
||||||
} else {
|
} else if (result != NO_REPLY_EXPECTED) {
|
||||||
//always generate a failure event, so that FDIR knows what's up
|
// always generate a failure event, so that FDIR knows what's up
|
||||||
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result,
|
triggerEvent(DEVICE_SENDING_COMMAND_FAILED, result,
|
||||||
cookieInfo.pendingCommand->first);
|
cookieInfo.pendingCommand->first);
|
||||||
}
|
}
|
||||||
|
@ -327,15 +327,17 @@ protected:
|
|||||||
* The existence of the command in the command map and the command size check against 0 are
|
* The existence of the command in the command map and the command size check against 0 are
|
||||||
* done by the base class.
|
* done by the base class.
|
||||||
*
|
*
|
||||||
|
* The base class will generate a finish reply or a step automatically as long as the
|
||||||
|
* send success is confirmed in the #getSendSuccess function call of the communication
|
||||||
|
* interface. NO_REPLY_EXPECTED should be returned for a finish reply, RETURN_OK should be
|
||||||
|
* returned for a step reply and everything else will trigger a step failure.
|
||||||
|
*
|
||||||
* @param deviceCommand The command to build, already checked against deviceCommandMap
|
* @param deviceCommand The command to build, already checked against deviceCommandMap
|
||||||
* @param commandData Pointer to the data from the direct command
|
* @param commandData Pointer to the data from the direct command
|
||||||
* @param commandDataLen Length of commandData
|
* @param commandDataLen Length of commandData
|
||||||
* @return
|
* @return
|
||||||
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
* - @c RETURN_OK to send command after #rawPacket and #rawPacketLen
|
||||||
* have been set.
|
* have been set.
|
||||||
* - @c HasActionsIF::EXECUTION_COMPLETE to generate a finish reply immediately. This can
|
|
||||||
* be used if no reply is expected. Otherwise, the developer can call #actionHelper.finish
|
|
||||||
* to finish the command handling.
|
|
||||||
* - Anything else triggers an event with the return code as a parameter as well as a
|
* - Anything else triggers an event with the return code as a parameter as well as a
|
||||||
* step reply failed with the return code
|
* step reply failed with the return code
|
||||||
*/
|
*/
|
||||||
|
@ -120,7 +120,8 @@ public:
|
|||||||
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
|
static const ReturnValue_t WRONG_MODE_FOR_COMMAND = MAKE_RETURN_CODE(0xA5);
|
||||||
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
static const ReturnValue_t TIMEOUT = MAKE_RETURN_CODE(0xA6);
|
||||||
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0xA7);
|
||||||
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8); //!< Used to indicate that this is a command-only command.
|
//!< Used to indicate that this is a command-only command.
|
||||||
|
static const ReturnValue_t NO_REPLY_EXPECTED = MAKE_RETURN_CODE(0xA8);
|
||||||
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
|
static const ReturnValue_t NON_OP_TEMPERATURE = MAKE_RETURN_CODE(0xA9);
|
||||||
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);
|
static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xAA);
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ ReturnValue_t Service8FunctionManagement::getMessageQueueAndObject(
|
|||||||
if(tcDataLen < sizeof(object_id_t)) {
|
if(tcDataLen < sizeof(object_id_t)) {
|
||||||
return CommandingServiceBase::INVALID_TC;
|
return CommandingServiceBase::INVALID_TC;
|
||||||
}
|
}
|
||||||
SerializeAdapter::deSerialize(objectId, &tcData,
|
// Can't fail, size was checked before
|
||||||
&tcDataLen, SerializeIF::Endianness::BIG);
|
SerializeAdapter::deSerialize(objectId, &tcData, &tcDataLen, SerializeIF::Endianness::BIG);
|
||||||
|
|
||||||
return checkInterfaceAndAcquireMessageQueue(id,objectId);
|
return checkInterfaceAndAcquireMessageQueue(id,objectId);
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FailureReport class to serialize a failure report
|
* @brief FailureReport class to serialize a failure report
|
||||||
* @brief Subservice 1, 3, 5, 7
|
* @brief Subservice 2, 4, 6, 8
|
||||||
* @ingroup spacepackets
|
* @ingroup spacepackets
|
||||||
*/
|
*/
|
||||||
class FailureReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5, 7
|
class FailureReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6, 8
|
||||||
public:
|
public:
|
||||||
FailureReport(uint8_t failureSubtype_, uint16_t packetId_,
|
FailureReport(uint8_t failureSubtype_, uint16_t packetId_,
|
||||||
uint16_t packetSequenceControl_, uint8_t stepNumber_,
|
uint16_t packetSequenceControl_, uint8_t stepNumber_,
|
||||||
@ -108,10 +108,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Subservices 2, 4, 6, 8
|
* @brief Subservices 1, 3, 5, 7
|
||||||
* @ingroup spacepackets
|
* @ingroup spacepackets
|
||||||
*/
|
*/
|
||||||
class SuccessReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6, 8
|
class SuccessReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5, 7
|
||||||
public:
|
public:
|
||||||
SuccessReport(uint8_t subtype_, uint16_t packetId_,
|
SuccessReport(uint8_t subtype_, uint16_t packetId_,
|
||||||
uint16_t packetSequenceControl_,uint8_t stepNumber_) :
|
uint16_t packetSequenceControl_,uint8_t stepNumber_) :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user