From 4bb5443ed0e3ef906797ec25b6fac9240dcd61b3 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Thu, 25 Feb 2021 15:53:28 +0100 Subject: [PATCH] hex to int wip --- etl | 2 +- fsfw | 2 +- mission/devices/SyrlinksHkHandler.cpp | 13 +++++++++++++ mission/devices/SyrlinksHkHandler.h | 22 +++++++++++++++++++++- tmtc | 2 +- 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/etl b/etl index 1ac3b77e..ae06e641 160000 --- a/etl +++ b/etl @@ -1 +1 @@ -Subproject commit 1ac3b77ef40aa783024d15185ee8ff41ae04a73e +Subproject commit ae06e6417702b770c49289c9e7162cb3f4a5a217 diff --git a/fsfw b/fsfw index e994d81e..7d0916a4 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit e994d81e1862fade52b090311b3978fb59061966 +Subproject commit 7d0916a44e18c87b00998448333023186b3d85b1 diff --git a/mission/devices/SyrlinksHkHandler.cpp b/mission/devices/SyrlinksHkHandler.cpp index 60dc439c..ec83e10b 100644 --- a/mission/devices/SyrlinksHkHandler.cpp +++ b/mission/devices/SyrlinksHkHandler.cpp @@ -184,6 +184,19 @@ std::string SyrlinksHkHandler::convertIntToHexString(uint16_t intValue) { return stream.str(); } +uint8_t SyrlinksHkHandler::convertHexStringToUint8(char* twoChars) { + uint8_t value; + std::string hexString(twoChars, 2); + std::stringstream stream; + stream << std::hex << hexString; + stream >> value; + return value; +} + +uint16_t convertHexStringToUint16(char* fourChars) { + +} + ReturnValue_t SyrlinksHkHandler::parseReplyStatus(const char* status) { switch (*status) { case '0': diff --git a/mission/devices/SyrlinksHkHandler.h b/mission/devices/SyrlinksHkHandler.h index 23a48c13..692be563 100644 --- a/mission/devices/SyrlinksHkHandler.h +++ b/mission/devices/SyrlinksHkHandler.h @@ -80,12 +80,32 @@ private: /** * @brief This function converts an uint16_t into its hexadecimal string representation. * - * @param The value to convert. + * @param intValue The value to convert. * * @return An std::string object containing the hex representation of intValue. */ std::string convertIntToHexString(uint16_t intValue); + /** + * @brief This function converts a hex number represented by to chars to an 8-bit integer. + * + * @param twoChars Pointer to the two characters representing the hex value. + * + * @details E.g. when twoChars points to an array with the two characters "A5" then the function + * will return 0xA5. + * @return The converted integer. + */ + uint8_t convertHexStringToUint8(char* twoChars); + + /** + * @brief This function converts a hex number represented by 4 chars to an uint16_t. + * + * @param Pointer to the fourCharacters representing the 16-bit integer. + * + * @return The uint16_t result. + */ + uint16_t convertHexStringToUint16(char* fourChars); + /** * @brief This function parses the status reply * @param status Pointer to the status information. diff --git a/tmtc b/tmtc index 50c6752b..1d5fe4eb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 50c6752b324c080c9adc3f14e2072d575549c90d +Subproject commit 1d5fe4ebc7165c2a4979c5f9be9cfa0324e366fb