Handle Speed Limit Tightened Alert
Handle speed limit tightened alerts
This tutorial shows how to handle speed limit tightened alerts.
Get started
All speed limit tightened alerts are point alerts, representing that the speed limit changes to lower around the alert location.
| void AlertObserver::onAlertInfoUpdated(const tn::drive::models::v1::AlertInfo& alertInfo)
{
const auto& aheadAlerts = alertInfo.alerts_ahead;
for (const auto& alert : aheadAlerts.speed_limit_tightened_alerts)
{
// following type is speed limit tightened alert:
// tn::drive::models::v1::AlertType::SpeedLimitTightened
const auto type = alert.basic.type;
// each alert item has a unique identifier, can be used to match alert updates
const auto id = alert.basic.id;
// current speed limit
const auto& currentSpeedLimit = alert.camera_info.current_speed_limit;
// the tightened speed limit ahead
const auto& tightenedSpeedLimit = alert.camera_info.tightened_speed_limit;
showSpeedLimitTightenedIconOnMap(id, currentSpeedLimit, tightenedSpeedLimit, alert.point->location);
}
}
|