SDK Programming interface details

The programming interface consists of the following functions, callable from C or C++.

 

MMAPI_API int MM_Start(bool run_mmnav);

// Initialize the library. If run_mmnav is true, launch MMNav if it is not already running.

//  NB: run_mmnav is currently unsupported on WinCE

 

MMAPI_API int MM_End(bool close_mmnav);    

// Closes the library. If close_mmnav is true, MMNav is closed.

 

MMAPI_API int MM_ShowWindow(int cmd);     

// Control the MMNav main window. cmd is SW_SHOW, SW_MINIMIZE, etc.

 

MMAPI_API int MM_SetWindow(double max_lat, double min_lat, double max_lon, double min_lon);

// MMNav zooms to the approximate area requested, loading an

// appropriate map, if needed. If max_lat==min_lat and

// max_lon==min_lon, then this point is placed at the

// center of the window in the largest available scale

// map. Note: The zoom level is limited to factors of two, and

// the size and shape of the window are not changed by this function.

 

MMAPI_API int MM_GetCurrentPosition(double *lat, double *lon,

double *course, double *speed, double *altitude);

// Returns the most recent position received from GPS. Pass NULL if you are not interested

//  in all returned values

 

MMAPI_API int MM_SetCurrentPosition(double lat, double lon,

double course, double speed, double altitude, int valid);

// Sets the current position object.

//  NB. The GPS in MMnav should be set to "None" when using this function.

//  The if valid is non-zero, the icon is shown in red, and the central dot

//  alternates on and off with each call. If valid is zero, the icon is shown

//  in grey. The API only supports a single Position object.

 

MMAPI_API int MM_ObjFind(const TCHAR *name, int type, HANDLE *h);

// Returns a handle of an object with matching name and type

//  Wildcards (* and ?) are allowed in the name. h is an in/out

//  parameter: Call with h==NULL first time, then with the returned

//  handle, and so on until the return value is NULL. The

//  objects are returned in the reverse order of creation,

//  i.e., the most recently created object is returned

//  first. Type is MM_OT... values below.

 

MMAPI_API int MM_ObjGetType(HANDLE h, int *type);

// returns one of the following in *type.

#define MM_OT_UNKNOWN -1

#define MM_OT_ANY -1

#define MM_OT_MARKWP 1

#define MM_OT_ROUTE 2

#define MM_OT_TRACK 4

#define MM_OT_POSITION 8

#define MM_OT_CHART 16

#define MM_OT_TEXT 32

 

MMAPI_API int MM_ObjGetName(HANDLE h, TCHAR *name, int max_chars);

// Returns the name of the object;

 

MMAPI_API int MM_ObjDelete(HANDLE h);

// Object is permanently deleted from mmnav, even if it is locked

//  NB. When you delete a Route object, all the waypoints that

//  are not locked are are not part of any other routes are

//  also deleted.

 

MMAPI_API int MM_ObjRename(HANDLE h, const TCHAR *name);

// Rename object.

 

MMAPI_API int MM_ObjLock(HANDLE h, bool locked);

// Control whether user can change/delete the object.

 

MMAPI_API int MM_ObjVisible(HANDLE h, bool visible);

// Control whether object is visible or hidden.

 

MMAPI_API int MM_ObjGetCategory(HANDLE h, TCHAR *category, int max_chars);

// Returns the category of the object;

 

MMAPI_API int MM_ObjSetCategory(HANDLE h, const TCHAR *category);

// Change the object's category

 

MMAPI_API int MM_AddIcon(const TCHAR *bmp_filename, int id);

// Adds the mark/WP icon with the specified ID.

// This just registers the icon image. Use MM_MarkCreate to create a mark that uses the icon.

// The file must be a BMP 32x32 pixels, 16-color.

// Use a full pathname, not a relative path.

// The ID must be > 100.

 

MMAPI_API int MM_RemoveIcon(int id);

// Remove the icon with that id. Any marks that use this icon default

// to a plain dot.

 

MMAPI_API int MM_MarkCreate(const TCHAR *name, double lat, double lon, int icon_id, HANDLE *h);

// Create a new mark / waypoint. The icon_id is one of the mm_smbl values below, or an icon id

//  defined with MM_AddIcon()

 

MMAPI_API int MM_MarkMove(HANDLE h, double lat, double lon);

// Change the position of a mark / waypoint

 

MMAPI_API int MM_MarkGetPosition(HANDLE h, double *lat, double *lon);

// Return the lat/lon of the mark / waypoint

 

MMAPI_API int MM_MarkLinkFile(HANDLE h, const TCHAR *filename);

// Set the mark's HotSpot link to the given filename.

 

MMAPI_API int MM_MarkGetLinkFile(HANDLE h, TCHAR *filename, int max_chars);

// Returns the full path of the linked filename

 

MMAPI_API int MM_MarkSetIcon(HANDLE h, int id);

// Change the mark's symbol icon.

 

MMAPI_API int MM_MarkSetRadius(HANDLE h, float radius, int alarm_type);

// Radius in meters, alarm_type is one of:

//  0=>no circle shown 1=>show circle with no alarm (grey),

//  2=>proximity alarm (red), 3=>anchor alarm (green)

 

MMAPI_API int MM_RouteCreate(COLORREF color, HANDLE *h);

// Creates an empty route. Color is ignored in the current version.

// the handle is returned in h

 

MMAPI_API int MM_RouteAdd(HANDLE hRoute, HANDLE hMark);

// Adds the WP (created with MM_MarkCreate) to the route.

 

MMAPI_API int MM_RouteGetWP(HANDLE hRoute, int i, HANDLE *h);

// Returns waypoint handle at position i in the route

//  i==0 is the first WP. h is returned NULL if i is >=

// the number of WP.

 

MMAPI_API int MM_TrackCreate(TCHAR *name, COLORREF color, bool closed_polygon, HANDLE *h);

// Creates an empty track

 

MMAPI_API int MM_TrackAdd(HANDLE hTrack, int n, double *lat, double *lon,

  unsigned int *times, float *altitude);

// Adds n points to the end of the track.

//  time is in seconds since Jan 1, 1970.

//  time and/or altitude may be null.

 

MMAPI_API int MM_TrackGetNumPoints(HANDLE hTrack, int *n);

// returns via n the number of points in the track

 

MMAPI_API int MM_TrackGetPoints(HANDLE hTrack, int start, int n,

double *lat, double *lon, unsigned int *times, float *altitude);

// returns n track data points, starting from the zero-based index 'start'

// times and/or altitude pointers may be NULL

 

// All functions return one of the following Error codes

#define MMERR_OK 0

#define MMERR_NOT_RUNNING 1

#define MMERR_API_INUSE 2

#define MMERR_LAUNCH_FAILED 3

#define MMERR_BAD_HWND 4

#define MMERR_NO_MAP 5

#define MMERR_HANDSHAKE_ERR 6

#define MMERR_TIMEOUT 7

#define MMERR_FILE_ERR 8

#define MMERR_STRING_TRUNC  9

#define MMERR_LICENSE 10

#define MMERR_NOT_IMPLEMENTED 11

#define MMERR_NOT_AVAILABLE 12

#define MMERR_BAD_HANDLE    13

#define MMERR_FAILED        14

#define MMERR_BAD_INPUT     15