| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title Timer.cpp | ||
| 3 | // \author Brian Campuzano | ||
| 4 | // \brief cpp file for the Timer class implementation | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #include <Svc/Ccsds/CfdpManager/Timer.hpp> | ||
| 8 | |||
| 9 | #include <Fw/Types/Assert.hpp> | ||
| 10 | |||
| 11 | namespace Svc { | ||
| 12 | namespace Ccsds { | ||
| 13 | namespace Cfdp { | ||
| 14 | |||
| 15 | // ---------------------------------------------------------------------- | ||
| 16 | // Class construction and destruction | ||
| 17 | // ---------------------------------------------------------------------- | ||
| 18 | |||
| 19 | 27510 | Timer ::Timer() : timerStatus(UNINITIALIZED), secondsRemaining(0) {} | |
| 20 | |||
| 21 | 27510 | Timer ::~Timer() {} | |
| 22 | |||
| 23 | // ---------------------------------------------------------------------- | ||
| 24 | // Class interfaces | ||
| 25 | // ---------------------------------------------------------------------- | ||
| 26 | |||
| 27 | 277 | void Timer ::setTimer(U32 timerDuration) { | |
| 28 | 277 | this->timerStatus = RUNNING; | |
| 29 | 277 | this->secondsRemaining = timerDuration; | |
| 30 | 277 | } | |
| 31 | |||
| 32 | 26252 | void Timer ::disableTimer(void) { | |
| 33 | 26252 | this->timerStatus = EXPIRED; | |
| 34 | 26252 | this->secondsRemaining = 0; | |
| 35 | 26252 | } | |
| 36 | |||
| 37 | 353 | Timer::Status Timer ::getStatus(void) { | |
| 38 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 353 times.
|
353 | return this->timerStatus; |
| 39 | } | ||
| 40 | |||
| 41 | 194 | void Timer ::run(void) { | |
| 42 |
2/4✗ Branch 1 not taken.
✓ Branch 2 taken 194 times.
✓ Branch 3 taken 194 times.
✗ Branch 4 not taken.
|
194 | if (this->timerStatus == RUNNING) { |
| 43 | 194 | FW_ASSERT(this->secondsRemaining > 0); | |
| 44 | 194 | this->secondsRemaining--; | |
| 45 | |||
| 46 |
2/2✓ Branch 2 taken 43 times.
✓ Branch 3 taken 151 times.
|
194 | if (this->secondsRemaining == 0) { |
| 47 | 43 | this->timerStatus = EXPIRED; | |
| 48 | } | ||
| 49 | } | ||
| 50 | 194 | } | |
| 51 | |||
| 52 | } // namespace Cfdp | ||
| 53 | } // namespace Ccsds | ||
| 54 | } // namespace Svc | ||
| 55 |