ICP  1
block.h
Go to the documentation of this file.
1 // block.h : Declaration of the Cblock
2 
3 #pragma once
4 #include "resource.h" // main symbols
5 
6 
7 
8 #include "instapi_i.h"
9 #include "_IblockEvents_CP.h"
10 
11 
12 
13 #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
14 #error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
15 #endif
16 
17 using namespace ATL;
18 
19 
20 // Cblock
21 
22 class ATL_NO_VTABLE Cblock :
23  public CComObjectRootEx<CComMultiThreadModel>,
24  public CComCoClass<Cblock, &CLSID_block>,
25  public ISupportErrorInfo,
26  public IConnectionPointContainerImpl<Cblock>,
27  public CProxy_IblockEvents<Cblock>,
28  public IDispatchImpl<Iblock, &IID_Iblock, &LIBID_instapiLib, /*wMajor =*/ 1, /*wMinor =*/ 0>
29 {
30 private:
31  CComBSTR m_name;
32 public:
33  unsigned long m_session_id;
34 
35 public:
36  Cblock() : m_session_id(0)
37  {
38  }
39 
40 DECLARE_REGISTRY_RESOURCEID(IDR_BLOCK)
41 
42 
43 BEGIN_COM_MAP(Cblock)
44  COM_INTERFACE_ENTRY(Iblock)
45  COM_INTERFACE_ENTRY(IDispatch)
46  COM_INTERFACE_ENTRY(ISupportErrorInfo)
47  COM_INTERFACE_ENTRY(IConnectionPointContainer)
48 END_COM_MAP()
49 
50 BEGIN_CONNECTION_POINT_MAP(Cblock)
51  CONNECTION_POINT_ENTRY(__uuidof(_IblockEvents))
52 END_CONNECTION_POINT_MAP()
53 // ISupportsErrorInfo
54  STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
55 
56 
57  DECLARE_PROTECT_FINAL_CONSTRUCT()
58 
59  HRESULT FinalConstruct()
60  {
61  return S_OK;
62  }
63 
64  void FinalRelease()
65  {
66  }
67 
68 public:
69  STDMETHOD(get_setpoint)(VARIANT* pVal);
70  STDMETHOD(put_setpoint)(VARIANT newVal);
71  STDMETHOD(get_value)(VARIANT* pVal);
72  STDMETHOD(getLogValues)(BSTR start_time, BSTR end_time, BSTR output_time_format, VARIANT* times, VARIANT* values);
73  STDMETHOD(logValues)(BSTR time_format, VARIANT times, VARIANT values);
74  STDMETHOD(getSetpoint)(VARIANT* value, BSTR* time);
75  STDMETHOD(getValue)(VARIANT* value, BSTR* time);
76  STDMETHOD(get_name)(BSTR* pVal);
77  STDMETHOD(put_name)(BSTR pVal);
78  STDMETHOD(get_runcontrol)(VARIANT_BOOL* pVal);
79  STDMETHOD(put_runcontrol)(VARIANT_BOOL pVal);
80  STDMETHOD(get_lowlimit)(VARIANT* pVal);
81  STDMETHOD(put_lowlimit)(VARIANT pVal);
82  STDMETHOD(get_highlimit)(VARIANT* pVal);
83  STDMETHOD(put_highlimit)(VARIANT pVal);
84  STDMETHOD(enterSetpointOnly)(VARIANT newVal);
85  STDMETHOD(enterSetpointOnlyExt)(VARIANT newVal, VARIANT* results);
86  STDMETHOD(pushSetButton)();
87  STDMETHOD(pushSetButtonExt)(VARIANT* results);
88  STDMETHOD(setValue)(VARIANT newVal);
89  STDMETHOD(setValueExt)(VARIANT newVal, VARIANT* results);
90 };
91 
92 OBJECT_ENTRY_AUTO(__uuidof(block), Cblock)
Definition: block.h:22
Cblock()
Definition: block.h:36
#define IDR_BLOCK
Definition: resource.h:8
unsigned long m_session_id
0 is an invalid session
Definition: block.h:33
CComBSTR m_name
Definition: block.h:31
void FinalRelease()
Definition: block.h:64