Hud API
Introduction
You can obtain rich navigation status data from Sygic Navigation on the go and use it for your specific needs of visualization.
It can be e.g. your own Head Up Display solution, or maybe you want to broadcast the data on a car-integrated MFD device.
We commonly call this feature as Head Up Display interface.
Typically you can provide drivers with a simplified navigation turn-by-turn instructions represented by direction control visualisation together with showing the distance to the turn to be taken, and/or a time to travel or distance to travel information, etc.
On the following picture you may see the possible exploitation of our API for an embedded display projection.
Getting started
1. Gaining access
In order to gain the access to the functionality you will need a special license. In order to obtain the license please Contact our sales.
You will obtain the trial license for navigation, which will open the API for exploiting the HUD interface.
In case of double please verify:
- the navigation license file (mlm or content.info) must contain the HUD permission: extHud=yes
(if your license does not contain the HUD permission you should contact your sales representative)
2. Usage template
To get real-time data from Sygic navigation you can use the following class implementation.
You need to register a BroadcastReceiver with IntentFilter "com.sygic.intent.ACTION_HUD_UPDATE".
Intent extras contains the HUD data as a bundle you can exploit.
To get a particular data from the bundle you need to know a key and the data type.
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
public class SygicUpdatesReceiver extends BroadcastReceiver {
public static final String INTENT_ACTION_UPDATE= "com.sygic.intent.ACTION_HUD_UPDATE";
@Override
public void onReceive(Context context, Intent intent) {
Bundle hudData = intent.getExtras();
// parse selected data & send it to your device
String sval = getStringValue(hudData, "NextStreet");
// send sval to your device
}
private string getStringValue(Bundle hudData, String key) {
if (hudData.containsKey(key)) {
return hudData.getString(key);
}
return null;
}
}
In order to instantiate the SygicUpdateReceiver in your application context you can exploit the following pattern:
import android.app.Activity;
import android.content.IntentFilter;
...
public class MainActivity extends Activity {
private SygicUpdatesReceiver mSygicReceiver;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
...
mSygicReceiver = new SygicUpdatesReceiver();
IntentFilter filter = new IntentFilter(SygicUpdatesReceiver.INTENT_ACTION_UPDATE);
registerReceiver(mSygicReceiver, filter);
}
@Override
protected void onDestroy() {
unregisterReceiver(mSygicReceiver);
...
}
}
Received data structure
Bundle data
This bundle data retrieved through the OnReceive callback function contains the following data structure:
type | Key | Description |
---|---|---|
integer | LengthToInstruction | Distance to next instruction |
integer | LengthTotal | Total distance to destination |
integer | LengthPassed | Distance travelled. |
integer | ETA | Estimated Time of Arrival. |
integer | SpeedLimit | Speed Limit on current location. |
integer | TimeDelay | Time delay caused by traffic on route. |
integer | TimeRemaining | Remaining time to destination. |
integer | TimeToInstruction | Time to next instruction. |
integer | VehicleSpeed | Current speed of vehicle. |
integer | Speeding | Boolean to check speed exceeding.
|
integer | USA | is the current location USA
|
integer | GPSSignal | GPS signal strength enumeration.
|
integer | Traffic | Traffic data enumeration.
|
integer | Warning | Warning enumerations, each warning is represented by a number.
|
string | City | Name of the city. |
string | Street | Name of the street. |
string | NextStreet | Next street name. |
string | LeftNumber | Numbers of buildings on left side of the road. |
string | RightNumber | Numbers of buildings on right side of the road. |
string | RoadNumbers | Unique road number. |
integer | LanesDistance | Distance to travel in current lane. |
integer | LanesmapIndex | Integer, for current map Index. |
integer | LanesCount | Number of data stored about lane. |
long array | LaneData[n] | Array of data available for current lane. |
long array | LaneRoadIDs | Array of road IDs for particular lane. |
integer | DirValidPrimary | Checks validity of primary command. We do not recommend to use primary command if bDirValidPrimary is false (0), true (1). |
integer | DirValidSecondary | Checks validity of secondary command. We do not recommend to use secondary command if bDirValidSecondary is false (0), true (1). |
integer | DirCommandPrimary | Upcoming instruction command, executed if bDIRValidPrimary true. |
integer | DirCommandSecondary | Next to upcoming instruction command, executed if bDIRValidSecondary true. |
integer | DirDistance | Distance to next instruction. |
integer | RBExitPrimary | Determines primary exit from a roundabout. |
integer | RBExitSecondary | Determines secondary exit from a roundabout. |
integer | CharsCount | Number of characters stored in an array. |
integer array | PrimaryChars | Array of characters used for the coming (next) instruction. See charset below. |
integer array | SecondaryChars | Array of characters used for the second coming (next next) instruction. See charset below. |
string | MapVersion | reports the current map version |
string | AppVersion | reports the running app version, e.g. 13.8.7 |
string | BuildVersion | reports the build version of the app, e.g. R-14339 |
string | DeviceName | reports the identification of the device, typically IMEI |
arrLaneData[n]
From each LaneData you can obtain the following information using these functions.
Function | Body | Description |
---|---|---|
GetLineType() | return m_lData & 0x7 | To get line type. |
GetSymbol() | return ( ( m_lData >> 4 ) & 0xfff | Returns symbol for current lane. |
IsExitEntrance() | return ( ( m_lData >> 3 ) & 0x1 ) == 1; | True - exit, False - entrance |
IsHighlighted() | return ( ( m_lData >> 31 ) & 0x1 ) == 1; | True - lane highlighted, False - not highlighted lane |
IsInverse() | return ( ( m_lData >> 30 ) & 0x1 ) == 1; | Whether lane is inverse. |
Charset font
The charset codes retrieved through the bundle data define the graphical symbols as shown in the table bellow.
- Previous article: Sidebar API
- Next article: Municipal API