/*===========================================================================
FILE: 
   GobiConnectionMgmtAPI.h

DESCRIPTION:
   QUALCOMM Connection Management API for Gobi 3000

Copyright (C) 2011 QUALCOMM Incorporated. All rights reserved.
                   QUALCOMM Proprietary/GTDR

All data and information contained in or disclosed by this document is
confidential and proprietary information of QUALCOMM Incorporated and all
rights therein are expressly reserved.  By accepting this material the
recipient agrees that this material and the information contained therein
is held in confidence and in trust and will not be used, copied, reproduced
in whole or in part, nor its contents revealed in any manner to others
without the express written permission of QUALCOMM Incorporated.
==========================================================================*/
#ifndef GobiConnectionMgmtAPI_H
#define GobiConnectionMgmtAPI_H
/*=========================================================================*/
// Definitions
/*=========================================================================*/
#ifdef GOBIAPI_EXPORTS
	#define IMPORTGOBI extern "C" __declspec( dllexport )   
#else  //GOBIAPI_EXPORTS
	#ifdef __cplusplus
		/* C++ callable DLL */
		#define IMPORTGOBI extern "C" __declspec( dllimport )   
	#else
		/* C callable DLL */
		#define IMPORTGOBI __declspec( dllimport )
	#endif
#endif //GOBIAPI_EXPORTS

// Calling convention for API
#define GOBICALLBACK __stdcall
#define GOBICMAPI __stdcall

/** 
* \defgroup GroupGCM Gobi Connection Mangement
*/
/*@{*/


