Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 94 lines (73 sloc) 2.585 kB
b10aa0b @tig Checking in version 2.0.2
authored
1 // : Declaration of the
2
3 #pragma once
4
5
6 #include "resource.h" // main symbols
c8769b4 @tig Bumped version to 2.1.0. Configured to build with VS2010
authored
7 #include <driverutil.h>
b10aa0b @tig Checking in version 2.0.2
authored
8
9 #define XML_Device_VirtualDevice L"sys://Schema/ExternalControlProcessor/VirtualDevice"
10
11 /////////////////////////////////////////////////////////////////////////////
12 //
13
14 class ATL_NO_VTABLE CVirtualDevice :
15 public CComObjectRootEx<CComMultiThreadModel>,
16 public CComCoClass<CVirtualDevice>,
17 public CPremiseSubscriber,
18 IPremiseHandlePort
19 {
20 public:
21 DECLARE_NO_REGISTRY()
22 DECLARE_NOT_AGGREGATABLE(CVirtualDevice)
23 DECLARE_PROTECT_FINAL_CONSTRUCT()
24
25 BEGIN_COM_MAP(CVirtualDevice)
26 COM_INTERFACE_ENTRY(IPremiseHandlePort)
27 COM_INTERFACE_ENTRY(IPremisePort)
28 COM_INTERFACE_ENTRY(IObjectWithSite)
29 COM_INTERFACE_ENTRY(IPremiseNotify)
30 END_COM_MAP()
31
32 CComPtr<IPremisePortCallback> m_spCB;
33 DWORD m_dwCookie;
34 CComBSTR m_bstrCommandPrefix;
35 CComBSTR m_bstrFile;
36 bool m_bOpen;
37
38 CVirtualDevice()
39 {
40 //ATLTRACE2("CVirtualDevice constructor\n");
41 m_dwCookie = 0;
42 m_bOpen = FALSE;
43 }
44
45 ~CVirtualDevice()
46 {
47 }
48
49 // Overrides for CPremiseSubscriber
50 HRESULT OnBrokerDetach();
51 HRESULT OnBrokerAttach();
52
53 //
54 // IPremisePort methods.
55 //
56 STDMETHOD(Write)(const void *pv, ULONG cb, ULONG *pcbWritten);
57 STDMETHOD(OpenPort)(IPremisePortCallback* pc);
58 STDMETHOD(ClosePort)();
59 STDMETHOD(ClosePortEx)(boolean bImmediate);
60 STDMETHOD(GetOpenStatus)(long* pl);
61 STDMETHOD(GetHandle)(long* pid);//gets a number which can uniquely identify this port
62 STDMETHOD(GetDescription)(BSTR* pbstrDesc);
63 STDMETHOD(SetCookie)(DWORD dwCookie);
64 STDMETHOD(GetCookie)(DWORD* pdwCookie);
65 STDMETHOD(GetCallback)(IPremisePortCallback** pCallback);
66 STDMETHOD(SetCallback)(IPremisePortCallback* pc);
67
68 //
69 // IPremiseHandlePort methods
70 //
71 STDMETHOD(SetupPort)(LPCOLESTR pszFile, DWORD dwDesiredAccess, DWORD dwShareMode,
72 DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes);
73 STDMETHOD(SetPortSpy)(IUnknown* pSite);
74
75
76 BEGIN_NOTIFY_MAP(CVirtualDevice)
77 //OnNetworkChanged is implemented in CPremiseBufferedPortDevice
78 // NOTIFY_PROPERTY(L"EnableLogging", OnLoggingChanged)
79 //add other properties here
80 //These are example properties. You should edit .xml and add properties
81 //for your particular device. Then edit these macros and created property change handlers
82 //for them
83 NOTIFY_PROPERTY(L"CommandPrefix", OnCommandPrefixChanged)
84 NOTIFY_PROPERTY(L"Open", OnOpenChanged)
85 END_NOTIFY_MAP()
86
87 HRESULT STDMETHODCALLTYPE OnCommandPrefixChanged(IPremiseObject *pObject, VARIANT newValue);
88 HRESULT STDMETHODCALLTYPE OnOpenChanged(IPremiseObject *pObject, VARIANT newValue);
89
90 };
91
92
93
Something went wrong with that request. Please try again.