|
67 | 67 |
|
68 | 68 | static void App_cmdRspChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData);
|
69 | 69 | static void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData);
|
| 70 | +static void App_statusChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData); |
70 | 71 |
|
71 | 72 | /******************************************************************************
|
72 | 73 | * Local Variables
|
@@ -234,6 +235,16 @@ void App::setErrorState()
|
234 | 235 | m_systemStateMachine.setState(&ErrorState::getInstance());
|
235 | 236 | }
|
236 | 237 |
|
| 238 | +void App::systemStatusCallback(SMPChannelPayload::Status status) |
| 239 | +{ |
| 240 | + if (SMPChannelPayload::STATUS_FLAG_ERROR == status) |
| 241 | + { |
| 242 | + setErrorState(); |
| 243 | + } |
| 244 | + |
| 245 | + m_statusTimeoutTimer.restart(); |
| 246 | +} |
| 247 | + |
237 | 248 | /******************************************************************************
|
238 | 249 | * Protected Methods
|
239 | 250 | *****************************************************************************/
|
@@ -407,6 +418,17 @@ void App::processPeriodicTasks()
|
407 | 418 |
|
408 | 419 | m_statusTimer.restart();
|
409 | 420 | }
|
| 421 | + |
| 422 | + if ((false == m_statusTimeoutTimer.isTimerRunning()) && (true == m_smpServer.isSynced())) |
| 423 | + { |
| 424 | + /* Start status timeout timer once SMP is synced the first time. */ |
| 425 | + m_statusTimeoutTimer.start(STATUS_TIMEOUT_TIMER_INTERVAL); |
| 426 | + } |
| 427 | + else if (true == m_statusTimeoutTimer.isTimeout()) |
| 428 | + { |
| 429 | + /* Not receiving status from RU. Go to error state. */ |
| 430 | + setErrorState(); |
| 431 | + } |
410 | 432 | }
|
411 | 433 |
|
412 | 434 | /******************************************************************************
|
@@ -480,3 +502,20 @@ void App_currentVehicleChannelCallback(const uint8_t* payload, const uint8_t pay
|
480 | 502 | CURRENT_VEHICLE_DATA_CHANNEL_DLC, payloadSize);
|
481 | 503 | }
|
482 | 504 | }
|
| 505 | + |
| 506 | +/** |
| 507 | + * Receives current status of the RU over SerialMuxProt channel. |
| 508 | + * |
| 509 | + * @param[in] payload Status of the RU. |
| 510 | + * @param[in] payloadSize Size of the Status Flag |
| 511 | + * @param[in] userData Instance of App class. |
| 512 | + */ |
| 513 | +void App_statusChannelCallback(const uint8_t* payload, const uint8_t payloadSize, void* userData) |
| 514 | +{ |
| 515 | + if ((nullptr != payload) && (STATUS_CHANNEL_DLC == payloadSize) && (nullptr != userData)) |
| 516 | + { |
| 517 | + const Status* currentStatus = reinterpret_cast<const Status*>(payload); |
| 518 | + App* application = reinterpret_cast<App*>(userData); |
| 519 | + application->systemStatusCallback(currentStatus->status); |
| 520 | + } |
| 521 | +} |
0 commit comments