/*===========================================================================
FILE: 
   QmiCATAPI.h

DESCRIPTION:
   QMI Position Determination Service APIs. Service type 0x06

Copyright (C) 2015 Sierra Wireless Incorporated. All rights reserved.
                   Sierra Wireless Proprietary/GTDR
==========================================================================*/

#ifndef __QMI_PDS_API_H__
#define __QMI_PDS_API_H__
/*=========================================================================*/
// Definitions
/*=========================================================================*/

/** 
* \defgroup GroupPDS Position Determination Service
*/
/*@{*/

/*=========================================================================*/
// Structs
/*=========================================================================*/
#ifdef __cplusplus
	extern "C" {
#endif

#ifdef __cplusplus
	};
#endif

/*=========================================================================*/
// Prototypes
/*=========================================================================*/

//////////////////////////////////////////////////////////////////////////////
///
/// This function enables/disables the PDS service state callback function
/// QMI_PDS_GPS_SERVICE_STATE_IND_MSG 0x20
/// 
/// \param	pCallback   [ I ] - Callback function (0 = disable)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetPDSStateCallback( tFNPDSState pCallback );

//////////////////////////////////////////////////////////////////////////////
///
/// This function enables/disables the NMEA sentence callback function
/// QMI_PDS_SET_EVENT_REPORT 0x0001
/// 
/// \param	pCallback   [ I ] - Callback function (0 = disable)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetNMEACallback( tFNNewNMEA pCallback );

//////////////////////////////////////////////////////////////////////////////
///
/// This function enables/disables the NMEA sentence plus mode 
/// callback function
/// 
/// \param	pCallback   [ I ] - Callback function (0 = disable)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
QCIMPORT2K ULONG QCWWANAPI2K SetNMEAPlusCallback( tFNNewNMEAPlus pCallback );

//////////////////////////////////////////////////////////////////////////////
///
/// This function returns the automatic tracking state for the service
/// QMI_PDS_GET_AUTO_TRACKING_STATE_MSG 0x0030
/// 
/// \param	pbAuto      [ O ] - Automatic tracking session started for service?
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetServiceAutomaticTracking( ULONG * pbAuto );

//////////////////////////////////////////////////////////////////////////////
///
/// This function sets the automatic tracking state for the service
/// QMI_PDS_SET_AUTO_TRACKING_STATE_MSG 0x0031
/// 
/// \param	bAuto      [ I ] - Start automatic tracking session for service?
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetServiceAutomaticTracking( ULONG bAuto );

//////////////////////////////////////////////////////////////////////////////
///
/// This function returns the automatic tracking configuration for the NMEA
/// COM port
/// QMI_PDS_GET_COM_PORT_CONFIG_MSG 0x0032
/// 
/// \param	pbAuto      [ O ] - Automatic tracking enabled for NMEA COM port?
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetPortAutomaticTracking( ULONG * pbAuto );

//////////////////////////////////////////////////////////////////////////////
///
/// This function sets the automatic tracking configuration for the NMEA
/// COM port
/// QMI_PDS_SET_COM_PORT_CONFIG_MSG 0x0033
/// 
/// \param	bAuto      [ I ] - Enable automatic tracking for NMEA COM port?
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetPortAutomaticTracking( ULONG bAuto );

//////////////////////////////////////////////////////////////////////////////
///
/// This function resets the specified PDS data
/// QMI_PDS_RESET_GPS_SERVICE_DATA_MSG 0x0034
/// 
/// \param	pGPSDataMask   [ I ] - Bitmask of GPS data to clear (optional)
/// \param	pCellDataMask  [ I ] - Bitmask of cell data to clear (optional)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI ResetPDSData( 
   ULONG *                    pGPSDataMask,
   ULONG *                    pCellDataMask );

//////////////////////////////////////////////////////////////////////////////
///
/// This function gets the network type for AGPS commands
/// 
/// \param	pProtocol      [ O ] - Network mode
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetAGPSProtocol( ULONG * pProtocol );

//////////////////////////////////////////////////////////////////////////////
///
/// This function sets the network type for AGPS commands
///
/// \param	protocol       [ I ] - Network mode
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetAGPSProtocol( ULONG protocol );

//////////////////////////////////////////////////////////////////////////////
///
/// This function returns the PDS AGPS configuration
/// QMI_PDS_GET_AGPS_CONFIG_MSG 0x002E 
///
/// \param	pServerAddress [ O ] - IPv4 address of AGPS server
/// \param	 pServerPort    [ O ] - Port number of AGPS server
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetAGPSConfig( 
   ULONG *                    pServerAddress,
   ULONG *                    pServerPort );

//////////////////////////////////////////////////////////////////////////////
///
/// This function sets the PDS AGPS configuration
/// QMI_PDS_SET_AGPS_CONFIG_MSG 0x002F
///  
/// \param	serverAddress [ I ] - IPv4 address of AGPS server
/// \param	serverPort    [ I ] - Port number of AGPS server
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetAGPSConfig( 
   ULONG                      serverAddress,
   ULONG                      serverPort );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the XTRA time positioning state
///
/// \param	pState      [ O ] - XTRA time positioning state
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetXTRATimeState( ULONG * pState );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the XTRA time positioning state
///QMI_PDS_SET_POSITION_METHOD_STATE_MSG 0x0051
/// 
/// \param	state       [ I ] - XTRA time positioning state
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetXTRATimeState( ULONG state );