#ifdef __cplusplus
   extern "C" {
#endif

#define MAX_CDMA_SYS_INFO_MNC		3
#define MAX_CDMA_SYS_INFO_MCC		3
#define MAX_HDR_SYS_INFO_IS856SID	16
#define MAX_GSM_SYS_INFO_MCC		3
#define MAX_GSM_SYS_INFO_MNC		3
#define MAX_WCDMA_SYS_INFO_MCC		3
#define MAX_WCDMA_SYS_INFO_MNC		3
#define MAX_LTE_SYS_INFO_MCC		3
#define MAX_LTE_SYS_INFO_MNC		3
#define MAX_TDSCDMA_SYS_INFO_MCC	3
#define MAX_TDSCDMA_SYS_INFO_MNC	3
#define MAX_MCC						3
#define MAX_IMSI_11_12				2
#define MAX_IMSI_S1					7
#define MAX_IMSI_S2					3
/**
 *  MIN-based IMSI (information written to NV_IMSI_MCC_I, NV_IMSI_11_12_I, NV_MIN1_I, and
 *  NV_MIN2_I)
 *
 *  \param  mcc_m
 *          - ASCII character representation of MCC_M; example: 000, 123, etc.
 *
 *  \param  imsi_m_11_12
 *          - ASCII character representation of IMSI_M_11_12 value; example: 00, 01, etc.
 *
 *  \param  imsi_m_s1
 *          - ASCII character representation of IMSI_M_S1 value; example: 0123456.
 *
 *  \param  imsi_m_s2
 *          - ASCII character representation of IMSI_M_S2 value; example: 012.
 *
**/
typedef struct
{
	BYTE mcc_m[MAX_MCC];
	BYTE imsi_m_11_12[MAX_IMSI_11_12];
	BYTE imsi_m_s1[MAX_IMSI_S1];
	BYTE imsi_m_s2[MAX_IMSI_S2];
} MinBasedImsi;

/**
 *  True IMSI (information written to NV_IMSI_T_MCC_I, NV_IMSI_T_11_12_I, NV_IMSI_T_S1_I,
 *  NV_IMSI_T_S2_I, and NV_IMSI_T_ADDR_NUM_I)
 *
 *  \param  mcc_t
 *          - ASCII character representation of MCC_T; example: 000, 123, etc.
 *
 *  \param  imsi_t_11_12
 *          - ASCII character representation of IMSI_T_11_12 value; example: 00, 01, etc.
 *
 *  \param  imsi_t_s1
 *          - ASCII character representation of IMSI_T_S1 value; example: 0123456.
 *
 *  \param  imsi_t_s2
 *          - ASCII character representation of IMSI_T_S2 value; example: 012.
 *
 *  \param  imsi_t_addr_num
 *          - Value of IMSI_T_ADDR_NUM.
 *
**/
typedef struct
{
	BYTE mcc_t[MAX_MCC];
	BYTE imsi_t_11_12[MAX_IMSI_11_12];
	BYTE imsi_t_s1[MAX_IMSI_S1];
	BYTE imsi_t_s2[MAX_IMSI_S2];
	BYTE imsi_t_addr_num;
} TrueImsi;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		isSysPrlMatchValid;
	BYTE		isSysPrlMatch;
	BYTE		pRevInUseValid;
	BYTE		pRevInUse;
	BYTE		bsPRevValid;
	BYTE		bsPRev;
	BYTE		ccsSupportedValid;
	BYTE		ccsSupported;
	BYTE		cdmaSysIdValid;
	WORD		sid;
	WORD		nid;
	BYTE		bsInfoValid;
	WORD		baseId;
	ULONG		baseLat;
	ULONG		baseLong;
	BYTE		packetZoneValid;
	WORD		packetZone;
	BYTE		networkIdValid;
	CHAR		mcc[MAX_CDMA_SYS_INFO_MCC];
	CHAR		mnc[MAX_CDMA_SYS_INFO_MNC];
} CdmaSystemInfo;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		isSysPrlMatchValid;
	BYTE		isSysPrlMatch;
	BYTE		hdrPersonalityValid;
	BYTE		hdrPersonality;
	BYTE		hdrActiveProtValid;
	BYTE		hdrActiveProt;
	BYTE		is856SysIdValid;
	BYTE		is856SysId[MAX_HDR_SYS_INFO_IS856SID];
} HdrSystemInfo;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		lacValid;
	WORD		lac;
	BYTE		cellIdValid;
	ULONG		cellId;
	BYTE		regRejectInfoValid;
	BYTE		regRejectSrvDomain;
	BYTE		rejectCause;
	BYTE		networkIdValid;
	CHAR		mcc[MAX_GSM_SYS_INFO_MCC];
	CHAR		mnc[MAX_GSM_SYS_INFO_MNC];
	BYTE		egprsSuppValid;
	BYTE		egprsSupp;
	BYTE		dtmSuppValid;
	BYTE		dtmSupp;
} GsmSystemInfo;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		lacValid;
	WORD		lac;
	BYTE		cellIdValid;
	ULONG		cellId;
	BYTE		regRejectInfoValid;
	BYTE		regRejectSrvDomain;
	BYTE		rejectCause;
	BYTE		networkIdValid;
	CHAR		mcc[MAX_WCDMA_SYS_INFO_MCC];
	CHAR		mnc[MAX_WCDMA_SYS_INFO_MNC];
	BYTE		hsCallStatusValid;
	BYTE		hsCallStatus;
	BYTE		hsIndValid;
	BYTE		hsInd;
	BYTE		pscValid;
	WORD		psc;
} WcdmaSystemInfo;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		lacValid;
	WORD		lac;
	BYTE		cellIdValid;
	ULONG		cellId;
	BYTE		regRejectInfoValid;
	BYTE		regRejectSrvDomain;
	BYTE		rejectCause;
	BYTE		networkIdValid;
	CHAR		mcc[MAX_LTE_SYS_INFO_MCC];
	CHAR		mnc[MAX_LTE_SYS_INFO_MNC];
	BYTE		tacValid;
	WORD		tac;
} LteSystemInfo;

typedef struct
{
	BYTE		srvDomainValid;
	BYTE		srvDomain;
	BYTE		srvCapValid;
	BYTE		srvCap;
	BYTE		roamStatusValid;
	BYTE		roamStatus;
	BYTE		isSysForbiddenValid;
	BYTE		isSysForbidden;
	BYTE		lacValid;
	WORD		lac;
	BYTE		cellIdValid;
	ULONG		cellId;
	BYTE		regRejectInfoValid;
	BYTE		regRejectSrvDomain;
	BYTE		rejectCause;
	BYTE		networkIdValid;
	CHAR		mcc[MAX_TDSCDMA_SYS_INFO_MCC];
	CHAR		mnc[MAX_TDSCDMA_SYS_INFO_MNC];
	BYTE		hsCallStatusValid;
	BYTE		hsCallStatus;
	BYTE		hsIndValid;
	BYTE		hsInd;
	BYTE		cellParameterIdValid;
	WORD		cellParameterId;
	BYTE		cellBroadcastCapValid;
	ULONG		cellBroadcastCap;
	BYTE		csBarStatusValid;
	ULONG		csBarStatus;
	BYTE		psBarStatusValid;
	ULONG		psBarStatus;
	BYTE		cipherDomainValid;
	BYTE		cipherDomain;
} TdscdmaSystemInfo;

typedef struct
{
	ULONG		PilotType;
	WORD		PilotPn;
	WORD		PilotStrength;
} HrpdPilot;

typedef struct
{
	BYTE		isRadioTuned;
	LONG		rxPwr;
	LONG		ecio;
	LONG		rscp;
	LONG		rsrp;
	LONG		phase;
} RxInfo;

typedef struct
{
	BYTE		isInTraffic;
	LONG		txPwr;
} TxInfo;

struct SWI_STRUCT_ServingSystem
{
    /*! Version of this structure */
    ULONG   nVersion;

    /*! The following fields are valid in version 1 */

    /*! Registration state of the mobile.  Values:
        - 0: Not registered; mobile is not currently searching
             for a new network to provide service.
        - 1: Registered with a network.
        - 2: Not registered, but mobile is currently
             searching for a new network to provide service.
        - 3: Registration denied by the visible network.
        - 4: Registration state is unknown. */
    ULONG   nRegistrationState;

    /*! Circuit switch domain attach state of the mobile.  Values:
        - 0: Unknown or not applicable.
        - 1: Attached.
        - 2: Detached. */
    ULONG   nCsAttachState;

    /*! Packet switch domain attach state of the mobile.  Values:
        - 0: Unknown or not applicable.
        - 1: Attached.
        - 2: Detached. */
    ULONG   nPsAttachState;

    /*! Type of selected radio access network.  Values:
        - 0: Unknown
        - 1: 3GPP2 network
        - 2: 3GPP network */
    ULONG   nSelectedNetwork;

    /*! Number of radio interfaces included */
    ULONG   nNumOfRadioIf;

    /*! Radio interface currently in use.  Values:
        - 0x00: None (no service)
        - 0x01: cdma2000 1X
        - 0x02: cdma2000 HRPD (1xEV-DO)
        - 0x03: AMPS
        - 0x04: GSM
        - 0x05: UMTS
        - 0x08: LTE */
    ULONG   nRadioIf[255];

    /*! The following fields are valid in version 2 */
    /*! Roaming indicator. Values:
        - 0x00 – ROAMING_IND_ON – Roaming
        - 0x01 – ROAMING_IND_OFF – Home
        - 0x02 – ROAMING_IND_FLASHING – Flashing
        - 0x03 and above – Operator-defined values */
    ULONG  nRoamingIndicator;

    /*! Number of data capabilities */
    BYTE nDataCapabilityListLen;

    /*! List of data capabilities of the current serving system. Possible Values:
        - 0x01 – GPRS
        - 0x02 – EDGE
        - 0x03 – HSDPA
        - 0x04 – HSUPA
        - 0x05 – WCDMA
        - 0x06 – CDMA
        - 0x07 – CDMA EV-DO REV 0
        - 0x08 – CDMA EV-DO REV A
        - 0x09 – GSM
        - 0x0A – CDMA EV-DO REV B
        - 0x0B – LTE
        - 0x0C – HSDPA+
        - 0x0D – DC-HSDPA+*/
    ULONG nDataCapabilities[255];

    /*! An 16-bit integer representation of Mobile Ccountryt Code. Values:
        - 0 to 999. . */
    WORD nMobileCountryCode;

    /*! An 16-bit integer representation of Mobile Network Code. Values:
        - 0 to 999. . */
    WORD nMobileNetworkCode;

    /*! Number of sets of the following elements:
        - network_description */
    ULONG nNetworkDescriptionLength;

    /*! An optional string containing the network name ordescription */
    CHAR NetworkDescription[255];
    
    SWI_STRUCT_ServingSystem()
    {
        nVersion = 2;
        memset( &nRadioIf[0], 0, sizeof(ULONG) * 255 );
        memset( &nDataCapabilities[0], 0, sizeof(ULONG) * 255);
        memset( &NetworkDescription[0], 0, sizeof(NetworkDescription));
    }
};

// Session state callback function
typedef void (GOBICALLBACK * tFNSessionState)( 
   ULONG                      state,
   ULONG                      sessionEndReason );

// RX/TX byte counts callback function
typedef void (GOBICALLBACK * tFNByteTotals)( 
   ULONGLONG                  totalBytesTX,
   ULONGLONG                  totalBytesRX );

// Dormancy status callback function
typedef void (GOBICALLBACK * tFNDormancyStatus)( ULONG dormancyStatus );

