#pragma once
#include "QCWWANCMAPI2k.h"  // supports GobiAPI
#include "SwiWwanCmApi.h"


#define CARRIER_VERIZON 1
#define CARRIER_ATT     2
#define CARRIER_SPRINT  3
#define CARRIER_GENERIC_UMTS 6

struct CARRIERINFO
{
	TCHAR FolderName[255];
	int FwSlot;
	TCHAR CarrierName[255];
};

class CGobi
{

public:
  CGobi(void);
  ~CGobi(void);

  // Initialize GobiApi
  BOOL Initialize();
  void Deinit();
  CARRIERINFO FwAvalible[10];
  // Search for available device  must connect to device before do anything else
  BOOL DeviceSearch();
  // Get network information
  DWORD CGobi::GetNetworkInfo(TCHAR *, TCHAR * );  // get carrier name, tech type (CDMA or UMTS) and network status
  DWORD DoFirmwareUpgrade(int );  
  BOOL GetVoiceNumberInfo(TCHAR *); 	// get phone number of current carrier loaded in gobi module

  // connect function pointer prototype
  typedef ULONG (__stdcall * tFNConnect)();
  // disconnect function pointer prototype
  typedef ULONG (__stdcall * tFNDisconnect)();
  // get serving network function pointer prototype
  typedef ULONG (__stdcall * tFNGetServingNetwork)(
    ULONG *	pRegistrationState, 
    ULONG *	pCSDomain, 
    ULONG *	pPSDomain, 
    ULONG *	pRAN, 
    BYTE *	pRadioIfacesSize, 
    BYTE *	pRadioIfaces, 
    ULONG *	pRoaming, 
    WORD *	pMCC, 
    WORD *	pMNC, 
    BYTE	nameSize, 
    CHAR *	pName );

  // get voice number function pointer prototype
  typedef ULONG (__stdcall * tFNGetVoiceNumber) (
    BYTE   voiceNumberSize, 
    CHAR * pVoiceNumber,
    BYTE   minSize, 
    CHAR * pMIN );

  typedef ULONG (__stdcall * tFNUpgradeFirmware2kW) (
    WCHAR * pDestinationPath );

  typedef ULONG (__stdcall * tFNSetPower)  (
    ULONG	powerMode); 

  typedef ULONG (__stdcall * tFNSetImagesPreference) (
    ULONG imageListSize,
    BYTE * pImageList,
    ULONG bForceDownload,
    BYTE modemIndex,
    ULONG * pImageTypesSize,
    BYTE * pImageTypes);

  typedef ULONG (__stdcall * tFNGetImagesPreference) (
    ULONG * pImageListSize,
    BYTE * pImageList);

  // Function pointers
  tFNConnect m_pFnConnect;
  tFNDisconnect m_pFnDisconnect;
  tFNGetServingNetwork m_pFnGetServingNetwork;
  tFNGetVoiceNumber m_pFnGetVoiceNumber;
  tFNUpgradeFirmware2kW m_pFnUpgradeFirmware2kW; 
  tFNSetPower m_pFnSetPower;
  tFNSetImagesPreference m_pFnSetImagesPreference;
  tFNGetImagesPreference m_pFnGetImagesPreference;
  HMODULE m_hGobiApi; // handle to the GobiAPI
};
