save before removing approach with rememberCommandId

This commit is contained in:
2021-02-19 15:41:50 +01:00
parent e250f41c09
commit b4d74b4a4f
4 changed files with 203 additions and 23 deletions

View File

@ -39,6 +39,19 @@ protected:
private:
static const uint8_t INTERFACE_ID = CLASS_ID::SYRLINKS_HANDLER;
static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA0);
static const ReturnValue_t UART_FRAMIN_OR_PARITY_ERROR_ACK = MAKE_RETURN_CODE(0xA1);
static const ReturnValue_t BAD_CHARACTER_ACK = MAKE_RETURN_CODE(0xA2);
static const ReturnValue_t BAD_PARAMETER_VALUE_ACK = MAKE_RETURN_CODE(0xA3);
static const ReturnValue_t BAD_END_OF_FRAME_ACK = MAKE_RETURN_CODE(0xA4);
static const ReturnValue_t UNKNOWN_COMMAND_ID_ACK = MAKE_RETURN_CODE(0xA5);
static const ReturnValue_t BAD_CRC_ACK = MAKE_RETURN_CODE(0xA6);
static const ReturnValue_t REPLY_WRONG_SIZE = MAKE_RETURN_CODE(0xA7);
static const uint8_t CRC_INITIAL_VALUE = 0x0;
std::string resetCommand = "<C04:5A5A:FF41>";
std::string readRxStatusRegCommand = "<E00::825B>";
std::string setTxModeStandby = "<W04:0040:2B9E>";
@ -51,10 +64,51 @@ private:
static const uint8_t MAX_CMD_LEN = 3;
uint8_t rememberRequestedSize = 0;
uint8_t rememberCommandId = TMP1075::NONE;
uint8_t rememberCommandId = SYRLINKS::NONE;
uint8_t cmdBuffer[MAX_CMD_LEN];
CommunicationStep communicationStep =
CommunicationStep::START_ADC_CONVERSION;
/**
* @brief This function verifies the checksum of a status reply packet of the syrlinks.
*
* @param packet Pointer to the received status reply.
*
* @return RETURN_OK if successful, otherwise RETURN_FAILURE.
*
* @details A status reply only contains one byte of payload data giving information about
* the transmission status.
*/
ReturnValue_t verifyTansmissionStatusReply(const uint8_t* packet);
/**
* @brief This function converts an uint16_t into its hexadecimal string representation.
*
* @param The value to convert.
*
* @return An std::string object containing the hex representation of intValue.
*/
std::string SyrlinksHkHandler::convertIntToHexString(uint16_t intValue);
/**
* @brief This function parses the status reply
* @param status Pointer to the status information.
*
* @details Some commands reply with a status message giving information about the preceding
* command transmission and/or execution was successful.
*/
ReturnValue_t parseReplyStatus(char* status);
/**
* @brief Function verifies the received reply from the syrlinks by recalculating and
* comparing the crc.
*
* @param packet Pointer to the received reply.
*
* @return RETURN_OK if successful, otherwise RETURN_FAILED.
*/
ReturnValue_t verifyReadRxStatusRegistersReply(uint8_t* packet)
};
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */