/*****************************************************************************
 * Copyright (C) Gemalto M2M GmbH
 *****************************************************************************
 * Project: IMC-RIL-Driver
 *****************************************************************************
 * Author : Wireless Modules RD SW A2
 *****************************************************************************
 * $Workfile: Y:/z_ms-d/src/working/Quinn/RilDrv/misc.h $
 * $Revision: /main/ms-d/33 $
 *     $Date: 2013-12-02 14:26:04 $
 *   $Author: pmackent $
 *****************************************************************************
 * Target:
 *  Microsoft Windows Mobile 5.0
 *****************************************************************************
 * Description:
 *  Gemalto IMC RIL
 *****************************************************************************
 *
 * $Log: Y:/z_ms-d/src/working/Quinn/RilDrv/misc.h$ 
 * 
 * /main/ms-d/33   2013-12-02 14:26:04   pmackent 
 * Set signal strength thersholds via registry
 *
 * /main/ms-d/32   2013-09-25 15:21:36   pmackent
 * New methods for signal strength display in 3G networks (IPIS100091577)
 *
 * /main/ms-d/31   2013-04-22 16:12:18   pmackent
 * Work on workarounds for AT+COPS/<AcT> and AT^SJDL/ATE
 *
 * /main/ms-d/30   2013-04-18 15:51:21   pmackent
 * Add RIL_GetSignalQuality API for CE7
 *
 * /main/ms-d/29   2013-02-26 15:07:37   pmackent
 * Adaptions for EHS5 1.290
 *
 * /main/ms-d/28   2012-04-18 13:46:56   ctna0256
 * Introducing PVS8
 * Implementing CDMA-SMS
 * Various CDMA enhancements
 *
 * /main/ms-d/27   2012-02-03 15:07:17   ctna0256
 * Move URC parsing functions in separate file
 *
 * /main/ms-d/26   2012-02-03 14:01:11   ctna0256
 * Phonebook and SIM access now in separate files
 *
 * /main/ms-d/25   2012-02-02 17:04:13   ctna0256
 * FD phonebook workaround and NITZ URCs for Intel platform
 *
 * /main/ms-d/24   2012-01-31 16:38:31   ctna0256
 * Added support for EHS5
 *
 * /main/ms-d/23   2011-02-02 10:58:16   ctna0256
 * Earlier CSQ notifications
 *
 * /main/ms-d/22   2010-11-26 10:15:54   ctna0256
 * Moved radio configuration from misc.cpp to new file
 *
 * /main/ms-d/21   2010-09-08 11:24:28   ctna0256
 * RIL option: automatic GPRS reattach (IPIS100064423)
 *
 * /main/ms-d/20   2010-02-03 10:51:00   ctna0256
 * Introduction of WinCE6 support
 *
 * /main/ms-d/19   2010-01-26 09:55:48   ctna0256
 * New API: RIL_GetPositionInfo()
 *
 * /main/ms-d/18   2009-09-04 09:21:41   ctna0256
 * Workaround for wrong 2G/3G-SIM detection in module (IPIS100057390)
 *
 * /main/ms-d/17   2009-01-14 11:52:27   ctna0450
 * Consider possible absence of mux driver in driver version check
 *
 * /main/ms-d/16   2009-01-14 10:50:06   ctna0450
 * Removed special handling for consecutive WaitCommEvent() calls because mux ports are properly instancable now
 *
 * /main/ms-d/15   2008-10-06 09:25:01   ctna0256
 * Remove support of extended phonebook
 *
 * /main/ms-d/14   2008-09-23 08:50:17   ctna0256
 * Improved handling of writing og extended phonebook entries
 *
 * /main/ms-d/13   2008-09-18 15:24:46   ctna0256
 * Introduction of extended phonebook support in WM6  AKU 1.3
 *
 * /main/ms-d/12   2008-08-22 10:24:13   ctna0256
 * Set Cinterion copyright text
 *
 * /main/ms-d/11   2008-08-21 09:34:38   ctna0256
 * Prepared for new disclaimer handling
 *
 * /main/ms-d/10   2008-07-22 10:45:17   mp49210
 * Changed handling of emergency calls for Korea
 *
 * /main/ms-d/9   2008-06-20 11:05:48   mp49210
 * Remove unused SIEMENS_MAGNETO define
 *
 * /main/ms-d/8   2007-08-31 15:06:46   mp49210
 * Allow the restriction of SIM access for special SIM files.
 *
 * /main/ms-d/7   2007-07-13 16:46:04   mp49210
 * New feature RIL_GetCellTowerInfo()
 *
 * /main/ms-d/6   2007-06-04 08:20:11   mp49210
 * IPIS100037515: send **05*...# and **052*...# sequences from the dialer with ATD instead of AT+CPIN command.
 *
 * /main/ms-d/5   2007-03-28 13:47:59   mp49210
 * Remove 'Classic RIL' specific code and comments
 *
 * /main/ms-d/4   2006-12-27 14:20:04   mp49210
 * Workaround for wrong CME-error at AT+CPBR
 *
 * /main/ms-d/3   2006-12-22 15:07:00   mp49210
 * HC25 doesn't support cell tower info
 *
 * /main/ms-d/2   2006-11-09 14:24:42   mp49210
 * Quinn specific feature: selction of 2G / 3G network
 *
 * /main/ms-d/1   2006-10-25 16:53:46   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

// For display in status bar of Windows Mobile: these dbm values correspond
// with 1 to 5 bars in the antenna symbol.
#define RSSI_1_BAR   6
#define RSSI_2_BARS  12
#define RSSI_3_BARS  18
#define RSSI_4_BARS  24
#define RSSI_5_BARS  31

extern DWORD g_n2G3GSelection;
extern char g_szSequenceFromDialer[MAX_ATCMD_LEN];
extern UINT g_nRSSI;
extern UINT g_nBER;
extern BOOL g_bCINDIsActive;
extern UINT g_iLastRSSI;
extern UINT g_iLastSignal;

#define MISC_CMDBUF_LENGTH_COST  (MAX_ATCMD_LEN)

HRESULT RILDrv_GetEquipmentInfo(DWORD dwParam);
HRESULT RILDrv_GetEquipmentState(DWORD dwParam);
HRESULT RILDrv_SetEquipmentState(DWORD dwParam, DWORD dwEquipmentState);
HRESULT RILDrv_GetCostInfo(DWORD dwParam);
HRESULT RILDrv_SetCostInfo(DWORD dwParam, const RILCOSTINFO* lpCostInfo, LPCSTR lpszPassword);
#ifndef RILDRV_CE6
HRESULT RILDrv_GetSignalQuality(DWORD dwParam);
#endif
#ifdef RILDRV_CE7
HRESULT RILDrv_GetSignalQuality(DWORD dwParam, RILSIGNALQUALITY* pSignalQuality);
#endif
HRESULT RILDrv_GetCellTowerInfo(DWORD dwParam);
#if defined(IOCTL_RIL_GETPOSITIONINFO)
HRESULT RILDrv_GetPositionInfo(DWORD dwParam);
#endif
HRESULT RILDrv_DevSpecific(DWORD dwParam, const BYTE* lpbParams, DWORD dwSize);

HRESULT RILDrv_GetCurrentSystemType(DWORD dwParam);
HRESULT RILDrv_GetRoamingMode(DWORD dwParam);
HRESULT RILDrv_SetRoamingMode(DWORD dwParam, DWORD dwRoamingMode);
HRESULT RILDrv_GetPreferredPrivacyMode(DWORD dwParam);
HRESULT RILDrv_SetPreferredPrivacyMode(DWORD dwParam, DWORD dwPreferredPrivacyMode);
HRESULT RILDrv_GetCurrentPrivacyStatus(DWORD dwParam);
HRESULT RILDrv_GetCurrentLocationStatus(DWORD dwParam);
HRESULT RILDrv_GetCurrentRoamingStatus(DWORD dwParam);
#if defined (IOCTL_RIL_GETANTENNASTATUS)
HRESULT RILDrv_GetAntennaStatus(DWORD dwParam);
#endif

void FillRSQStruct(RILSIGNALQUALITY* prsq);
void ReadMiscRegKeys(void);

HRESULT ParseGet2G3GSelection(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
#ifdef SUPPORTS_EHSX_R1
HRESULT ParseGet2G3GSelectionXRAT(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
#endif
HRESULT ParseGet2G3GSelectionIntel(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
HRESULT ParseGet2G3GSelectionSCFG(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);

DWORD WINAPI ReCheckSignalStrengthThreadProc(LPVOID pVoid);
BOOL ParseRSSIFromSMONI(LPCSTR& rszPointer, UINT& nRSSI);
UINT GetRSSIfromCINDvalue(UINT nRSSISIND);

