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

📄 response.h

📁 手机RILGSM实现的源代码
💻 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 OR INDEMNITIES.
//
/*++
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:

response.h

Abstract:


Notes:


--*/
//------------------------------------------------------------------------------
//    Revision History
//    Date                  Author               Activity ID                Activity Headline
//    2005-12-28           wuguanglaing         CEDB00004152            Add SMS firewall support in ril layer(also for SMS prefered storage)
//    2006-04-27           wuguangliang         CEDB200000271          Add addtional processs when sim card is removed
//   2007-03-30        XieFei         CEDB200049615         Merge crowsbow code to cynthia850
//   2007-07-18        xiangming      WM600010395           add the G/E icon function
//------------------------------------------------------------------------------



#pragma once

// Used by CResponse
#define ALLOC_SIZE                      1024

extern CRITICAL_SECTION g_csDeactCringLock;
extern bool g_fCringRcvd;
extern DWORD g_LastCringRcvd;
// The constant below is part of a heuristic used in the RIL driver which does not track calls.
// The value of this constant needs to be tuned based on how frequently the radio sends CRING notifications
// for a call not yet accepted, the lower this frequency the higher this value should be. However, making
// this too long will have the undesirable side effect of ignoring the celltsp's deactivate request after a
// very quick voice call (ring -> accept -> hangup -> deactivate is all within the time below)
#define STALE_CRING_THRESHOLD 5000 // in ms
inline bool IncomingCallInProgress(void)
{
    return (g_fCringRcvd && ((GetTickCount() - g_LastCringRcvd) < STALE_CRING_THRESHOLD));
}


//
// Error mapping structure used for binary search
//
struct ERRORMAP {
    HRESULT hrError;
    DWORD dwCode;
};

inline void *AllocBlob(UINT bytes)
{
    return (void *)LocalAlloc(LMEM_MOVEABLE,bytes);
}

inline void *FreeBlob(void *pblob)
{
    return (void *)LocalFree(pblob);
}

inline void *ReallocBlob(void *pblob, UINT bytes)
{
    if (!pblob)
    {
        return (void *)LocalAlloc(LMEM_MOVEABLE,bytes);
    }

    return (void *)LocalReAlloc(pblob,bytes,LMEM_MOVEABLE);
}

//
// AT command response
//
class CResponse : public CBuffer
{
public:
            CResponse();
            ~CResponse();
            CResponse(const CResponse &Rsp);

