This commit is contained in:
Robin Müller 2022-11-11 14:13:46 +01:00
parent 61fd5d1b62
commit 2b6a33e718
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 9 additions and 10 deletions

View File

@ -247,16 +247,14 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
} }
ReturnValue_t CCSDSTime::convertToAsciiWithSecs(int8_t* to, const Clock::TimeOfDay_t* from, ReturnValue_t CCSDSTime::convertToAsciiWithSecs(int8_t* to, const Clock::TimeOfDay_t* from,
uint8_t length) { uint8_t length) {
if(from == nullptr or to == nullptr) { if (from == nullptr or to == nullptr) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
int count = snprintf(reinterpret_cast<char*>(to), length, int count = snprintf(reinterpret_cast<char*>(to), length,
"%4" SCNu32 "-%2" SCNu32 "-%2" SCNu32 "%4" SCNu32 "-%2" SCNu32 "-%2" SCNu32 "T%2" SCNu32 ":%2" SCNu32 ":%2" SCNu32,
"T%" from->year, from->month, from->day, from->hour, from->minute, from->second);
"2" SCNu32 ":%2" SCNu32 ":%2" SCNu32, if (count >= length) {
from->year, from->month, from->day, from->hour, from->minute, from->second);
if(count >= length) {
return returnvalue::FAILED; return returnvalue::FAILED;
} }
return returnvalue::OK; return returnvalue::OK;

View File

@ -207,7 +207,8 @@ class CCSDSTime {
static ReturnValue_t convertFromASCII(Clock::TimeOfDay_t *to, uint8_t const *from, static ReturnValue_t convertFromASCII(Clock::TimeOfDay_t *to, uint8_t const *from,
uint8_t length); uint8_t length);
static ReturnValue_t convertToAsciiWithSecs(int8_t *to, const Clock::TimeOfDay_t *from, uint8_t length); static ReturnValue_t convertToAsciiWithSecs(int8_t *to, const Clock::TimeOfDay_t *from,
uint8_t length);
static uint32_t subsecondsToMicroseconds(uint16_t subseconds); static uint32_t subsecondsToMicroseconds(uint16_t subseconds);
private: private:

View File

@ -3,7 +3,7 @@
#include <fsfw/serviceinterface.h> #include <fsfw/serviceinterface.h>
SerialCookie::SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate, SerialCookie::SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
size_t maxReplyLen, UartModes uartMode) size_t maxReplyLen, UartModes uartMode)
: handlerId(handlerId), : handlerId(handlerId),
deviceFile(deviceFile), deviceFile(deviceFile),
uartMode(uartMode), uartMode(uartMode),

View File

@ -30,7 +30,7 @@ class SerialCookie : public CookieIF {
* One stop bit * One stop bit
*/ */
SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate, SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate,
size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL); size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL);
virtual ~SerialCookie(); virtual ~SerialCookie();