distinct clock dump events
This commit is contained in:
parent
94bd1ba2ab
commit
a229748aa4
@ -18,18 +18,13 @@ ReturnValue_t Service9TimeManagement::performService() { return returnvalue::OK;
|
|||||||
ReturnValue_t Service9TimeManagement::handleRequest(uint8_t subservice) {
|
ReturnValue_t Service9TimeManagement::handleRequest(uint8_t subservice) {
|
||||||
switch (subservice) {
|
switch (subservice) {
|
||||||
case Subservice::SET_TIME: {
|
case Subservice::SET_TIME: {
|
||||||
reportCurrentTime();
|
reportCurrentTime(CLOCK_DUMP_BEFORE_SETTING_TIME);
|
||||||
ReturnValue_t result = setTime();
|
ReturnValue_t result = setTime();
|
||||||
reportCurrentTime();
|
reportCurrentTime(CLOCK_DUMP_AFTER_SETTING_TIME);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
case Subservice::DUMP_TIME: {
|
case Subservice::DUMP_TIME: {
|
||||||
timeval newTime;
|
reportCurrentTime();
|
||||||
ReturnValue_t result = Clock::getClock_timeval(&newTime);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
triggerEvent(CLOCK_DUMP, newTime.tv_sec, newTime.tv_usec);
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case Subservice::RELATIVE_TIMESHIFT: {
|
case Subservice::RELATIVE_TIMESHIFT: {
|
||||||
@ -38,7 +33,7 @@ ReturnValue_t Service9TimeManagement::handleRequest(uint8_t subservice) {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
reportTime(currentTime);
|
reportTime(CLOCK_DUMP_BEFORE_SETTING_TIME, currentTime);
|
||||||
|
|
||||||
if (currentPacket.getUserDataLen() != 8) {
|
if (currentPacket.getUserDataLen() != 8) {
|
||||||
return AcceptsTelecommandsIF::ILLEGAL_APPLICATION_DATA;
|
return AcceptsTelecommandsIF::ILLEGAL_APPLICATION_DATA;
|
||||||
@ -66,7 +61,7 @@ ReturnValue_t Service9TimeManagement::handleRequest(uint8_t subservice) {
|
|||||||
}
|
}
|
||||||
result = Clock::setClock(&newTime);
|
result = Clock::setClock(&newTime);
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
reportTime(newTime);
|
reportTime(CLOCK_DUMP_AFTER_SETTING_TIME, newTime);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -93,12 +88,12 @@ ReturnValue_t Service9TimeManagement::setTime() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service9TimeManagement::reportCurrentTime() {
|
void Service9TimeManagement::reportCurrentTime(Event event) {
|
||||||
timeval currentTime{};
|
timeval currentTime{};
|
||||||
Clock::getClock(¤tTime);
|
Clock::getClock(¤tTime);
|
||||||
triggerEvent(CLOCK_DUMP, currentTime.tv_sec, currentTime.tv_usec);
|
triggerEvent(event, currentTime.tv_sec, currentTime.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Service9TimeManagement::reportTime(timeval time) {
|
void Service9TimeManagement::reportTime(Event event, timeval time) {
|
||||||
triggerEvent(CLOCK_DUMP, time.tv_sec, time.tv_usec);
|
triggerEvent(event, time.tv_sec, time.tv_usec);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,8 @@ class Service9TimeManagement : public PusServiceBase {
|
|||||||
static constexpr Event CLOCK_SET_FAILURE = MAKE_EVENT(2, severity::LOW);
|
static constexpr Event CLOCK_SET_FAILURE = MAKE_EVENT(2, severity::LOW);
|
||||||
//!< [EXPORT] : [COMMENT] Clock dump event. P1: timeval seconds P2: timeval microseconds.
|
//!< [EXPORT] : [COMMENT] Clock dump event. P1: timeval seconds P2: timeval microseconds.
|
||||||
static constexpr Event CLOCK_DUMP = MAKE_EVENT(3, severity::INFO);
|
static constexpr Event CLOCK_DUMP = MAKE_EVENT(3, severity::INFO);
|
||||||
|
static constexpr Event CLOCK_DUMP_BEFORE_SETTING_TIME = MAKE_EVENT(4, severity::INFO);
|
||||||
|
static constexpr Event CLOCK_DUMP_AFTER_SETTING_TIME = MAKE_EVENT(5, severity::INFO);
|
||||||
|
|
||||||
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_9;
|
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_9;
|
||||||
|
|
||||||
@ -35,8 +37,8 @@ class Service9TimeManagement : public PusServiceBase {
|
|||||||
*/
|
*/
|
||||||
ReturnValue_t handleRequest(uint8_t subservice) override;
|
ReturnValue_t handleRequest(uint8_t subservice) override;
|
||||||
|
|
||||||
void reportCurrentTime();
|
void reportCurrentTime(Event eventType = CLOCK_DUMP);
|
||||||
void reportTime(timeval time);
|
void reportTime(Event event, timeval time);
|
||||||
|
|
||||||
virtual ReturnValue_t setTime();
|
virtual ReturnValue_t setTime();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user