Skip to content

Handle Tollbooth Alerts

Handle tollbooth alerts

This tutorial shows how to handle tollbooth alerts.

Get started

All tollbooth alerts are point alerts, representing that there's a tollbooth 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.tollbooth_alerts)
    {
        // following type is tollbooth alert:
        // tn::drive::models::v1::AlertType::Tollbooth
        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;

        showAlertIconOnMap(id, type, alert.point.location);
    }
}