/*****************************************************************************
 * Copyright (C) Gemalto M2M GmbH
 *****************************************************************************
 * Project: IMC-RIL-Driver
 *****************************************************************************
 * Author : Wireless Modules RD SW A2
 *****************************************************************************
 * $Workfile: Y:/z_ms-d/src/working/Quinn/RilDrv/ForceHomeNet.h $
 * $Revision: /main/ms-d/3 $
 *     $Date: 2012-10-08 16:18:23 $
 *   $Author: pmackent $
 *****************************************************************************
 * Target:
 *  Microsoft Windows Mobile 5.0
 *****************************************************************************
 * Description:
 *  Gemalto IMC RIL
 *****************************************************************************
 *
 * $Log: Y:/z_ms-d/src/working/Quinn/RilDrv/ForceHomeNet.h$ 
 * 
 * /main/ms-d/3   2012-10-08 16:18:23   pmackent 
 * Comply to Klocwork checks.
 *
 *
*/

//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2008 Gemalto M2M GmbH
// Copyright (C) 2006-2008 Siemens AG
//
// Version: 1.0
// Date:    dummy
//
//////////////////////////////////////////////////////////////////////////////

#define FORCE_HOMENET_TIMEOUT     60000
// Supports only 2-digit MNCs.
#define NETWORK_ID_LEN            5

class CForceHomeNet {
public:
  CForceHomeNet();
  ~CForceHomeNet();
  BOOL ForceHomeNet(CRilHandle* pRilDevice);
  void NotifyRegistered(void) { SetEvent(m_hRegisterEvent); };

private:
  BOOL IsForceHomeNetEnabled(void);
  DWORD GetTimeout(void);
  void AbortThread(void);
  static HRESULT ParseCIMIData(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
  static HRESULT ParseCOPSData(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, LPVOID pParam);
  static DWORD WINAPI ExecutionThread(LPVOID pParam);

  CRITICAL_SECTION  m_csThreadHandle;
  CRilHandle*       m_pRilDevice;
  HANDLE            m_hRegisterEvent;
  HANDLE            m_hThread;
  DWORD             m_dwRequiredHomeNet;
  DWORD             m_dwHomeNet;
  BOOL              m_fHomeNetAvailable;
};

