/*****************************************************************************
 * Copyright (C) Gemalto M2M GmbH
 *****************************************************************************
 * Project: 3G-RIL-Driver
 *****************************************************************************
 * Author : Wireless Modules PD SW1
 *****************************************************************************
 * $Workfile: Y:/z_ms-d/src/working/Quinn/RilDrv/URC_Parsing.h $
 * $Revision: /main/ms-d/6 $
 *     $Date: 2014-05-26 16:30:09 $
 *   $Author: pmackent $
 *****************************************************************************
 * Target:
 *  Microsoft Windows Mobile 6.x
 *****************************************************************************
 * Description:
 *  Cinterion 3G RIL
 *****************************************************************************
 *
 * $Log: Y:/z_ms-d/src/working/Quinn/RilDrv/URC_Parsing.h$ 
 * 
 * /main/ms-d/6   2014-05-26 16:30:09   pmackent 
 * Correction for incorrectly reported system type while module is in CDMA mode and in no-coverage area (IPIS100097887)
 *
 * /main/ms-d/5   2013-02-26 15:07:23   pmackent
 * Adaptions for EHS5 1.290
 *
 * /main/ms-d/4   2012-06-07 13:59:08   pmackent
 * Adaptions for multimode
 * Workaround for CREF=0 bug in PXS8
 *
 * /main/ms-d/3   2012-04-18 13:46:39   ctna0256
 * Introducing PVS8
 * Implementing CDMA-SMS
 * Various CDMA enhancements
 *
 * /main/ms-d/2   2012-02-23 16:10:07   ctna0256
 * Special handling of NO CARRIER in Intel-AT-Set
 *
 * /main/ms-d/1   2012-02-03 15:05:42   ctna0256
 * Move URC parsing functions in separate file
 *
 *
 *
 *
*/

//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2012 Gemalto M2M GmbH
//
// Version: 1.0
// Date:    dummy
//
//////////////////////////////////////////////////////////////////////////////

#if !defined(RIL_NOTIFY_LOCATIONUPDATE)
#ifndef RIL_NO_CREG_LOCATION_UPDATES
#define RIL_NO_CREG_LOCATION_UPDATES
#endif
#endif
#ifdef RIL_NOTIFY_NITZ
#define NITZ_TIME_STRING_LEN 44
#endif

// Sytemtype HSDPA will be introduced with later version
#ifndef RIL_SYSTEMTYPE_HSDPA
#define RIL_SYSTEMTYPE_HSDPA  0x200
#endif

