POI Integration
Contents
Msg_IntegrateCustomPOI
This API is used to draw custom POIs in JSON format on the map.
Supported Since | Minimum Operating System |
---|---|
CoPilot 10.9.0 | Windows 10, Android 4.1 |
Syntax (Prototyped in alkmsg.h)
long Msg_IntegrateCustomPOI(const char* pJson);
alkmsg.cs
public static extern int Msg_IntegrateCustomPOI (byte[] json);
Parameters
Value | Description |
---|---|
pJson | Complete contents of a JSON message describing CoPilot POI sets. This will expect preprocessed POI images for each of the categories. |
JSON Example
[
{
"Name": "my set name",
"Persist": false,
"Replace": true,
"Categories": [
{
"Name": "Custom Fuel",
"MaxZoomLevel": 4,
"Options": 21
},
{
"Name": "Custom Restaurant",
"MaxZoomLevel": 4,
"Options": 21
}
],
"Places": [
{
"Address": {
"StreetAddress": "14807 Crain Hwy",
"City": "Clinton",
"Zip": "20735",
"State": "MD",
"County": null
},
"Coords": {
"Lat": "38.6825",
"Lon": "-76.87278"
},
"PlaceName": "My Restaurant",
"CategoryName": "Custom Restaurant",
"Phone": ""
},
{
"Address": {
"StreetAddress": "1720 Route 309",
"City": "Coopersburg",
"Zip": "18036",
"State": "PA",
"County": null
},
"Coords": {
"Lat": "40.50306",
"Lon": "-75.38667"
},
"PlaceName": "My Fuel Stop",
"CategoryName": "Custom Fuel",
"Info": "",
"Phone": ""
}
]
}
]
Return Values
Value | Description |
---|---|
0 | Indicates a general connection failure |
Greater than 0 | Success and indicated that number of bytes sent successfully to CoPilot |
To receive return codes the callback needs to be set up with Msg.Msg_UpdateOptions(Msg.MSG_ID_GenericInformation, true, false, delOnGenericInformation, Msg.callingConvention.convention_stdcall);
and listen for MSG_IDT_IMPORTPOISET_RESULT, the return values are the payload for that callback.
Return Codes
Value | Description |
---|---|
MSG_IMPORT_POI_SET_SUCCESS | Successful in sending the request to CoPilot. |
MSG_IMPORT_POI_SET_JSON_PARSE_ERROR | JSON parsing failed - ensure a valid json object is being passed |
MSG_IMPORT_POI_SET_INVALID_POI_JSON | JSON has missing/incomplete fields required for POI integration |
MSG_IMPORT_POI_SET_FAILED | General fail code if POI set did not import |
POI JSON field description
The JSON schema is defined below. All fields not marked as Optional are required.
Set
- (array)Name
- (string) - The unique set name; not visible anywhere in CoPilot, used for organizational purposes.Persist
- (bool) Whether the place set and all its data will be serialized to disk and persist through a restart of the CoPilot application. Setting this to false will keep the set in-memory only, and significantly improve the performance of this API by eliminating disk I/O.Replace
- (bool) Whether an existing set with this name will be replaced (all places will be deleted before adding the new places) or whether the new places will be appended to the current set.Deleted
- (bool) Will delete a current set with the same name.Categories
- (array)Name
- (string) The name of the POI category. Visible in CoPilot in the POI Search dialog as long as at least one place mapped to this category exists on the device.Icon
- (string; optional) The name of the alk place category icon that will be used when display this category. If this value is not provided, CoPilot will search user provided images for one with the category name.MaxZoomLevel
- (integer) The maximum zoom level that POIs of this category will be visible on the map. Range is 0 (zoomed in to a very small portion of the map) to 7 (zoomed out to a much larger portion of the map.)Options
- (integer) Bitwise OR of three possible values. Use 21 to enable all options.- 1 - Display on Map
- 4 - Searchable Whether this category appears in the POI search dialog
- 16 - Alertable Whether this category appears in the POI alert settings
Places
- (array)Address
- (object) Displayed when viewing the POIStreetAddress
- (string; optional; 128 char max)City
- (string; optional; 128 char max)Zip
- (string; optional; 16 char max)State
- (string; optional; 4 char max) State (US) or Country (EU) abbreviationCounty
- (string; optional; 64 char max)
Coords
- (object) Used to draw the POI on the map, and when routing to the POILat
- (string) decimal degrees, positive for North, negative for SouthLon
- (string) decimal degrees, positive for East, negative for West
CategoryName
- (string) Assigns this POI to a category (category name must exist in the category array described above for this set).PlaceName
- (string; 128 char max); Displayed when viewing the POI.Phone
- (string; optional; 64 char max) Displayed when viewing the POI.
Msg_ImportPOISet
This API is used to send xml files that contain POI set details to import into CocPilot using Msg_SendGenericTextData API
Supported Since | Minimum Operating System |
---|---|
CoPilot 9.6.8 | Windows 10, Android 4.1 |
Syntax (Prototyped in alkmsg.h)
int Msg_ImportPOISet(int setid, char* data, int strlength);
Parameters
Value | Description |
---|---|
setid | Messaging identifier e.g. MSG_IDT_IMPORTPOISET |
data | Xml file content |
strlength | The length of the xml file content |
functionName | Name of the function to call when message arrives |
Msg_SendGenericTextData | Msg_SendGenericTextData is calling/invoking with messaging Identifier “MSG_IDT_IMPORTPOISET”, xml content and the length. |
Return Value
- Equal to or less than 0 - Failed
- Greater than 0 - Successful
Sample Code
Msg_DeletePOISet
This API is used to delete POI set. This API is used to send xml file contains POI set details to be deleting using Msg_SendGenericTextData API.
Supported Since | Minimum Operating System |
---|---|
CoPilot 9.2.0 | Windows 10, Android 4.1 |
Syntax (Prototyped in alkmsg.h)
int Msg_DeletePOISet(char* data, int strlength);
Parameters
Value | Description |
---|---|
data | Xml file content |
strlength | The length of the xml file content |
functionName | Name of the function to call when message arrives |
Msg_SendGenericTextData | Msg_SendGenericTextData is calling/invoking with messaging Identifier “MSG_IDT_IMPORTPOISET”, xml content and the length. |
Return Value
- Equal to or less than 0 - Failed
- Greater than 0 - Successful
Sample Code