⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atcmd.h

📁 windows mobile RIL软件
💻 H
字号:
/*++
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

Module Name:

atcmd.h

Abstract:


Notes:


--*/

#pragma once


//
// Forward declarations
//
class CRilHandle;
enum APIID;


//
// Globals
//
extern CPriorityQueue<CCommand, 40>* g_pCmdQ;
extern CQueue<CResponse, 10>* g_pRspQ;
#if defined(OEM1_DRIVER) || defined(OEM2_DRIVER) || defined(EMP_DRIVER)
extern DWORD g_dwUnlocked;
// theoretically, on boot we should see a max of two toolkit notifications.
// 1 for a setup menu and 1 for a pro-active cmd.
#define MAX_TOOLKITNOTIFS 3
extern CResponse* g_CachedToolKitNotifs[MAX_TOOLKITNOTIFS];
#endif

#if defined(OEM1_GPRS_DEACT) || defined(EMP_DRIVER)
extern CRITICAL_SECTION g_csGPRSDeactLock;
extern bool g_fDeactNotificationRcvd;
extern bool g_fDeactResponseRcvd;
extern DWORD g_LastDeactNotificationRcvd;
// The constant below is part of a heuristic used in the RIL driver which does not track calls.
// The value of this constant helps rule out ME DEACT notifications from the distant past in
// relation to the current deactivation session.
#define STALE_MEDEACT_THRESHOLD 5000 // in ms
#endif

//
// Structures
//
struct REQUEUE_THREAD_DATA {
    CCommand* pCmd;
    DWORD dwDelay;
};


//
// Thread procedures
//
DWORD WINAPI CmdThreadProc(LPVOID lpParameter);
DWORD WINAPI ReadThreadProc(LPVOID lpParameter);

//
// Routines
//
BOOL QueueInternalCmd( CRilHandle* const pRilDevice, const LPCSTR szCmd, const DWORD dwOptions, const APIID apiid, 
					  DWORD dwTimeout, DWORD dwRetries, DWORD dwRetryDelay, 
                      const PFN_CMD_PARSE pfnParse, const dwRetriesOnError, 
                      const PFN_CMD_PARSE_DATA pfnParseWithData, const PVOID pParseData, CNotificationData* const pnd
                      );//added by viking wnag
BOOL QueueCmd(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const DWORD dwOptions, const APIID apiid,
              const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID);
BOOL QueueMultipartCmd(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const LPCSTR szCmdPart2, const DWORD dwOptions, const APIID apiid,
              const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID);
BOOL QueueCmdWithTimeout(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const LPCSTR szCmdPart2, const DWORD dwOptions, const APIID apiid,
              const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, HRESULT& rhrCmdID, DWORD dwTimeout, DWORD dwRetries);
BOOL QueueCmdIgnoreRsp(const APIID apiid, const LPCSTR szCmd, const DWORD dwOptions, DWORD dwTimeout, const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, DWORD dwRetries, DWORD dwRetriesOnError, DWORD dwRetryOnErrorDelay);
BOOL QueueCmdIgnoreRspWithData(const APIID apiid, const LPCSTR szCmd, const DWORD dwOptions, DWORD dwTimeout, const PFN_CMD_PARSE pfnParse, CNotificationData* const pnd, DWORD dwRetries, DWORD dwRetriesOnError, DWORD dwRetryOnErrorDelay, const PFN_CMD_PARSE_DATA pfnParseWithData, const PVOID pParseData);
BOOL RequeueCmdWithDelay(CCommand* pCmd, DWORD dwDelay);
BOOL HandleRsp(CRilHandle* pDevice, CCommand* pCmd, CResponse* pRsp);

/*
 *  framework to support synchronous AT command execution
 */
class ATCmd
{
public:
    ATCmd();
    virtual ~ATCmd();

    virtual void Dump() const;

protected:

    HRESULT Execute( const char *cmd );

    virtual HRESULT Parse( LPCSTR szRsp ) =0;

private:

    ATCmd( const ATCmd& ref );
    ATCmd& operator=( const ATCmd& ref );

    mutable CRITICAL_SECTION m_cs;
    HANDLE m_hEvent;
    HRESULT m_hr;
    BOOL m_fInProgress;

    HRESULT Initialize();

    static HRESULT s_ParseFunc( LPCSTR szRsp, void*& pBlob, UINT& cbBlob, PVOID& pfnParseData );

    HRESULT ParseFunc( LPCSTR szRsp );
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -