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

📄 command.h

📁 ril source code for Windows CE
💻 H
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/*++
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.

Module Name:

command.h

Abstract:


Notes:


--*/


#pragma once

//
// Forward declarations
//
class CRilInstanceHandle;
class CNotificationData;
enum APIID;

//
// Command options
//
#define CMDOPT_NONE                     0x00000000
#define CMDOPT_IGNORERSP                0x00000001
#define CMDOPT_INIT                     0x00000002
#define CMDOPT_REINIT                   0x00000004
#define CMDOPT_HANGUP                   0x00000008
#define CMDOPT_DIAL                     0x00000010
#define CMDOPT_ANSWER                   0x00000020
#define CMDOPT_GENERALINIT              0x00000040
#define CMDOPT_SMSINIT                  0x00000080
#define CMDOPT_NOOP                     0x00000100
#define CMDOPT_REQUIRECONNECTRSP        0x00000200
#define CMDOPT_FINALINIT                0x00000400
#define CMDOPT_RETRYONSIMLOCKED         0x00000800
#define CMDOPT_IGNORERADIOOFF           0x00001000
#define CMDOPT_SETRADIOON               0x00002000
#define CMDOPT_SIMQUERY                 0x00004000
#define CMDOPT_DELAYCONNECTRSP          0x00008000
#define CMDOPT_LONGDIALSTRING           0x00010000
#define CMDOPT_SUPPRESSLOGGING          0x00020000
#define CMDOPT_UNLOCKING                0x00040000
#define CMDOPT_POLLING                  0x00080000
#define CMDOPT_CPINENTERED              0x00100000
#define CMDOPT_SIMPBINIT                0x00200000
#define CMDOPT_INTERMEDIATERESPONSE     0x00400000
#define CMDOPT_FORCEPARSE               0x00800000
#define CMDOPT_DEACT                    0x01000000

//
// Command priorities
//
#define CMDPRI_HIGHEST                  0
#define CMDPRI_HIGH                     1
#define CMDPRI_NORMAL                   2
#define CMDPRI_LOW                      3

//
// Parsing callback stored in CCommand
//
typedef HRESULT (*PFN_CMD_PARSE)(LPCSTR szRsp, void*& pBlob, UINT& cbBlob);
typedef HRESULT (*PFN_CMD_PARSE_DATA)(LPCSTR szRsp, void*& pBlob, UINT& cbBlob, PVOID& pfnParseData);


//
// AT command
//
class CCommand : public CListElem
{
public:
            CCommand();
            ~CCommand();

    BOOL                Init(CRilInstanceHandle* const pHandle, const LPCSTR szCmd, const LPCSTR szCmdPart2, const DWORD dwOptions,
                             const DWORD dwExecTime, const DWORD dwTimeout, CNotificationData* const pnd,
                             const PFN_CMD_PARSE pfnParse, const DWORD dwRetries, 
                             const DWORD dwRetriesOnError, const DWORD dwRetryOnErrorDelay, const APIID apiid, const PFN_CMD_PARSE_DATA pfnParseWithData, const PVOID pParseData );
    BOOL                Init(CCommand* pCmd);
    void                SendResponse(const DWORD dwResponseCode, const void* const pBlob, const UINT cbBlob) const;
    CRilInstanceHandle* GetHandle() const           { return m_pHandle; };
    LPSTR               GetCmd() const              { return m_szCmd; };
    LPSTR               GetCmdPart2() const              { return m_szCmdPart2; };
    HRESULT             GetID() const               { return m_hrCmdID; };
    void                ClearHandle()               { m_pHandle = NULL; };
    BOOL                FIgnoreRsp() const          { return (m_dwOptions & CMDOPT_IGNORERSP); };
    BOOL                FInit() const               { return (m_dwOptions & CMDOPT_INIT); };
    BOOL                FReinit() const             { return (m_dwOptions & CMDOPT_REINIT); };
    BOOL                FHangup() const             { return (m_dwOptions & CMDOPT_HANGUP); };
    BOOL                FDial() const               { return (m_dwOptions & CMDOPT_DIAL); };
    BOOL                FAnswer() const             { return (m_dwOptions & CMDOPT_ANSWER); };
    BOOL                FGeneralInit() const        { return (m_dwOptions & CMDOPT_GENERALINIT); };
    BOOL                FSMSInit() const            { return (m_dwOptions & CMDOPT_SMSINIT); };
    BOOL                FSIMPBInit() const          { return (m_dwOptions & CMDOPT_SIMPBINIT); };
    BOOL                FFinalInit() const          { return (m_dwOptions & CMDOPT_FINALINIT); };
    BOOL                FNoOp() const               { return (m_dwOptions & CMDOPT_NOOP); };
    BOOL                FRequireConnectRsp() const  { return (m_dwOptions & CMDOPT_REQUIRECONNECTRSP); };
    BOOL                CmdOptIsSet(DWORD Flag)     { return (m_dwOptions & Flag); }
    void                SetCmdOpt(DWORD Flag)       { m_dwOptions |= Flag; }
    void                ClrCmdOpt(DWORD Flag)       { m_dwOptions &= ~Flag; }
    DWORD               GetTimeout() const          { return m_dwTimeout; };
    DWORD               GetExecTime() const         { return m_dwExecTime; };
    void                Age()                       { m_dwExecTime /= 2; };
    CNotificationData*  GiveUpNotificationData()    { CNotificationData* pnd = m_pndNotify; m_pndNotify = NULL; return pnd; };
    PFN_CMD_PARSE       GetParseFunc() const        { return m_pfnParse; };
    PFN_CMD_PARSE_DATA  GetParseFuncWithData() const { return m_pfnParseWithData; };
    PVOID               GetParseFnData() const      { return m_pParseData; };
    DWORD               GetPriority() const;
    DWORD               GetRetries() const          { return m_dwRetries; }
    void                SetRetries(const DWORD dwRetries) { m_dwRetries=dwRetries;}
    BOOL                OkToRetry()           { return (m_dwRetries>0) ? (--m_dwRetries,TRUE) : FALSE;}
    APIID               GetAPIID() const             { return m_apiid; };
    BOOL                RetryCommandOnError();

private:
    CRilInstanceHandle* m_pHandle;
    LPSTR               m_szCmd;
    LPSTR               m_szCmdPart2;    
    HRESULT             m_hrCmdID;
    DWORD               m_dwOptions;
    DWORD               m_dwTimeout;
    DWORD               m_dwExecTime;
    CNotificationData*  m_pndNotify;
    PFN_CMD_PARSE       m_pfnParse;
    PFN_CMD_PARSE_DATA  m_pfnParseWithData;
    DWORD               m_dwRetries;
    DWORD               m_dwRetriesOnError;
    DWORD               m_dwRetryOnErrorDelay;
    APIID               m_apiid;
    PVOID               m_pParseData;
};

⌨️ 快捷键说明

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