Skip to content
Snippets Groups Projects
Commit 520e1fa7 authored by Stelios Tzelepis's avatar Stelios Tzelepis
Browse files

Merge branch 'read-time' into 'master'

Read CUC time format

See merge request acubesat/obc/ecss-services!98
parents 92d81c1f 30ac1999
No related branches found
No related tags found
No related merge requests found
...@@ -535,6 +535,16 @@ public: ...@@ -535,6 +535,16 @@ public:
return reinterpret_cast<double&>(value); return reinterpret_cast<double&>(value);
} }
/**
* Fetches a timestamp in a custom CUC format consisting of 8 bytes from the current position in the message
*/
Time::CustomCUC_t readCustomCUCTimeStamp() {
Time::CustomCUC_t customCUC_t;
customCUC_t.elapsed100msTicks = readUint64();
return customCUC_t;
}
/** /**
* Fetches a N-byte string from the current position in the message * Fetches a N-byte string from the current position in the message
* *
...@@ -744,5 +754,9 @@ template <> ...@@ -744,5 +754,9 @@ template <>
inline double Message::read() { inline double Message::read() {
return readDouble(); return readDouble();
} }
template <>
inline Time::CustomCUC_t Message::read() {
return readCustomCUCTimeStamp();
}
#endif // ECSS_SERVICES_PACKET_H #endif // ECSS_SERVICES_PACKET_H
...@@ -188,6 +188,21 @@ TEST_CASE("Append a CUC timestamp") { ...@@ -188,6 +188,21 @@ TEST_CASE("Append a CUC timestamp") {
} }
} }
TEST_CASE("Read a CUC timestamp") {
/**
* Append a custom CUC Time Stamp to a message object and check if is it read corretly
*/
Time::CustomCUC_t timeCUC;
timeCUC.elapsed100msTicks = 34511;
Message message(0, 0, Message::TC, 0);
message.appendCustomCUCTimeStamp(timeCUC);
auto returnTimeCUC = message.readCustomCUCTimeStamp();
REQUIRE(returnTimeCUC.elapsed100msTicks == 34511);
}
TEST_CASE("Requirement 7.3.8 (Octet-string)", "[message][ecss]") { TEST_CASE("Requirement 7.3.8 (Octet-string)", "[message][ecss]") {
Message message(0, 0, Message::TC, 0); Message message(0, 0, Message::TC, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment