/**
 * \ingroup loc
 *
 * \file    qaGobiApiLoc.h
 *
 * \brief   Location API function prototypes
 *
 * Copyright: © 2011-2015 Sierra Wireless, Inc. all rights reserved
 *
 */
#ifndef __GOBI_API_LOC_H__
#define __GOBI_API_LOC_H__

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  This structure contains the Parameter for RegisterEvents
 *
 *  \param  pEventRegMask
 *          - Specifies the events that the control point is interested
 *          in receiving.
 *          -Values
 *             - 0x00000001 - to receive position report event
 *                            indications
 *             - 0x00000002 - to receive satellite report event
 *                            indications
 *             - 0x00000004 - to receive NMEA reports for position
 *                            and satellites in view
 *             - 0x00000008 - to receive NI Notify/Verify request
 *                            event indications
 *             - 0x00000010 - to receive time injection request
 *                            event indications.
 *             - 0x00000020 - to receive predicted orbits request
 *                            event indications.
 *             - 0x00000040 - to receive position injection request
 *                            event indications.
 *             - 0x00000080 - to receive fix session status report
 *                            event indications.
 *             - 0x00000200 - to receive Wi-Fi position request
 *                            event indications.
 *             - 0x00000400 - to receive notifications from the
 *                            location engine indicating its readiness
 *                            to accept data from the sensors
 *             - 0x00000800 - to receive time sync requests from
 *                            the GPS engine. Time sync enables the
 *                            GPS engine to synchronize its clock
 *                            with the sensor processor’s clock.
 *             - 0x00001000 - to receive Stationary Position Indicator (SPI)
 *                            streaming report indications.
 *             - 0x00002000 - to receive location server requests.
 *                            These requests are generated when
 *                            the service wishes to establish a
 *                            connection with a location server.
 *             - 0x00004000 - to receive notifications related
 *                            to network-initiated Geofences. These
 *                            events notify the client when a network-initiated
 *                            Geofence is added, deleted, or edited.
 *             - 0x00008000 - to receive Geofence alerts. These alerts
 *                            are generated to inform the client of
 *                            the changes that may affect a Geofence,
 *                            e.g., if GPS is turned off or if the
 *                            network is unavailable.
 *             - 0x00010000 - to receive notifications when a Geofence
 *                            is breached. These events are generated
 *                            when a UE enters or leaves the perimeter
 *                            of a Geofence. This breach report is for
 *                            a single Geofence.
 *             - 0x00020000 - to register for pedometer control requests
 *                            from the location engine. The location
 *                            engine sends this event to control the
 *                            injection of pedometer reports.
 *             - 0x00040000 - to register for motion data control requests
 *                            from the location engine. The location
 *                            engine sends this event to control the
 *                            injection of motion data.
 *             - 0x00080000 - to receive notification when a batch is full.
 *                            The location engine sends this event to
 *                            notify of Batch Full for ongoing batching
 *                            session.
 *             - 0x00100000 - to receive position report indications
 *                            along with an ongoing batching session.
 *                            The location engine sends this event to
 *                            notify the batched position report while
 *                            a batching session is ongoing.
 *             - 0x00200000 - to receive Wi-Fi Access Point (AP) data
 *                            inject request event indications.
 *             - 0x00400000 - to receive notifications when a Geofence
 *                            is breached. These events are generated
 *                            when a UE enters or leaves the perimeter
 *                            of a Geofence. This breach notification
 *                            is for multiple Geofences. Breaches from
 *                            multiple Geofences are all batched and
 *                            sent in the same notification.
 *             - 0x00800000 - to receive notifications from the location
 *                            engine indicating its readiness to accept
 *                            vehicle data (vehicle accelerometer,
 *                            vehicle angular rate, vehicle odometry, etc.).
 *             - 0x01000000 - to receive system clock and satellite
 *                            measurement report events (system clock,
 *                            SV time, Doppler, etc.).
 *             - 0x02000000 - to receive satellite position reports
 *                            as polynomials.
 *
 */

typedef struct
{
	ULONGLONG eventRegister;
} LOCEventRegisterReqResp;

/**
 *  This structure contains the Parameter External Power Source State.
 *
 *  \param  pLOCEventRegisterReqResp
 *          - Specifies the Power state; injected by the control
 *            point.
 *          - Values
 *             - 0 - Device is not connected to an external power
 *                   source
 *             - 1 - Device is connected to an external power source
 *             - 2 - Unknown external power state
 */

typedef struct
{
	ULONG extPowerState;
} LOCExtPowerStateReqResp;

/**
 * This structure contains the Application Information
 *
 * \param appProviderLength
 *        - Length of the Application Provider
 *
 * \param pAppProvider
 *        - Application Provider
 *        - Depends upon the Length of application Provider
 *
 * \param appNameLength
 *        - Length of Application Name
 *
 * \param pAppName
 *        - Application Name
 *        - Depends upon the Length of application Name
 *
 * \param appVersionValid
 *        - Specifies whether the application version string contains a
 *        valid value
 *
 *        - 0x00 (FALSE) – Application version string is invalid
 *        - 0x01 (TRUE) – Application version string is valid
 *
 * \param appVersionLength
 *        - Length of Application Version
 *
 * \param pAppVersion
 *        - Application Version
 *        - Depends upon the Length of application Version
 *
 */

struct LocApplicationInfo
{
    BYTE appProviderLength;
    CHAR *pAppProvider;
    BYTE appNameLength;
    CHAR *pAppName;
    BYTE appVersionValid;
    CHAR appVersionLength;
    CHAR *pAppVersion;
};

/**
 * This structure contains the LOC Start Request
 *
 * \param SessionId
 *        - ID of the session as identified by the control point.
 *        - Range: 0 to 255
 *
 * \param pRecurrenceType
 *        - Specifies the type of session in which the control point
 *        is interested.
 *        - Defaults to SINGLE.
 *        -Values
 *           - 1 - Request periodic position fixes
 *           - 2 - Request a single position fix
 *
 * \param pHorizontalAccuracyLvl
 *        - Specifies the horizontal accuracy level required by the
 *        control point.
 *        - Defaults to LOW
 *        - Values
 *           - 1 - Low accuracy
 *           - 2 - Medium accuracy
 *           - 3 - High accuracy
 *
 * \param pIntermediateReportState
 *        - Specifies if the control point is interested
 *        in receiving intermediate reports.
 *        - ON by default.
 *        - Values
 *          - 1 - Intermediate reports are turned on
 *          - 2 - Intermediate reports are turned off
 *
 * \param appVersionValid
 *        - Specifies whether the application version string contains a
 *        valid value
 *
 *        - 0x00 (FALSE) – Application version string is invalid
 *        - 0x01 (TRUE) – Application version string is valid
 *
 * \param LocApplicationInfo
 *        - LOC Application Parameters
 *        - See \ref LocApplicationInfo for more information
 *
 * \param pConfigAltitudeAssumed
 *        - Configuration for Altitude Assumed Info in GNSS SV
 *        Info Event
 *        - Defaults to ENABLED.
 *        - Values
 *          - 1 - Enable Altitude Assumed information in GNSS SV
 *          Info Event
 *          - 2 - Disable Altitude Assumed information in GNSS SV
 *          Info Event
 *
 */

typedef struct
{
     BYTE    SessionId;
     ULONG   *pRecurrenceType;
     ULONG   *pHorizontalAccuracyLvl;
     ULONG   *pIntermediateReportState;
     ULONG   *pMinIntervalTime;
     struct   LocApplicationInfo *pApplicationInfo;
     ULONG   *pConfigAltitudeAssumed;
} LOCStartReqResp;

/**
 * This structure contains the LOC Stop Request
 *
 * \param sessionId
 *        - ID of the session as identified by the control point.
 *        - Range: 0 to 255
 */
typedef struct
{
     BYTE     sessionId;
}LOCStopReqResp;

/**
 *  Used by the control point to register for events from the location subsystem.
 *
 *  \param  pLOCEventRegisterReqResp[IN]
 *          - See \ref LOCEventRegisterReqResp for more information
 *
 *  \return eQCWWAN_ERR_NONE on success, eQCWWAN_xxx error value otherwise
 *
 *  \sa     See qmerrno.h for eQCWWAN_xxx error values
 *
 *  \note   Timeout: 5 seconds
 *
 */

ULONG SLQSLOCEventRegister (
        LOCEventRegisterReqResp *pLOCEventRegisterReqResp );
/**
 *  Used by the control point to set the current external power configuration.
 *
 *  \param  pLOCExtPowerStateReqResp[IN]
 *          - See \ref LOCExtPowerStateReqResp for more information
 *
 *  \return eQCWWAN_ERR_NONE on success, eQCWWAN_xxx error value otherwise
 *
 *  \sa     See qmerrno.h for eQCWWAN_xxx error values
 *
 *  \note   Timeout: 5 seconds
 *
 */

ULONG SLQSLOCSetExtPowerState(
		LOCExtPowerStateReqResp *pLOCExtPowerStateReqResp);

/**
 *  Used by the control point to initiate a GPS session.
 *
 *  \param  pLOCStartReqResp[IN]
 *          - See \ref LOCStartReqResp for more information
 *
 *  \return eQCWWAN_ERR_NONE on success, eQCWWAN_xxx error value otherwise
 *
 *  \sa     See qmerrno.h for eQCWWAN_xxx error values
 *
 *  \note   Timeout: 5 seconds
 *
 */

ULONG SLQSLOCStart(LOCStartReqResp *pLOCStartReqResp);
/**
 *  Used by the control point to stop a GPS session.
 *
 *  \param  pLOCStopReqResp[IN]
 *          - See \ref LOCStopReqResp for more information
 *
 *  \return eQCWWAN_ERR_NONE on success, eQCWWAN_xxx error value otherwise
 *
 *  \sa     See qmerrno.h for eQCWWAN_xxx error values
 *
 *  \note   Timeout: 5 seconds
 *
 */

ULONG SLQSLOCStop(LOCStopReqResp *pLOCStopReqResp);


#ifdef __cplusplus
} /* extern "C" { */
#endif

#endif /* __GOBI_API_LOC_H__ */