//////////////////////////////////////////////////////////////////////////////
///
///This function forces the XTRA database to be downloaded to the device
///QMI_PDS_FORCE_XTRA_DOWNLOAD_MSG 0x002D
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI ForceXTRADownload();

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the XTRA data positioning state
///QMI_PDS_GET_POSITION_METHOD_STATE_MSG 0x0050
///
/// \param	pState      [ O ] - XTRA data positioning state
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetXTRADataState( ULONG * pState );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the XTRA data positioning state
/// \param	state       [ I ] - XTRA data positioning state
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetXTRADataState( ULONG state );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the XTRA database validity period
///QMI_PDS_GET_XTRA_PARAMETERS_MSG 0x002B
///
/// \param	pGPSWeek       [ O ] - Starting GPS week of validity period
/// \param	pGPSWeekOffset [ O ] - Starting GPS week offset (minutes) of validity period
/// \param	pDuration      [ O ] - Length of validity period (hours)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetXTRAValidity(
   USHORT *                   pGPSWeek,
   USHORT *                   pGPSWeekOffset, 
   USHORT *                   pDuration );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the current PDS state
///QMI_PDS_GET_GPS_SERVICE_STATE_MSG =				0x0020
///
/// \param	pEnabled    [ O ] - Current PDS state (0 = disabled)
/// \param	pTracking   [ O ] - Current PDS tracking session state
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetPDSState( 
   ULONG *                    pEnabled,
   ULONG *                    pTracking );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the PDS state
///
/// \param	enable      [ I ] - Desired PDS state (0 = disable)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetPDSState( ULONG enable );

//////////////////////////////////////////////////////////////////////////////
///
///This function injects a system time into the PDS engine
///QMI_PDS_INJECT_TIME_REF_MSG =						0x0028
///
/// \param	systemTime              [ I ] - System time
/// \param	systemDiscontinuities   [ I ] - Number of system time discontinuities
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI PDSInjectTimeReference( 
   ULONGLONG                  systemTime,
   USHORT                     systemDiscontinuities );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the default tracking session configuration
///QMI_PDS_GET_DEFAULT_TRACKING_SESSION_MSG =		0x0029
///
/// \param	pOperation  [ O ] - Current session operating mode 
/// \param	pTimeout    [ O ] - Maximum amount of time (seconds) to work on each fix
/// \param	pInterval   [ O ] - Interval (milliseconds) between fix requests
/// \param	pAccuracy   [ O ] - Current accuracy threshold (meters)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetPDSDefaults( 
   ULONG *                    pOperation,
   BYTE *                     pTimeout,
   ULONG *                    pInterval,
   ULONG *                    pAccuracy );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the default tracking session configuration
///QMI_PDS_SET_DEFAULT_TRACKING_SESSION_MSG =		0x002A 
///
/// \param	operation   [ I ] - Desired session operating mode 
/// \param	timeout     [ I ] - Maximum amount of time (seconds) to work on each fix
/// \param	interval    [ I ] - Interval (milliseconds) between fix requests
/// \param	accuracy    [ I ] - Desired accuracy threshold (meters)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetPDSDefaults( 
   ULONG                      operation,
   BYTE                       timeout,
   ULONG                      interval,
   ULONG                      accuracy );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the XTRA automatic download configuration
///QMI_PDS_GET_XTRA_PARAMETERS_MSG =					0x002B
///
/// \param	pbEnabled   [ O ] - Automatic download enabled?
/// \param	pInterval   [ O ] - Interval (hours) between XTRA downloads
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetXTRAAutomaticDownload( 
   ULONG *                    pbEnabled,
   USHORT *                   pInterval );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the XTRA automatic download configuration
///QMI_PDS_SET_XTRA_PARAMETERS_MSG =					0x002C
///
/// \param	bEnabled    [ I ] - Automatic download enabled?
/// \param	interval    [ I ] - Interval (hours) between XTRA downloads
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetXTRAAutomaticDownload( 
   ULONG                      bEnabled,
   USHORT                     interval );

//////////////////////////////////////////////////////////////////////////////
///
///This function returns the XTRA WWAN network preference
///QMI_PDS_GET_XTRA_PARAMETERS_MSG =					0x002B
///
/// \param	pPreference [ O ] - XTRA WWAN network preference
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI GetXTRANetwork( ULONG * pPreference );

//////////////////////////////////////////////////////////////////////////////
///
///This function sets the XTRA WWAN network preference
///QMI_PDS_SET_XTRA_PARAMETERS_MSG =					0x002C
///
/// \param	preference  [ I ] - XTRA WWAN network preference
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
IMPORTGOBI ULONG GOBICMAPI SetXTRANetwork( ULONG preference );   

//////////////////////////////////////////////////////////////////////////////
///
/// This function starts a PDS tracking session(Deprecated)
/// 
/// NOTE: Only one tracking session can be active at any given time
///
/// \param	fixInterval [ I ] - Time in milliseconds between fixes
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
QCIMPORT2K ULONG QCWWANAPI2K StartPDSTrackingSession( ULONG fixInterval );


//////////////////////////////////////////////////////////////////////////////
///
/// This function stops a PDS tracking session(Deprecated)
///
/// \return See GobiErrorCodes.h
///
///////////////////////////////////////////////////////////////////////////////
QCIMPORT2K ULONG QCWWANAPI2K StopPDSTrackingSession();

/*@}*/ // End of PDS group
#endif