/*****************************************************************************
 * Copyright (C) Gemalto M2M GmbH
 *****************************************************************************
 * Project: IMC-RIL-Driver
 *****************************************************************************
 * Author : Wireless Modules RD SW A2
 *****************************************************************************
 * $Workfile: Y:/z_ms-d/src/working/Quinn/RilDrv/network.h $
 * $Revision: /main/ms-d/15 $
 *     $Date: 2012-11-23 16:54:53 $
 *   $Author: pmackent $
 *****************************************************************************
 * Target:
 *  Microsoft Windows Mobile 5.0
 *****************************************************************************
 * Description:
 *  Gemalto IMC RIL
 *****************************************************************************
 *
 * $Log: Y:/z_ms-d/src/working/Quinn/RilDrv/network.h$ 
 * 
 * /main/ms-d/15   2012-11-23 16:54:53   pmackent 
 * Additional adaptions for EHS5
 *
 * /main/ms-d/14   2012-07-04 09:26:24   pmackent
 * Changed key to date of network provider list
 *
 * /main/ms-d/13   2012-07-03 11:51:55   pmackent
 * Introduce infor about provider list date
 *
 * /main/ms-d/12   2012-02-03 15:07:21   ctna0256
 * Move URC parsing functions in separate file
 *
 * /main/ms-d/11   2010-07-06 10:00:26   ctna0256
 * Handle case of data only SIM
 *
 * /main/ms-d/10   2009-02-18 09:39:48   ctna0256
 * New WM65 API
 *
 * /main/ms-d/9   2008-08-22 10:24:47   ctna0256
 * Set Cinterion copyright text
 *
 * /main/ms-d/8   2008-08-21 09:34:55   ctna0256
 * Prepared for new disclaimer handling
 *
 * /main/ms-d/7   2007-09-21 10:29:43   mp49210
 * Introduction WM6 specific AcT selection (optional)
 *
 * /main/ms-d/6   2007-07-04 07:32:12   mp49210
 * Introduction of radio band group search
 *
 * /main/ms-d/5   2007-06-11 11:41:13   mp49210
 * Correct use of AT^SNWS/+COPS workarounds
 *
 * /main/ms-d/4   2007-05-23 08:37:37   mp49210
 * Introduction of AT^SNWS command (optional)
 *
 * /main/ms-d/3   2007-03-28 13:48:06   mp49210
 * Remove 'Classic RIL' specific code and comments
 *
 * /main/ms-d/2   2007-03-28 11:31:40   mp49210
 * Workaround for missing '0' in AT+CLCC
 *
 * /main/ms-d/1   2006-10-25 16:54:08   wm36264
 * First transformation from classic RIL
 *
*/

//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Gemalto M2M GmbH
// Copyright (C) 2006-2008 Siemens AG
// Copyright (C) 2003 Intrinsyc Europe Ltd.
//
// Version: 1.0
// Date:    dummy
//
//////////////////////////////////////////////////////////////////////////////

/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-1999  Microsoft Corporation
--*/

#pragma once

#define NETWK_CMDBUF_LENGTH      (MAX_ATCMD_LEN)
// We do not need this calculation: any string from or to the AT interface will not exceed MAX_ATCMD_LEN character
//#define NETWK_CMDBUF_LENGTH      (MAX_PATH + MAXLENGTH_OPERATOR)
#define NETWK_ALLOC_NUMBER        1

#define NO_INIT_COPS_SETTING    0xff

// Maximum length of the string containing the provider list information
#define PROVIDERLIST_DATE_STRING_LEN  32

// Key of the provider info string in the provider list
#define PROVIDERLISTINFOKEY     1000000

// The modules have got built in table of operator names. It is possible to use it instead of including
// such a table into the RIL. It is not recommended to use this option, since the table in the RIL is
// usually more up-to-date than the the one in the module.
// WARNING: this option must be used only, if EONS is enabled per registry.
//#define USE_MODULE_TABLE_OF_OPERATORS

//
// Registration status values
//
const DWORD g_rgdwRegStats[] =
{
    RIL_REGSTAT_UNREGISTERED,       // 0
    RIL_REGSTAT_HOME,               // 1
    RIL_REGSTAT_ATTEMPTING,         // 2
    RIL_REGSTAT_DENIED,             // 3
    RIL_REGSTAT_UNKNOWN,            // 4
    RIL_REGSTAT_ROAMING,            // 5
};
#define NUM_REGSTATS    (sizeof(g_rgdwRegStats) / sizeof(DWORD))


//
// Operator formats
//
static const DWORD g_rgdwOperFormats[] =
{
    RIL_OPFORMAT_LONG,          // 0
    RIL_OPFORMAT_SHORT,         // 1
    RIL_OPFORMAT_NUM,           // 2
};
#define NUM_OPERFORMATS (sizeof(g_rgdwOperFormats) / sizeof(DWORD))


//
// Operator numeric name to operator long name map
//
struct OPERATORNAMEMAP {
    UINT nNumericName;
    LPCSTR szLongName;
    LPCSTR szCountryCode;
};

#ifdef RIL_WM6_ACT_SELECTION
#if !defined(RIL_PARAM_ON_GSM_ACT)
#error Option RIL_WM6_ACT_SELECTION can only be used on Windows Mobile 6
#endif
#endif

HRESULT RILDrv_GetSubscriberNumbers(DWORD dwParam);
HRESULT RILDrv_GetOperatorList(DWORD dwParam);
HRESULT RILDrv_GetPreferredOperatorList(DWORD dwParam, DWORD dwFormat);
HRESULT RILDrv_AddPreferredOperator(DWORD dwParam, DWORD dwIndex, const RILOPERATORNAMES* lpOperatorNames);
HRESULT RILDrv_RemovePreferredOperator(DWORD dwParam, DWORD dwIndex);
HRESULT RILDrv_GetCurrentOperator(DWORD dwParam, DWORD dwFormat);
HRESULT RILDrv_RegisterOnNetwork(DWORD dwParam, DWORD dwMode, const RILOPERATORNAMES* lpOperatorNames);
HRESULT RILDrv_UnregisterFromNetwork(DWORD dwParam);
HRESULT RILDrv_GetRegistrationStatus(DWORD dwParam);
HRESULT RILDrv_GetAllOperatorsList(DWORD dwParam);

HRESULT ParseGetCurrentOperator(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
HRESULT ParseGetRegistrationStatus(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
HRESULT ParseGetCurrentRadioBand(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);

DWORD WINAPI PerformBandGroupSearchThread(LPVOID pVoid);
BOOL GetProviderListInfo(char *szInfo);

#if defined(IOCTL_RIL_GETSMSNLTABLELIST)
HRESULT RILDrv_GetSMSNLTableList(DWORD dwParam);
#endif

extern UINT g_iLastCOPSOpr;
extern UINT g_iSetCOPSinInit;
extern UINT g_iLastCOPS;
extern char g_szSetCOPSinInitOperator[MAXLENGTH_OPERATOR_NUMERIC+1];
extern BOOL g_bNeedAllBandNetworkSelection;
extern BOOL g_bFakeRegStatusDeniedToHome;
extern DWORD g_dwLastKnowBandSelection;
extern DWORD g_dwAutomaticGroupSearchTimeout;
extern UINT g_iPPLMNBufferPos;

#define MAX_PPLMN_BUFFER          255
#define PPLMN_BUFFER_NOT_FILLED   (MAX_PPLMN_BUFFER+1)

