Sample Code

Windows Driver Samples/ Sensors Geolocation Sample Driver (UMDF Version 1)/ C++/ RadioManagerGPS/ SampleRadioInstance.h/

#pragma once

class ATL_NO_VTABLE CSampleRadioInstance :
    public CComObjectRootEx<CComMultiThreadModel>,
    public CComCoClass<CSampleRadioInstance>,
    public IRadioInstance,
    public ISampleRadioInstanceInternal
{
public:
    DECLARE_CLASSFACTORY()
    DECLARE_NOT_AGGREGATABLE(CSampleRadioInstance)
    DECLARE_NO_REGISTRY()

    BEGIN_COM_MAP(CSampleRadioInstance)
        COM_INTERFACE_ENTRY(IRadioInstance)
        COM_INTERFACE_ENTRY(ISampleRadioInstanceInternal)
    END_COM_MAP()

    CSampleRadioInstance();

    void FinalRelease();

    static HRESULT CreateInstance(
        _In_  PCWSTR pszKeyName,
        _In_  ISampleRadioManagerInternal *pParentManager,
        _COM_Outptr_ ISampleRadioInstanceInternal **pRadioInstance
        );

    // IRadioInstance
    IFACEMETHOD(GetRadioManagerSignature)(_Out_ GUID *pguidSignature);
    IFACEMETHOD(GetInstanceSignature)(_Out_ BSTR *pbstrID);
    IFACEMETHOD(GetFriendlyName)(_In_ LCID lcid, _Out_ BSTR *pbstrName);
    IFACEMETHOD(GetRadioState)(_Out_ DEVICE_RADIO_STATE *pRadioState);
    IFACEMETHOD(SetRadioState)(_In_ DEVICE_RADIO_STATE radioState, _In_ UINT32 uTimeoutSec);
    IFACEMETHOD_(BOOL, IsMultiComm)();
    IFACEMETHOD_(BOOL, IsAssociatingDevice)();

    // ISampleRadioInstanceInternal
    IFACEMETHOD(OnSysRadioChange)(_In_ SYSTEM_RADIO_STATE sysRadioSate);

private:
    HRESULT             _Init(
        _In_ PCWSTR pszKeyName,
        _In_ ISampleRadioManagerInternal *pParentManager
        );
    void                _Cleanup();
    HRESULT             _SetRadioState(_In_ DEVICE_RADIO_STATE radioState);
    static DWORD WINAPI s_ThreadSetRadio(LPVOID pThis);

    ISampleRadioManagerInternal *_pParentManager;
    CComAutoCriticalSection     _criticalSection;
    CString              _strInstanceId;
    GUID                 _guidInstanceId;
    CString              _strInstanceName;
};

typedef struct _SET_DEVICE_RADIO_JOB{
    HRESULT hr;
    CHandle hEvent;
    CSampleRadioInstance *pInstance;
    DEVICE_RADIO_STATE drsTarget;
} SET_DEVICE_RADIO_JOB;

Our Services

  • What our customers say about us?

© 2011-2024 All Rights Reserved. Joya Systems. 4425 South Mopac Building II Suite 101 Austin, TX 78735 Tel: 800-DEV-KERNEL

Privacy Policy. Terms of use. Valid XHTML & CSS