Drive Session
Drive Session
Overview
Drive session is a key component in the TA SDK, which provides various information and functionalities for you to build a navigation product that helps people enjoy the experience on the road.
Free Drive Session
When the user is not navigating on a selected route, which we call free mode, drive session will provide information to help the user learn about road situations around them in free mode.
| // create a drive session options with all components enabled
tn::drive::api::DriveSessionOptions options;
options.enable_ADAS = true;
options.enable_alert = true;
options.enable_audio_guidance = true;
options.enable_navigation = true;
// system instance is created for sharing in the whole SDK
// if any of the default settings do not match the requirements, an instance of the setting should be created, which can be nullptr if the default value is good enough.
// mapContent instance is created for sharing in the whole SDK
// directionService instance is created for sharing in the whole SDK
const auto driveSession = tn::drive::api::DriveSessionFactory::createDriveSession(options, system, settings, mapContent, directionService);
|
Navigation Session
When the user selects a route to navigate, drive session will provide turn-by-turn instructions and information along the way.
| // create a navigation session from drive session
// notice: the navigation component must be enabled when creating a drive session
tn::drive::api::NavigationSessionOptions options;
options.enable_ADAS = true;
options.enable_alert = true;
options.enable_audio = true;
// notice: navigation session is created and maintained by drive session
// you MUST NOT delete it or access it after the navigation session is stopped
const auto* navigationSession = driveSession->startNavigation(options, route);
// stop the navigation session when it is no longer needed
driveSession->stopNavigation();
|
Next steps