// Mobile IP status callback function
// MIPStatus:status of the last MIP call(or attempt)
// see RFC2002 IP MObility Support for more information
typedef void (GOBICALLBACK * tFNMobileIPStatus)( ULONG mipStatus );

// Activation status callback function
typedef void (GOBICALLBACK * tFNActivationStatus)( ULONG activationStatus );

// Power operating mode callback function
typedef void (GOBICALLBACK * tFNPower)( ULONG operatingMode );

// Wireless disable callback function
typedef void (GOBICALLBACK * tFNWirelessDisable)( ULONG bState );

// Serving system callback function
typedef void (GOBICALLBACK * tFNServingSystem)(
   BYTE                       registrationState, 
   BYTE                       csAttachState, 
   BYTE                       psAttachState, 
   BYTE                       selectedNetwork, 
   BYTE                       inUseRadioIfListNum, 
   BYTE *                     pRadioIf );

// Serving system Current PLMN callback function
typedef void (GOBICALLBACK * tFNCurrentPlmn)(
   WORD                       mobileCountryCode, 
   WORD                       mobileNetworkCode, 
   BYTE                       networkDescriptionLength, 
   CHAR *                     pNetworkDescription );

// Serving system info callback function (struct containing serving system, current plmn data capability and romaing indicator)
typedef void (GOBICALLBACK * tFNSwiServingSystemInfo)(
	SWI_STRUCT_ServingSystem * pServingSystemInfo );

// Serving system data capabilities callback function
typedef void (GOBICALLBACK * tFNDataCapabilities)(
   BYTE                       dataCapsSize, 
   BYTE *                     pDataCaps );



// Data bearer technology callback function
typedef void (GOBICALLBACK * tFNDataBearer)( ULONG dataBearer );

// Roaming indicator callback function
typedef void (GOBICALLBACK * tFNRoamingIndicator)( ULONG roaming );

// Signal strength callback function
typedef void (GOBICALLBACK * tFNSignalStrength)(
   INT8                       signalStrength, 
   ULONG                      radioInterface );

// RF information callback function
typedef void (GOBICALLBACK * tFNRFInfo)( 
   ULONG                      radioInterface,
   ULONG                      activeBandClass,
   ULONG                      activeChannel );

// LU reject callback function
typedef void (GOBICALLBACK * tFNLUReject)( 
   ULONG                      serviceDomain,
   ULONG                      rejectCause );

// PLMN mode callback function
typedef void (GOBICALLBACK * tFNPLMNMode)( ULONG mode );

// New SMS message callback function
typedef void (GOBICALLBACK * tFNNewSMS)( 
   ULONG                      storageType,
   ULONG                      messageIndex );

typedef void (GOBICALLBACK * tFNNewSMSCB)( 
   BYTE                       ackIndicator,
   ULONG                      transactionId,
   BYTE                       format,
   USHORT                     length,
   BYTE*                      rawData );
   
typedef void (GOBICALLBACK * tFNMsgWaitingCB)( 
   BYTE                      	numInstances,
   BYTE*                      	msgType,
   BYTE*                      	indStatus,
   BYTE*                     	msgCount); 

// New NMEA sentence callback function
typedef void (GOBICALLBACK * tFNNewNMEA)( LPCSTR pNMEA );

// PDS session state callback function
typedef void (GOBICALLBACK * tFNPDSState)( 
   ULONG                      enabledStatus,
   ULONG                      trackingStatus );

// CAT event callback function
typedef void (GOBICALLBACK * tFNCATEvent)( 
   ULONG                      eventID,
   ULONG                      eventLen,
   BYTE *                     pEventData );

// OMA-DM network initiated alert callback function
typedef void (GOBICALLBACK * tFNOMADMAlert)( 
   ULONG                      sessionType,
   USHORT                     sessionID );

// OMA-DM state callback function
typedef void (GOBICALLBACK * tFNOMADMState)( 
   ULONG                      sessionState,
   ULONG                      failureReason );






// Network Time callback function
typedef void (GOBICALLBACK * tFNNetworkTime)(
   WORD m_year,	
   BYTE m_month,
   BYTE m_day,	
   BYTE m_hour,
   BYTE m_minute,
   BYTE m_second,	
   BYTE m_dayOfWeek,
   BYTE m_timeZone,
   BYTE m_dayLightAdj
   );

typedef void (GOBICALLBACK * tFNSystemSelectionPref)(BYTE * Mode);
   
#ifdef __cplusplus
   };
#endif

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



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