    BOOL    AppendString(const LPCSTR szString, const UINT cbString, LPCSTR& rszRemainder, UINT& rcbRemainde, BOOL fDataOnNotificationPort);
    BOOL    SetBlob(const void* const pBlob, const UINT cbBlob);
    BOOL    MakeError(const HRESULT hr);
    void    DeleteBlob()                                { FreeBlob(m_pBlob); m_pBlob = NULL; m_cbBlob = 0; };
    void    MakeOK()                                    { m_dwCode = RIL_RESULT_OK; m_fUnsolicited = FALSE; };
    BOOL    ParseOKData(CCommand*&rpCmd);
    HRESULT GetError() const;
    void    GetBlob(void*& rpBlob, UINT& rcbBlob) const { rpBlob = m_pBlob; rcbBlob = m_cbBlob; };
    DWORD   GetNotifyCode() const                       { return m_dwCode; };
    void        SetNotifyCode(DWORD dwcode)        {m_dwCode = dwcode;};
    BOOL    FUnsolicited() const                        { return !!m_fUnsolicited; };
    BOOL    FUnrecognized() const                       { return !!m_fUnrecognized; };
#ifdef OEM2_DRIVER
    BOOL    FCPINNRsp();
#endif
    void    ConnectToOK()   { DEBUGCHK(RIL_NOTIFY_CONNECT == m_dwCode);   m_dwCode = RIL_RESULT_OK; m_fUnsolicited = FALSE; };
    void    NoCarrierToOK() { DEBUGCHK(RIL_RESULT_NOCARRIER == m_dwCode); m_dwCode = RIL_RESULT_OK; m_fUnsolicited = FALSE; };
    void    OKToNoCarrier() { DEBUGCHK(RIL_RESULT_OK == m_dwCode); m_dwCode = RIL_RESULT_NOCARRIER; m_fUnsolicited = FALSE; };
    void    SetCallAborted() { m_dwCode = RIL_RESULT_CALLABORTED; m_fUnsolicited = FALSE; };
    BOOL    OKToError(HRESULT hr);
    void    SetPotentialBogusResponseFlag() { m_fPotentialBogusResponse = TRUE; }
    BOOL    UpdateDataPointer(UINT nOffset);

private:
    BOOL    Parse(UINT& rcbNewLength, BOOL fDataOnNotificationPort);
    BOOL    ParseOKOrError(const BOOL fOK, UINT& rcbNewLength);
    BOOL    ParseNotification(UINT& rcbNewLength, BOOL fDataOnNotificationPort);
    BOOL    ParseV25Response(UINT nResponseCode);
    BOOL    ParseExtError(LPCSTR& rszPointer, const ERRORMAP* const rgemMap, const UINT nMapEntries, UINT &nCode, BOOL fSigned);
    BOOL    ParseExtRing(LPCSTR& rszPointer);
    BOOL    ParseServiceInfo(LPCSTR& rszPointer);
    BOOL    ParseRemotePartyInfo(LPCSTR& rszPointer, BOOL fCLIP);
    BOOL    ParseCallWaitingInfo(LPCSTR& rszPointer);
    BOOL    ParseUnsolicitedSSInfo(LPCSTR& rszPointer);
    BOOL    ParseIntermediateSSInfo(LPCSTR& rszPointer);
    BOOL    ParseCallMeter(LPCSTR& rszPointer);
    BOOL    ParseCallProgressInformation(LPCSTR& rszPointer);
	//xiangming add for the G/E icon function at 070718
	BOOL    ParseExtOmpRegistrationStatus(LPCSTR& rszPointer, DWORD const dwNotifyCode);   
	BOOL    ParseExtOmpGPRSRegistrationStatus(LPCSTR& rszPointer, DWORD const dwNotifyCode);
	//xiangming add for the G/E icon function at 070718 end  
    BOOL    ParseRegistrationStatus(LPCSTR& rszPointer, DWORD const dwNotifyCode);
    BOOL    ParseHSCSDParams(LPCSTR& rszPointer);
    BOOL    ParseUSSDInfo(LPCSTR& rszPointer);
    BOOL    ParseMessage(LPCSTR& rszPointer, DWORD const dwNotifyCode);
    BOOL    ParseMessageInSim(LPCSTR& rszPointer, DWORD const dwNotifyCode);
    BOOL    ParseCPIN(LPCSTR& rszPointer);
#ifdef OEM2_SIMTOOLKIT
    BOOL    ParseSTC(LPCSTR& rszPointer);
#endif
    BOOL    ParseSIMToolkitCmdOrRsp(LPCSTR& rszPointer, const DWORD dwNotifyCode);
    BOOL    ParseSIMToolkitCallSetup(LPCSTR& rszPointer);
    void    ParseJunk(UINT nCRLFs, LPCSTR& rszPointer);
    BOOL    ParsePartialResponse(UINT& rcbNewLength);
#ifdef OEM1_SIMIND_NOTIFICATION    
    BOOL    ParseSimIndication(LPCSTR& rszPointer);
    BOOL    ParseSimREM(LPCSTR& rszPointer);
   
   
   
#endif    
    HRESULT SendSIMToolkitErrorRsp(RILSIMTOOLKITCMD* pCmd);

	//BOOL 		ExecuteInComingCallBlockChld();	
	//Added by wuguangliang for prefered sms store and sms firewall
    BOOL    SetNewMessageFlag();
    void    SetOutgoCallFailCounter(BOOL bTimerRecoveryReason);
   //cuihuawei  2006-07-10
		void    SetGprsDetachStatus(BOOL bNWDetach);  
		
		 
    DWORD   m_dwCode;
    void*   m_pBlob;
    UINT    m_cbBlob;
    DWORD   m_fUnsolicited : 1;
    DWORD   m_fUnrecognized : 1;
    DWORD   m_fPotentialBogusResponse : 1;
    UINT    m_nOffset;
};


//
// Notification data
//
class CNotificationData
{
public:
                        CNotificationData();
                        ~CNotificationData();

    BOOL                InitFromDWORDBlob(const DWORD dwCode, const DWORD dwBlob);
    BOOL                InitFromRealBlob(const DWORD dwCode, const void* const pBlob, UINT cbBlob);
    BOOL                FinishInitFromRspBlob(const CResponse& rRsp);
    BOOL                DelayInitFromRspBlob(const DWORD dwCode);

    BOOL                FDelayedInitFromRsp() const { return !!m_fDelayedInitFromRsp; };
    DWORD               GetCode() const             { DEBUGCHK(FALSE != !!m_fInited); return m_dwCode; };
    const void* const   GetBlob() const             { DEBUGCHK(FALSE != !!m_fInited); return m_pBlob; };
    UINT                GetSize() const             { DEBUGCHK(FALSE != !!m_fInited); return m_cbBlob; };

private:
    DWORD       m_dwCode;
    void*       m_pBlob;
    UINT        m_cbBlob;
    DWORD       m_fInited : 1;
    DWORD       m_fDelayedInitFromRsp : 1;
};

extern void StartPlmnNameRead();
#ifdef RIL_ENABLE_EONS
extern void StartEONSRead();
#endif


typedef BOOL        (*INCOMONGBFUNC)( ... );
//void FreeInComingCallNAndToneSrvLibrary();
BOOL IsSTKReady( BOOL bNeedWaiting, DWORD dwTimeout = 0 );

⌨️ 快捷键说明

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