// List of possible system types (GPRS, HSDPA, ...)
const DWORD g_rgdwPSInfos[] =
{
    RIL_SYSTEMTYPE_NONE,                                        // 0 (special handling needed, see GetSystemTypeFromPSInfo() in CRilHandle)
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS,                     // 1
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS,                     // 2
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS|RIL_SYSTEMTYPE_EDGE, // 3
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS|RIL_SYSTEMTYPE_EDGE, // 4
    RIL_SYSTEMTYPE_UMTS,                                        // 5
    RIL_SYSTEMTYPE_UMTS,                                        // 6
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 7
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 8
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 9  (There is no HSUPA definition in Windows Mobile)
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 10 (There is no HSUPA definition in Windows Mobile)
    RIL_SYSTEMTYPE_1XRTTPACKET,                                 // 11 (for CDMA devices only)
    RIL_SYSTEMTYPE_1XEVDOPACKET,                                // 12 (for CDMA devices only)
    RIL_SYSTEMTYPE_1XEVDOPACKET,                                // 13 (for CDMA devices only)
    RIL_SYSTEMTYPE_NONE,                                        // 14 (unused)
    RIL_SYSTEMTYPE_NONE,                                        // 15 (unused)
    RIL_SYSTEMTYPE_LTE,                                         // 16 (LTE)
    RIL_SYSTEMTYPE_LTE,                                         // 17 (LTE)
};
const DWORD g_rgdwPSInfosSpecial[] =
{
    RIL_SYSTEMTYPE_NONE,                                        // 0 (if module is registered in GSM, this will be replaced by RIL_SYSTEMTYPE_GSM)
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS,                     // 1
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS,                     // 2
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS|RIL_SYSTEMTYPE_EDGE, // 3
    RIL_SYSTEMTYPE_GSM|RIL_SYSTEMTYPE_GPRS|RIL_SYSTEMTYPE_EDGE, // 4
    RIL_SYSTEMTYPE_UMTS,                                        // 5
    RIL_SYSTEMTYPE_UMTS,                                        // 6
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 7
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 8
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 9  (There is no HSUPA definition in Windows Mobile)
    RIL_SYSTEMTYPE_UMTS|RIL_SYSTEMTYPE_HSDPA,                   // 10 (There is no HSUPA definition in Windows Mobile)
    RIL_SYSTEMTYPE_1XRTTPACKET,                                 // 11 (for CDMA devices only)
    RIL_SYSTEMTYPE_1XEVDOPACKET,                                // 12 (for CDMA devices only)
    RIL_SYSTEMTYPE_1XEVDOPACKET,                                // 13 (for CDMA devices only)
    RIL_SYSTEMTYPE_NONE,                                        // 14 (unused)
    RIL_SYSTEMTYPE_NONE,                                        // 15 (unused)
    RIL_SYSTEMTYPE_DEVSPECIFIC_LTE,                             // 16 (LTE)
    RIL_SYSTEMTYPE_DEVSPECIFIC_LTE,                             // 17 (LTE)
};
// Related list: voice+data capabilities
const DWORD g_rgdwPSCaps[] =
{
    RIL_SYSTEMCAPS_NONE,               // 0
    RIL_SYSTEMCAPS_NONE,               // 1
    RIL_SYSTEMCAPS_NONE,               // 2
    RIL_SYSTEMCAPS_NONE,               // 3
    RIL_SYSTEMCAPS_NONE,               // 4
    RIL_SYSTEMCAPS_VOICEDATA,          // 5
    RIL_SYSTEMCAPS_VOICEDATA,          // 6
    RIL_SYSTEMCAPS_VOICEDATA,          // 7
    RIL_SYSTEMCAPS_VOICEDATA,          // 8
    RIL_SYSTEMCAPS_VOICEDATA,          // 9
    RIL_SYSTEMCAPS_VOICEDATA,          // 10
    RIL_SYSTEMCAPS_NONE,               // 11 (CDMA only)
    RIL_SYSTEMCAPS_VOICEDATA,          // 12 (CDMA only)
    RIL_SYSTEMCAPS_VOICEDATA,          // 13 (CDMA only)
    RIL_SYSTEMCAPS_NONE,               // 14 (unused)
    RIL_SYSTEMCAPS_NONE,               // 15 (unused)
    RIL_SYSTEMCAPS_VOICEDATA,          // 16 (LTE)
    RIL_SYSTEMCAPS_VOICEDATA,          // 17 (LTE)
};
#define NUM_PSPINFOS    (sizeof(g_rgdwPSInfos) / sizeof(DWORD))

#ifdef RIL_ENABLE_ALS
extern     UINT           g_dwALSLine;
#endif

#ifdef RIL_INDICATE_SS_INFORMATION
//
// Supplementary service error causes
//
struct SSINDICATION
{
    DWORD  dwSS_ind;
    UINT   uiErrorText;
};
#endif

//
// Structure to pass data to the CheckNoCarrierReasonThreadProc thread.
//
struct CHECK_NOCARRIER_THREAD_DATA {
    HRESULT hrID;
    APIID apiid;
    DWORD dwResponseCode;
    CRilInstanceHandle *pHandle;
};


DWORD WINAPI CheckRoamingNetworkThreadProc(LPVOID pVoid);
DWORD WINAPI SIMReInsertedThreadProc(LPVOID pVoid);
DWORD WINAPI ACMMaxThreadProc(LPVOID pVoid);
DWORD WINAPI GPRSReattachThreadProc(LPVOID pVoid);
#ifdef RIL_USE_CSQ_NOTIFICATIONS
DWORD WINAPI ReSendSignalThreadProc(LPVOID pVoid);
#endif
DWORD WINAPI CheckNoCarrierReasonThreadProc(LPVOID pVoid);

HRESULT ParsePsInfoForCReg(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);

