syrlinks handler ready for testing
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <mission/devices/devicedefinitions/SyrlinksDefinitions.h>
|
||||
#include <cstring.h>
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* @brief This is the device handler for the syrlinks transceiver. It handles the command
|
||||
@ -20,6 +20,11 @@ public:
|
||||
CookieIF * comCookie);
|
||||
virtual ~SyrlinksHkHandler();
|
||||
|
||||
/**
|
||||
* @brief Sets mode to MODE_NORMAL. Can be used for debugging.
|
||||
*/
|
||||
void setModeNormal();
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
@ -49,6 +54,7 @@ private:
|
||||
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 ReturnValue_t MISSING_START_FRAME_CHARACTER = MAKE_RETURN_CODE(0xA8);
|
||||
|
||||
static const uint8_t CRC_INITIAL_VALUE = 0x0;
|
||||
|
||||
@ -58,29 +64,18 @@ private:
|
||||
/** W - write, 04 - 4 bytes in data field, 01 - value, 40 register to write value */
|
||||
std::string setTxModeModulation = "<W04:0140:5D2A>";
|
||||
std::string setTxModeCw = "<W04:1040:81CF>";
|
||||
|
||||
SYRLINKS::RxStatusRegistersDataset rxStatusRegistersSet;
|
||||
|
||||
static const uint8_t MAX_CMD_LEN = 3;
|
||||
|
||||
uint8_t rememberRequestedSize = 0;
|
||||
uint8_t rememberCommandId = SYRLINKS::NONE;
|
||||
uint8_t cmdBuffer[MAX_CMD_LEN];
|
||||
CommunicationStep communicationStep =
|
||||
CommunicationStep::START_ADC_CONVERSION;
|
||||
|
||||
std::string readTxStatus = "<R02:40:7555>";
|
||||
|
||||
/**
|
||||
* @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.
|
||||
* In some cases it is not possible to extract from the received reply the information about
|
||||
* the associated command. This variable is thus used to remember the command id.
|
||||
*/
|
||||
ReturnValue_t verifyTansmissionStatusReply(const uint8_t* packet);
|
||||
DeviceCommandId_t rememberCommandId = SYRLINKS::NONE;
|
||||
|
||||
SYRLINKS::RxDataset rxDataset;
|
||||
SYRLINKS::TxDataset txDataset;
|
||||
|
||||
uint8_t commandBuffer[SYRLINKS::MAX_COMMAND_SIZE];
|
||||
|
||||
/**
|
||||
* @brief This function converts an uint16_t into its hexadecimal string representation.
|
||||
@ -89,7 +84,7 @@ private:
|
||||
*
|
||||
* @return An std::string object containing the hex representation of intValue.
|
||||
*/
|
||||
std::string SyrlinksHkHandler::convertIntToHexString(uint16_t intValue);
|
||||
std::string convertIntToHexString(uint16_t intValue);
|
||||
|
||||
/**
|
||||
* @brief This function parses the status reply
|
||||
@ -98,17 +93,32 @@ private:
|
||||
* @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);
|
||||
ReturnValue_t parseReplyStatus(const char* status);
|
||||
|
||||
/**
|
||||
* @brief Function verifies the received reply from the syrlinks by recalculating and
|
||||
* comparing the crc.
|
||||
*
|
||||
* @param packet Pointer to the received reply.
|
||||
* @param size Size of the whole packet including the crc and the packet termination
|
||||
* character '>'.
|
||||
*
|
||||
* @return RETURN_OK if successful, otherwise RETURN_FAILED.
|
||||
*/
|
||||
ReturnValue_t verifyReadRxStatusRegistersReply(uint8_t* packet)
|
||||
ReturnValue_t verifyReply(const uint8_t* packet, uint8_t size);
|
||||
|
||||
/**
|
||||
* @brief This function extracts the data from a rx status registers reply and writes the
|
||||
* information to the status registers dataset.
|
||||
* @param packet Pointer to the reply packet.
|
||||
*/
|
||||
void parseRxStatusRegistersReply(const uint8_t* packet);
|
||||
|
||||
/**
|
||||
* @brief This function writes the read tx status register to the txStatusDataset.
|
||||
* @param packet Pointer to the received packet.
|
||||
*/
|
||||
void parseTxStatusReply(const uint8_t* packet);
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_SYRLINKSHKHANDLER_H_ */
|
||||
|
Reference in New Issue
Block a user