diff --git a/Cargo.lock b/Cargo.lock
index 7d9874e..314d1f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -276,11 +276,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
-name = "opc_da"
+name = "opc_ae_bindings"
+version = "0.3.0"
+dependencies = [
+ "windows",
+ "windows-bindgen",
+ "windows-core",
+ "windows-targets 0.53.2",
+]
+
+[[package]]
+name = "opc_comn_bindings"
version = "0.3.0"
+dependencies = [
+ "windows",
+ "windows-bindgen",
+ "windows-core",
+ "windows-targets 0.53.2",
+]
+
+[[package]]
+name = "opc_da"
+version = "0.3.1"
dependencies = [
"actix",
"globset",
+ "opc_comn_bindings",
"opc_da_bindings",
"tokio",
"windows",
@@ -289,6 +310,16 @@ dependencies = [
[[package]]
name = "opc_da_bindings"
+version = "0.3.1"
+dependencies = [
+ "windows",
+ "windows-bindgen",
+ "windows-core",
+ "windows-targets 0.53.2",
+]
+
+[[package]]
+name = "opc_hda_bindings"
version = "0.3.0"
dependencies = [
"windows",
diff --git a/Cargo.toml b/Cargo.toml
index c49dbb7..6aba39a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,23 @@
[workspace]
resolver = "2"
-members = ["opc_da_bindings", "opc_da"]
+members = [
+ "opc_ae_bindings",
+ "opc_comn_bindings",
+ "opc_da",
+ "opc_da_bindings",
+ "opc_hda_bindings",
+]
+
+[workspace.dependencies]
+windows = { version = "0.61.3", features = [
+ "Win32_Foundation",
+ "Win32_System_Com",
+ "Win32_System_Ole",
+ "Win32_System_Variant",
+] }
+windows-bindgen = "0.62.1"
+windows-core = "0.61.2"
+windows-targets = "0.53.2"
[profile.dev.build-override]
debug = true
diff --git a/opc_ae_bindings/.gitignore b/opc_ae_bindings/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/opc_ae_bindings/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/opc_ae_bindings/.metadata/.gitignore b/opc_ae_bindings/.metadata/.gitignore
new file mode 100644
index 0000000..1746e32
--- /dev/null
+++ b/opc_ae_bindings/.metadata/.gitignore
@@ -0,0 +1,2 @@
+bin
+obj
diff --git a/opc_ae_bindings/.metadata/generate.proj b/opc_ae_bindings/.metadata/generate.proj
new file mode 100644
index 0000000..e9f7917
--- /dev/null
+++ b/opc_ae_bindings/.metadata/generate.proj
@@ -0,0 +1,17 @@
+
+
+
+ ../.windows/winmd/OPCAE.winmd
+ 0.0.0.1
+ $(CompiledHeadersDir)
+
+
+
+
+
+ @(Headers)
+ OPCAE
+ true
+
+
+
\ No newline at end of file
diff --git a/opc_ae_bindings/.metadata/main.cpp b/opc_ae_bindings/.metadata/main.cpp
new file mode 100644
index 0000000..b3c8e1f
--- /dev/null
+++ b/opc_ae_bindings/.metadata/main.cpp
@@ -0,0 +1,3 @@
+#include
+
+#include "opc_ae.h"
diff --git a/opc_ae_bindings/.metadata/opc_ae.idl b/opc_ae_bindings/.metadata/opc_ae.idl
new file mode 100644
index 0000000..d9a48ea
--- /dev/null
+++ b/opc_ae_bindings/.metadata/opc_ae.idl
@@ -0,0 +1,506 @@
+//==============================================================================
+// TITLE: opc_ae.idl
+//
+// CONTENTS:
+//
+// Interface declarations for the OPC Alarms & Event specifications.
+//
+// (c) Copyright 1997-2003 The OPC Foundation
+// ALL RIGHTS RESERVED.
+//
+// DISCLAIMER:
+// This code is provided by the OPC Foundation solely to assist in
+// understanding and use of the appropriate OPC Specification(s) and may be
+// used as set forth in the License Grant section of the OPC Specification.
+// This code is provided as-is and without warranty or support of any sort
+// and is subject to the Warranty and Liability Disclaimers which appear
+// in the printed OPC Specification.
+//
+// MODIFICATION LOG:
+//
+// Date By Notes
+// ---------- --- -----
+// 2002/10/02 JL Updated for Version 1.1.
+// 2003/01/06 RSA Fixed formatting to comply with coding guidelines.
+// 2004/09/01 RSA Renamed modules in TYPELIB section to avoid name conflicts.
+//
+
+import "oaidl.idl";
+import "ocidl.idl";
+
+//==============================================================================
+// Category ID declaration (defined as an interface to ensure they show up in the typelib).
+
+[uuid(58E13251-AC87-11d1-84D5-00608CB8A7E9)] interface OPCEventServerCATID : IUnknown {}
+
+cpp_quote("#define CATID_OPCAEServer10 IID_OPCEventServerCATID")
+
+//==============================================================================
+// Structures, Typedefs and Enumerations.
+
+typedef DWORD OPCHANDLE;
+
+typedef enum
+{
+ OPCAE_BROWSE_UP = 1,
+ OPCAE_BROWSE_DOWN,
+ OPCAE_BROWSE_TO
+}
+OPCAEBROWSEDIRECTION;
+
+typedef enum
+{
+ OPC_AREA = 1,
+ OPC_SOURCE
+}
+OPCAEBROWSETYPE;
+
+typedef enum
+{
+ OPCAE_STATUS_RUNNING = 1,
+ OPCAE_STATUS_FAILED,
+ OPCAE_STATUS_NOCONFIG,
+ OPCAE_STATUS_SUSPENDED,
+ OPCAE_STATUS_TEST,
+ OPCAE_STATUS_COMM_FAULT
+}
+OPCEVENTSERVERSTATE;
+
+typedef struct
+{
+ WORD wChangeMask;
+ WORD wNewState;
+ [string] LPWSTR szSource;
+ FILETIME ftTime;
+ [string] LPWSTR szMessage;
+ DWORD dwEventType;
+ DWORD dwEventCategory;
+ DWORD dwSeverity;
+ [string] LPWSTR szConditionName;
+ [string] LPWSTR szSubconditionName;
+ WORD wQuality;
+ WORD wReserved;
+ BOOL bAckRequired;
+ FILETIME ftActiveTime;
+ DWORD dwCookie;
+ DWORD dwNumEventAttrs;
+ [size_is(dwNumEventAttrs)] VARIANT* pEventAttributes;
+ [string] LPWSTR szActorID;
+}
+ONEVENTSTRUCT;
+
+typedef struct
+{
+ FILETIME ftStartTime;
+ FILETIME ftCurrentTime;
+ FILETIME ftLastUpdateTime;
+ OPCEVENTSERVERSTATE dwServerState;
+ WORD wMajorVersion;
+ WORD wMinorVersion;
+ WORD wBuildNumber;
+ WORD wReserved;
+ [string] LPWSTR szVendorInfo;
+}
+OPCEVENTSERVERSTATUS;
+
+typedef struct
+{
+ WORD wState;
+ WORD wReserved1;
+ LPWSTR szActiveSubCondition;
+ LPWSTR szASCDefinition;
+ DWORD dwASCSeverity;
+ LPWSTR szASCDescription;
+ WORD wQuality;
+ WORD wReserved2;
+ FILETIME ftLastAckTime;
+ FILETIME ftSubCondLastActive;
+ FILETIME ftCondLastActive;
+ FILETIME ftCondLastInactive;
+ LPWSTR szAcknowledgerID;
+ LPWSTR szComment;
+ DWORD dwNumSCs;
+ [size_is (dwNumSCs)] LPWSTR * pszSCNames;
+ [size_is (dwNumSCs)] LPWSTR * pszSCDefinitions;
+ [size_is (dwNumSCs)] DWORD * pdwSCSeverities;
+ [size_is (dwNumSCs)] LPWSTR * pszSCDescriptions;
+ DWORD dwNumEventAttrs;
+ [size_is(dwNumEventAttrs)] VARIANT* pEventAttributes;
+ [size_is(dwNumEventAttrs)] HRESULT* pErrors;
+}
+OPCCONDITIONSTATE;
+
+//==============================================================================
+// IOPCEventServer
+
+[
+ uuid(65168851-5783-11D1-84A0-00608CB8A7E9),
+ pointer_default(unique)
+]
+interface IOPCEventServer : IUnknown
+{
+ HRESULT GetStatus(
+ [out] OPCEVENTSERVERSTATUS **ppEventServerStatus
+ );
+
+ HRESULT CreateEventSubscription(
+ [in] BOOL bActive,
+ [in] DWORD dwBufferTime,
+ [in] DWORD dwMaxSize,
+ [in] OPCHANDLE hClientSubscription,
+ [in] REFIID riid,
+ [out, iid_is(riid)] LPUNKNOWN* ppUnk,
+ [out] DWORD* pdwRevisedBufferTime,
+ [out] DWORD* pdwRevisedMaxSize
+ );
+
+ HRESULT QueryAvailableFilters(
+ [out] DWORD* pdwFilterMask
+ );
+
+ HRESULT QueryEventCategories(
+ [in] DWORD dwEventType,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] DWORD** ppdwEventCategories,
+ [out, size_is(,*pdwCount)] LPWSTR** ppszEventCategoryDescs
+ );
+
+ HRESULT QueryConditionNames(
+ [in] DWORD dwEventCategory,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] LPWSTR** ppszConditionNames
+ );
+
+ HRESULT QuerySubConditionNames(
+ [in] LPWSTR szConditionName,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] LPWSTR** ppszSubConditionNames
+ );
+
+ HRESULT QuerySourceConditions(
+ [in] LPWSTR szSource,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] LPWSTR** ppszConditionNames
+ );
+
+ HRESULT QueryEventAttributes(
+ [in] DWORD dwEventCategory,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] DWORD** ppdwAttrIDs,
+ [out, size_is(,*pdwCount)] LPWSTR** ppszAttrDescs,
+ [out, size_is(,*pdwCount)] VARTYPE** ppvtAttrTypes
+ );
+
+ HRESULT TranslateToItemIDs(
+ [in] LPWSTR szSource,
+ [in] DWORD dwEventCategory,
+ [in] LPWSTR szConditionName,
+ [in] LPWSTR szSubconditionName,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] DWORD* pdwAssocAttrIDs,
+ [out, size_is(,dwCount)] LPWSTR** ppszAttrItemIDs,
+ [out, size_is(,dwCount)] LPWSTR** ppszNodeNames,
+ [out, size_is(,dwCount)] CLSID** ppCLSIDs
+ );
+
+ HRESULT GetConditionState (
+ [in] LPWSTR szSource,
+ [in] LPWSTR szConditionName,
+ [in] DWORD dwNumEventAttrs,
+ [in, size_is(dwNumEventAttrs)] DWORD* pdwAttributeIDs,
+ [out] OPCCONDITIONSTATE** ppConditionState
+ );
+
+ HRESULT EnableConditionByArea(
+ [in] DWORD dwNumAreas,
+ [in, size_is(dwNumAreas)] LPWSTR* pszAreas
+ );
+
+
+ HRESULT EnableConditionBySource(
+ [in] DWORD dwNumSources,
+ [in, size_is(dwNumSources)] LPWSTR* pszSources
+ );
+
+ HRESULT DisableConditionByArea(
+ [in] DWORD dwNumAreas,
+ [in, size_is(dwNumAreas)] LPWSTR* pszAreas
+ );
+
+ HRESULT DisableConditionBySource(
+ [in] DWORD dwNumSources,
+ [in, size_is(dwNumSources)] LPWSTR* pszSources
+ );
+
+ HRESULT AckCondition(
+ [in] DWORD dwCount,
+ [in, string] LPWSTR szAcknowledgerID,
+ [in, string] LPWSTR szComment,
+ [in, size_is(dwCount)] LPWSTR* pszSource,
+ [in, size_is(dwCount)] LPWSTR* pszConditionName,
+ [in, size_is(dwCount)] FILETIME* pftActiveTime,
+ [in, size_is(dwCount)] DWORD* pdwCookie,
+ [out, size_is(,dwCount)] HRESULT** ppErrors
+ );
+
+ HRESULT CreateAreaBrowser(
+ [in] REFIID riid,
+ [out, iid_is(riid)] LPUNKNOWN* ppUnk
+ );
+};
+
+//==============================================================================
+// IOPCEventSubscriptionMgt
+
+[
+ uuid(65168855-5783-11D1-84A0-00608CB8A7E9),
+ pointer_default(unique)
+]
+interface IOPCEventSubscriptionMgt : IUnknown
+{
+ HRESULT SetFilter(
+ [in] DWORD dwEventType,
+ [in] DWORD dwNumCategories,
+ [in, size_is(dwNumCategories)] DWORD* pdwEventCategories,
+ [in] DWORD dwLowSeverity,
+ [in] DWORD dwHighSeverity,
+ [in] DWORD dwNumAreas,
+ [in, size_is(dwNumAreas)] LPWSTR* pszAreaList,
+ [in] DWORD dwNumSources,
+ [in, size_is(dwNumSources)] LPWSTR* pszSourceList
+ );
+
+ HRESULT GetFilter(
+ [out] DWORD* pdwEventType,
+ [out] DWORD* pdwNumCategories,
+ [out, size_is(,*pdwNumCategories)] DWORD** ppdwEventCategories,
+ [out] DWORD* pdwLowSeverity,
+ [out] DWORD* pdwHighSeverity,
+ [out] DWORD* pdwNumAreas,
+ [out, size_is(,*pdwNumAreas)] LPWSTR** ppszAreaList,
+ [out] DWORD* pdwNumSources,
+ [out, size_is(,*pdwNumSources)] LPWSTR** ppszSourceList
+ );
+
+ HRESULT SelectReturnedAttributes(
+ [in] DWORD dwEventCategory,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] DWORD* dwAttributeIDs
+ );
+
+ HRESULT GetReturnedAttributes(
+ [in] DWORD dwEventCategory,
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] DWORD** ppdwAttributeIDs
+ );
+
+
+ HRESULT Refresh(
+ [in] DWORD dwConnection
+ );
+
+ HRESULT CancelRefresh(
+ [in] DWORD dwConnection
+ );
+
+ HRESULT GetState(
+ [out] BOOL* pbActive,
+ [out] DWORD* pdwBufferTime,
+ [out] DWORD* pdwMaxSize,
+ [out] OPCHANDLE* phClientSubscription
+ );
+
+ HRESULT SetState(
+ [unique, in] BOOL* pbActive,
+ [unique, in] DWORD* pdwBufferTime,
+ [unique, in] DWORD* pdwMaxSize,
+ [in] OPCHANDLE hClientSubscription,
+ [out] DWORD* pdwRevisedBufferTime,
+ [out] DWORD* pdwRevisedMaxSize
+ );
+};
+
+//==============================================================================
+// IOPCEventAreaBrowser
+
+[
+ uuid(65168857-5783-11D1-84A0-00608CB8A7E9),
+ pointer_default(unique)
+]
+interface IOPCEventAreaBrowser : IUnknown
+{
+ HRESULT ChangeBrowsePosition(
+ [in] OPCAEBROWSEDIRECTION dwBrowseDirection,
+ [in, string] LPCWSTR szString
+ );
+
+ HRESULT BrowseOPCAreas(
+ [in] OPCAEBROWSETYPE dwBrowseFilterType,
+ [in, string] LPCWSTR szFilterCriteria,
+ [out] LPENUMSTRING* ppIEnumString
+ );
+
+ HRESULT GetQualifiedAreaName(
+ [in] LPCWSTR szAreaName,
+ [out, string] LPWSTR* pszQualifiedAreaName
+ );
+
+ HRESULT GetQualifiedSourceName(
+ [in] LPCWSTR szSourceName,
+ [out, string] LPWSTR* pszQualifiedSourceName
+ );
+};
+
+//==============================================================================
+// IOPCEventSink
+
+[
+ uuid(6516885F-5783-11D1-84A0-00608CB8A7E9),
+ pointer_default(unique)
+]
+interface IOPCEventSink : IUnknown
+{
+ HRESULT OnEvent(
+ [in] OPCHANDLE hClientSubscription,
+ [in] BOOL bRefresh,
+ [in] BOOL bLastRefresh,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] ONEVENTSTRUCT* pEvents
+ );
+};
+
+//==============================================================================
+// IOPCEventServer2
+
+[
+ uuid(71BBE88E-9564-4bcd-BCFC-71C558D94F2D),
+ pointer_default(unique)
+]
+interface IOPCEventServer2 : IOPCEventServer
+{
+ HRESULT EnableConditionByArea2(
+ [in] DWORD dwNumAreas,
+ [in, string, size_is(dwNumAreas)] LPWSTR* pszAreas,
+ [out, size_is(,dwNumAreas)] HRESULT** ppErrors
+ );
+
+ HRESULT EnableConditionBySource2(
+ [in] DWORD dwNumSources,
+ [in, string, size_is(dwNumSources)] LPWSTR* pszSources,
+ [out, size_is(,dwNumSources)] HRESULT** ppErrors
+ );
+
+ HRESULT DisableConditionByArea2(
+ [in] DWORD dwNumAreas,
+ [in, string, size_is(dwNumAreas)] LPWSTR* pszAreas,
+ [out, size_is(,dwNumAreas)] HRESULT** ppErrors
+ );
+
+ HRESULT DisableConditionBySource2(
+ [in] DWORD dwNumSources,
+ [in, string, size_is(dwNumSources)] LPWSTR* pszSources,
+ [out, size_is(,dwNumSources)] HRESULT** ppErrors
+ );
+
+ HRESULT GetEnableStateByArea(
+ [in] DWORD dwNumAreas,
+ [in, string, size_is(dwNumAreas)] LPWSTR* pszAreas,
+ [out, size_is(,dwNumAreas)] BOOL** pbEnabled,
+ [out, size_is(,dwNumAreas)] BOOL** pbEffectivelyEnabled,
+ [out, size_is(,dwNumAreas)] HRESULT** ppErrors
+ );
+
+ HRESULT GetEnableStateBySource(
+ [in] DWORD dwNumSources,
+ [in, string, size_is(dwNumSources)] LPWSTR* pszSources,
+ [out, size_is(,dwNumSources)] BOOL** pbEnabled,
+ [out, size_is(,dwNumSources)] BOOL** pbEffectivelyEnabled,
+ [out, size_is(,dwNumSources)] HRESULT** ppErrors
+ );
+};
+
+//==============================================================================
+// IOPCEventSubscriptionMgt2
+
+[
+ uuid(94C955DC-3684-4ccb-AFAB-F898CE19AAC3),
+ pointer_default(unique)
+]
+interface IOPCEventSubscriptionMgt2 : IOPCEventSubscriptionMgt
+{
+ HRESULT SetKeepAlive(
+ [in] DWORD dwKeepAliveTime,
+ [out] DWORD* pdwRevisedKeepAliveTime
+ );
+
+ HRESULT GetKeepAlive(
+ [out] DWORD* pdwKeepAliveTime
+ );
+};
+
+//==============================================================================
+// Type Library
+
+[
+ uuid(65168844-5783-11D1-84A0-00608CB8A7E9),
+ version(1.10),
+ helpstring("OPC Alarms & Events 1.10 Type Library")
+]
+library OPC_AE
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ //==========================================================================
+ // Category IDs
+
+ interface OPCEventServerCATID;
+
+ //==========================================================================
+ // Constants
+
+ module OPCAE_Constants
+ {
+ // category description string.
+ const LPCWSTR OPC_CATEGORY_DESCRIPTION_AE10 = L"OPC Alarm & Event Server Version 1.0";
+
+ // state bit masks.
+ const DWORD OPC_CONDITION_ENABLED = 0x0001;
+ const DWORD OPC_CONDITION_ACTIVE = 0x0002;
+ const DWORD OPC_CONDITION_ACKED = 0x0004;
+
+ // bit masks for change mask.
+ const DWORD OPC_CHANGE_ACTIVE_STATE = 0x0001;
+ const DWORD OPC_CHANGE_ACK_STATE = 0x0002;
+ const DWORD OPC_CHANGE_ENABLE_STATE = 0x0004;
+ const DWORD OPC_CHANGE_QUALITY = 0x0008;
+ const DWORD OPC_CHANGE_SEVERITY = 0x0010;
+ const DWORD OPC_CHANGE_SUBCONDITION = 0x0020;
+ const DWORD OPC_CHANGE_MESSAGE = 0x0040;
+ const DWORD OPC_CHANGE_ATTRIBUTE = 0x0080;
+
+ // event type.
+ const DWORD OPC_SIMPLE_EVENT = 0x0001;
+ const DWORD OPC_TRACKING_EVENT = 0x0002;
+ const DWORD OPC_CONDITION_EVENT = 0x0004;
+ const DWORD OPC_ALL_EVENTS = 0x0007;
+
+ // bit masks for QueryAvailableFilters().
+ const DWORD OPC_FILTER_BY_EVENT = 0x0001;
+ const DWORD OPC_FILTER_BY_CATEGORY = 0x0002;
+ const DWORD OPC_FILTER_BY_SEVERITY = 0x0004;
+ const DWORD OPC_FILTER_BY_AREA = 0x0008;
+ const DWORD OPC_FILTER_BY_SOURCE = 0x0010;
+ }
+
+ //==========================================================================
+ // Synchronous Interfaces
+
+ interface IOPCEventServer;
+ interface IOPCEventSubscriptionMgt;
+ interface IOPCEventAreaBrowser;
+ interface IOPCEventSink;
+ interface OPCEventServerCATID;
+ interface IOPCEventServer2;
+ interface IOPCEventSubscriptionMgt2;
+};
diff --git a/opc_ae_bindings/.windows/winmd/OPCAE.winmd b/opc_ae_bindings/.windows/winmd/OPCAE.winmd
new file mode 100644
index 0000000..b68ac83
Binary files /dev/null and b/opc_ae_bindings/.windows/winmd/OPCAE.winmd differ
diff --git a/opc_ae_bindings/Cargo.toml b/opc_ae_bindings/Cargo.toml
new file mode 100644
index 0000000..c8dbda7
--- /dev/null
+++ b/opc_ae_bindings/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "opc_ae_bindings"
+version = "0.3.0"
+edition = "2024"
+description = "OPC Alarms & Event bindings"
+readme = "README.md"
+repository = "https://github.com/Ronbb/rust_opc"
+license = "MIT"
+keywords = ["ae", "bindings", "opc", "opcae"]
+exclude = [".metadata/*", ".windows/*", "build.rs"]
+
+[package.metadata.docs.rs]
+default-target = "x86_64-pc-windows-msvc"
+targets = []
+
+[dependencies]
+windows = { workspace = true }
+windows-core = { workspace = true }
+windows-targets = { workspace = true }
+
+[build-dependencies]
+windows-bindgen = { workspace = true }
diff --git a/opc_ae_bindings/README.md b/opc_ae_bindings/README.md
new file mode 100644
index 0000000..0eb2d41
--- /dev/null
+++ b/opc_ae_bindings/README.md
@@ -0,0 +1,18 @@
+# OPC Alarms & Event Bindings
+
+Please see docs on [docs.rs](https://docs.rs/opc_ae_bindings/).
+
+## Example
+
+```rust
+// TODO
+```
+
+## Rebuild metadata
+
+Open **Developer Powershell for VS2022**.
+
+```batch
+cd .metadata
+dotnet build
+```
diff --git a/opc_ae_bindings/build.rs b/opc_ae_bindings/build.rs
new file mode 100644
index 0000000..19d638c
--- /dev/null
+++ b/opc_ae_bindings/build.rs
@@ -0,0 +1,19 @@
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ println!("cargo:rerun-if-changed=.windows/winmd/OPCAE.winmd");
+
+ windows_bindgen::bindgen([
+ "--in",
+ ".windows/winmd/OPCAE.winmd",
+ "default",
+ "--out",
+ "src/bindings.rs",
+ "--reference",
+ "windows,skip-root,Windows",
+ "--filter",
+ "OPCAE",
+ "--flat",
+ "--implement",
+ ])
+ .unwrap();
+}
diff --git a/opc_ae_bindings/src/bindings.rs b/opc_ae_bindings/src/bindings.rs
new file mode 100644
index 0000000..af9123e
--- /dev/null
+++ b/opc_ae_bindings/src/bindings.rs
@@ -0,0 +1,2321 @@
+// Bindings generated by `windows-bindgen` 0.62.1
+
+#![allow(
+ non_snake_case,
+ non_upper_case_globals,
+ non_camel_case_types,
+ dead_code,
+ clippy::all
+)]
+
+windows_core::imp::define_interface!(
+ IOPCEventAreaBrowser,
+ IOPCEventAreaBrowser_Vtbl,
+ 0x65168857_5783_11d1_84a0_00608cb8a7e9
+);
+windows_core::imp::interface_hierarchy!(IOPCEventAreaBrowser, windows_core::IUnknown);
+impl IOPCEventAreaBrowser {
+ pub unsafe fn ChangeBrowsePosition(
+ &self,
+ dwbrowsedirection: __MIDL___MIDL_itf_opc_ae_0000_0001_0001,
+ szstring: P1,
+ ) -> windows_core::Result<()>
+ where
+ P1: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).ChangeBrowsePosition)(
+ windows_core::Interface::as_raw(self),
+ dwbrowsedirection,
+ szstring.param().abi(),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn BrowseOPCAreas(
+ &self,
+ dwbrowsefiltertype: __MIDL___MIDL_itf_opc_ae_0000_0001_0002,
+ szfiltercriteria: P1,
+ ) -> windows_core::Result
+ where
+ P1: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).BrowseOPCAreas)(
+ windows_core::Interface::as_raw(self),
+ dwbrowsefiltertype,
+ szfiltercriteria.param().abi(),
+ &mut result__,
+ )
+ .and_then(|| windows_core::Type::from_abi(result__))
+ }
+ }
+ pub unsafe fn GetQualifiedAreaName(
+ &self,
+ szareaname: P0,
+ ) -> windows_core::Result
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetQualifiedAreaName)(
+ windows_core::Interface::as_raw(self),
+ szareaname.param().abi(),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn GetQualifiedSourceName(
+ &self,
+ szsourcename: P0,
+ ) -> windows_core::Result
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetQualifiedSourceName)(
+ windows_core::Interface::as_raw(self),
+ szsourcename.param().abi(),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventAreaBrowser_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub ChangeBrowsePosition: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0001,
+ windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub BrowseOPCAreas: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0002,
+ windows_core::PCWSTR,
+ *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT,
+ pub GetQualifiedAreaName: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub GetQualifiedSourceName: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEventAreaBrowser_Impl: windows_core::IUnknownImpl {
+ fn ChangeBrowsePosition(
+ &self,
+ dwbrowsedirection: __MIDL___MIDL_itf_opc_ae_0000_0001_0001,
+ szstring: &windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn BrowseOPCAreas(
+ &self,
+ dwbrowsefiltertype: __MIDL___MIDL_itf_opc_ae_0000_0001_0002,
+ szfiltercriteria: &windows_core::PCWSTR,
+ ) -> windows_core::Result;
+ fn GetQualifiedAreaName(
+ &self,
+ szareaname: &windows_core::PCWSTR,
+ ) -> windows_core::Result;
+ fn GetQualifiedSourceName(
+ &self,
+ szsourcename: &windows_core::PCWSTR,
+ ) -> windows_core::Result;
+}
+impl IOPCEventAreaBrowser_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn ChangeBrowsePosition<
+ Identity: IOPCEventAreaBrowser_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwbrowsedirection: __MIDL___MIDL_itf_opc_ae_0000_0001_0001,
+ szstring: windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventAreaBrowser_Impl::ChangeBrowsePosition(
+ this,
+ core::mem::transmute_copy(&dwbrowsedirection),
+ core::mem::transmute(&szstring),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn BrowseOPCAreas<
+ Identity: IOPCEventAreaBrowser_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwbrowsefiltertype: __MIDL___MIDL_itf_opc_ae_0000_0001_0002,
+ szfiltercriteria: windows_core::PCWSTR,
+ ppienumstring: *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventAreaBrowser_Impl::BrowseOPCAreas(
+ this,
+ core::mem::transmute_copy(&dwbrowsefiltertype),
+ core::mem::transmute(&szfiltercriteria),
+ ) {
+ Ok(ok__) => {
+ ppienumstring.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn GetQualifiedAreaName<
+ Identity: IOPCEventAreaBrowser_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szareaname: windows_core::PCWSTR,
+ pszqualifiedareaname: *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventAreaBrowser_Impl::GetQualifiedAreaName(
+ this,
+ core::mem::transmute(&szareaname),
+ ) {
+ Ok(ok__) => {
+ pszqualifiedareaname.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn GetQualifiedSourceName<
+ Identity: IOPCEventAreaBrowser_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szsourcename: windows_core::PCWSTR,
+ pszqualifiedsourcename: *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventAreaBrowser_Impl::GetQualifiedSourceName(
+ this,
+ core::mem::transmute(&szsourcename),
+ ) {
+ Ok(ok__) => {
+ pszqualifiedsourcename.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ ChangeBrowsePosition: ChangeBrowsePosition::,
+ BrowseOPCAreas: BrowseOPCAreas::,
+ GetQualifiedAreaName: GetQualifiedAreaName::,
+ GetQualifiedSourceName: GetQualifiedSourceName::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventAreaBrowser {}
+windows_core::imp::define_interface!(
+ IOPCEventServer,
+ IOPCEventServer_Vtbl,
+ 0x65168851_5783_11d1_84a0_00608cb8a7e9
+);
+windows_core::imp::interface_hierarchy!(IOPCEventServer, windows_core::IUnknown);
+impl IOPCEventServer {
+ pub unsafe fn GetStatus(
+ &self,
+ ) -> windows_core::Result<*mut __MIDL___MIDL_itf_opc_ae_0000_0001_0005> {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetStatus)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn CreateEventSubscription(
+ &self,
+ bactive: bool,
+ dwbuffertime: u32,
+ dwmaxsize: u32,
+ hclientsubscription: u32,
+ riid: *const windows_core::GUID,
+ ppunk: *mut Option,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).CreateEventSubscription)(
+ windows_core::Interface::as_raw(self),
+ bactive.into(),
+ dwbuffertime,
+ dwmaxsize,
+ hclientsubscription,
+ riid,
+ core::mem::transmute(ppunk),
+ pdwrevisedbuffertime as _,
+ pdwrevisedmaxsize as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn QueryAvailableFilters(&self) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).QueryAvailableFilters)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn QueryEventCategories(
+ &self,
+ dweventtype: u32,
+ pdwcount: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ ppszeventcategorydescs: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).QueryEventCategories)(
+ windows_core::Interface::as_raw(self),
+ dweventtype,
+ pdwcount as _,
+ ppdweventcategories as _,
+ ppszeventcategorydescs as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn QueryConditionNames(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).QueryConditionNames)(
+ windows_core::Interface::as_raw(self),
+ dweventcategory,
+ pdwcount as _,
+ ppszconditionnames as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn QuerySubConditionNames(
+ &self,
+ szconditionname: P0,
+ pdwcount: *mut u32,
+ ppszsubconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).QuerySubConditionNames)(
+ windows_core::Interface::as_raw(self),
+ szconditionname.param().abi(),
+ pdwcount as _,
+ ppszsubconditionnames as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn QuerySourceConditions(
+ &self,
+ szsource: P0,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).QuerySourceConditions)(
+ windows_core::Interface::as_raw(self),
+ szsource.param().abi(),
+ pdwcount as _,
+ ppszconditionnames as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn QueryEventAttributes(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattrids: *mut *mut u32,
+ ppszattrdescs: *mut *mut windows_core::PWSTR,
+ ppvtattrtypes: *mut *mut u16,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).QueryEventAttributes)(
+ windows_core::Interface::as_raw(self),
+ dweventcategory,
+ pdwcount as _,
+ ppdwattrids as _,
+ ppszattrdescs as _,
+ ppvtattrtypes as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn TranslateToItemIDs(
+ &self,
+ szsource: P0,
+ dweventcategory: u32,
+ szconditionname: P2,
+ szsubconditionname: P3,
+ dwcount: u32,
+ pdwassocattrids: *const u32,
+ ppszattritemids: *mut *mut windows_core::PWSTR,
+ ppsznodenames: *mut *mut windows_core::PWSTR,
+ ppclsids: *mut *mut windows_core::GUID,
+ ) -> windows_core::Result<()>
+ where
+ P0: windows_core::Param,
+ P2: windows_core::Param,
+ P3: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).TranslateToItemIDs)(
+ windows_core::Interface::as_raw(self),
+ szsource.param().abi(),
+ dweventcategory,
+ szconditionname.param().abi(),
+ szsubconditionname.param().abi(),
+ dwcount,
+ pdwassocattrids,
+ ppszattritemids as _,
+ ppsznodenames as _,
+ ppclsids as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetConditionState(
+ &self,
+ szsource: P0,
+ szconditionname: P1,
+ pdwattributeids: &[u32],
+ ) -> windows_core::Result<*mut __MIDL___MIDL_itf_opc_ae_0000_0001_0006>
+ where
+ P0: windows_core::Param,
+ P1: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetConditionState)(
+ windows_core::Interface::as_raw(self),
+ szsource.param().abi(),
+ szconditionname.param().abi(),
+ pdwattributeids.len().try_into().unwrap(),
+ core::mem::transmute(pdwattributeids.as_ptr()),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn EnableConditionByArea(
+ &self,
+ pszareas: &[windows_core::PCWSTR],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).EnableConditionByArea)(
+ windows_core::Interface::as_raw(self),
+ pszareas.len().try_into().unwrap(),
+ core::mem::transmute(pszareas.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn EnableConditionBySource(
+ &self,
+ pszsources: &[windows_core::PCWSTR],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).EnableConditionBySource)(
+ windows_core::Interface::as_raw(self),
+ pszsources.len().try_into().unwrap(),
+ core::mem::transmute(pszsources.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn DisableConditionByArea(
+ &self,
+ pszareas: &[windows_core::PCWSTR],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).DisableConditionByArea)(
+ windows_core::Interface::as_raw(self),
+ pszareas.len().try_into().unwrap(),
+ core::mem::transmute(pszareas.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn DisableConditionBySource(
+ &self,
+ pszsources: &[windows_core::PCWSTR],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).DisableConditionBySource)(
+ windows_core::Interface::as_raw(self),
+ pszsources.len().try_into().unwrap(),
+ core::mem::transmute(pszsources.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn AckCondition(
+ &self,
+ dwcount: u32,
+ szacknowledgerid: P1,
+ szcomment: P2,
+ pszsource: *const windows_core::PCWSTR,
+ pszconditionname: *const windows_core::PCWSTR,
+ pftactivetime: *const windows::Win32::Foundation::FILETIME,
+ pdwcookie: *const u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>
+ where
+ P1: windows_core::Param,
+ P2: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).AckCondition)(
+ windows_core::Interface::as_raw(self),
+ dwcount,
+ szacknowledgerid.param().abi(),
+ szcomment.param().abi(),
+ pszsource,
+ pszconditionname,
+ pftactivetime,
+ pdwcookie,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn CreateAreaBrowser(
+ &self,
+ riid: *const windows_core::GUID,
+ ) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).CreateAreaBrowser)(
+ windows_core::Interface::as_raw(self),
+ riid,
+ &mut result__,
+ )
+ .and_then(|| windows_core::Type::from_abi(result__))
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventServer_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub GetStatus: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut *mut __MIDL___MIDL_itf_opc_ae_0000_0001_0005,
+ ) -> windows_core::HRESULT,
+ pub CreateEventSubscription: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::BOOL,
+ u32,
+ u32,
+ u32,
+ *const windows_core::GUID,
+ *mut *mut core::ffi::c_void,
+ *mut u32,
+ *mut u32,
+ ) -> windows_core::HRESULT,
+ pub QueryAvailableFilters:
+ unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
+ pub QueryEventCategories: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut u32,
+ *mut *mut u32,
+ *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub QueryConditionNames: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut u32,
+ *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub QuerySubConditionNames: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut u32,
+ *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub QuerySourceConditions: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut u32,
+ *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub QueryEventAttributes: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut u32,
+ *mut *mut u32,
+ *mut *mut windows_core::PWSTR,
+ *mut *mut u16,
+ ) -> windows_core::HRESULT,
+ pub TranslateToItemIDs: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ u32,
+ windows_core::PCWSTR,
+ windows_core::PCWSTR,
+ u32,
+ *const u32,
+ *mut *mut windows_core::PWSTR,
+ *mut *mut windows_core::PWSTR,
+ *mut *mut windows_core::GUID,
+ ) -> windows_core::HRESULT,
+ pub GetConditionState: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ windows_core::PCWSTR,
+ u32,
+ *const u32,
+ *mut *mut __MIDL___MIDL_itf_opc_ae_0000_0001_0006,
+ ) -> windows_core::HRESULT,
+ pub EnableConditionByArea: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub EnableConditionBySource: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub DisableConditionByArea: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub DisableConditionBySource: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub AckCondition: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ windows_core::PCWSTR,
+ windows_core::PCWSTR,
+ *const windows_core::PCWSTR,
+ *const windows_core::PCWSTR,
+ *const windows::Win32::Foundation::FILETIME,
+ *const u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub CreateAreaBrowser: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *const windows_core::GUID,
+ *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEventServer_Impl: windows_core::IUnknownImpl {
+ fn GetStatus(&self) -> windows_core::Result<*mut __MIDL___MIDL_itf_opc_ae_0000_0001_0005>;
+ fn CreateEventSubscription(
+ &self,
+ bactive: windows_core::BOOL,
+ dwbuffertime: u32,
+ dwmaxsize: u32,
+ hclientsubscription: u32,
+ riid: *const windows_core::GUID,
+ ppunk: windows_core::OutRef<'_, windows_core::IUnknown>,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::Result<()>;
+ fn QueryAvailableFilters(&self) -> windows_core::Result;
+ fn QueryEventCategories(
+ &self,
+ dweventtype: u32,
+ pdwcount: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ ppszeventcategorydescs: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn QueryConditionNames(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn QuerySubConditionNames(
+ &self,
+ szconditionname: &windows_core::PCWSTR,
+ pdwcount: *mut u32,
+ ppszsubconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn QuerySourceConditions(
+ &self,
+ szsource: &windows_core::PCWSTR,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn QueryEventAttributes(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattrids: *mut *mut u32,
+ ppszattrdescs: *mut *mut windows_core::PWSTR,
+ ppvtattrtypes: *mut *mut u16,
+ ) -> windows_core::Result<()>;
+ fn TranslateToItemIDs(
+ &self,
+ szsource: &windows_core::PCWSTR,
+ dweventcategory: u32,
+ szconditionname: &windows_core::PCWSTR,
+ szsubconditionname: &windows_core::PCWSTR,
+ dwcount: u32,
+ pdwassocattrids: *const u32,
+ ppszattritemids: *mut *mut windows_core::PWSTR,
+ ppsznodenames: *mut *mut windows_core::PWSTR,
+ ppclsids: *mut *mut windows_core::GUID,
+ ) -> windows_core::Result<()>;
+ fn GetConditionState(
+ &self,
+ szsource: &windows_core::PCWSTR,
+ szconditionname: &windows_core::PCWSTR,
+ dwnumeventattrs: u32,
+ pdwattributeids: *const u32,
+ ) -> windows_core::Result<*mut __MIDL___MIDL_itf_opc_ae_0000_0001_0006>;
+ fn EnableConditionByArea(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn EnableConditionBySource(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn DisableConditionByArea(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn DisableConditionBySource(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn AckCondition(
+ &self,
+ dwcount: u32,
+ szacknowledgerid: &windows_core::PCWSTR,
+ szcomment: &windows_core::PCWSTR,
+ pszsource: *const windows_core::PCWSTR,
+ pszconditionname: *const windows_core::PCWSTR,
+ pftactivetime: *const windows::Win32::Foundation::FILETIME,
+ pdwcookie: *const u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn CreateAreaBrowser(
+ &self,
+ riid: *const windows_core::GUID,
+ ) -> windows_core::Result;
+}
+impl IOPCEventServer_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn GetStatus(
+ this: *mut core::ffi::c_void,
+ ppeventserverstatus: *mut *mut __MIDL___MIDL_itf_opc_ae_0000_0001_0005,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventServer_Impl::GetStatus(this) {
+ Ok(ok__) => {
+ ppeventserverstatus.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn CreateEventSubscription<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ bactive: windows_core::BOOL,
+ dwbuffertime: u32,
+ dwmaxsize: u32,
+ hclientsubscription: u32,
+ riid: *const windows_core::GUID,
+ ppunk: *mut *mut core::ffi::c_void,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::CreateEventSubscription(
+ this,
+ core::mem::transmute_copy(&bactive),
+ core::mem::transmute_copy(&dwbuffertime),
+ core::mem::transmute_copy(&dwmaxsize),
+ core::mem::transmute_copy(&hclientsubscription),
+ core::mem::transmute_copy(&riid),
+ core::mem::transmute_copy(&ppunk),
+ core::mem::transmute_copy(&pdwrevisedbuffertime),
+ core::mem::transmute_copy(&pdwrevisedmaxsize),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn QueryAvailableFilters<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pdwfiltermask: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventServer_Impl::QueryAvailableFilters(this) {
+ Ok(ok__) => {
+ pdwfiltermask.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn QueryEventCategories<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventtype: u32,
+ pdwcount: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ ppszeventcategorydescs: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::QueryEventCategories(
+ this,
+ core::mem::transmute_copy(&dweventtype),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppdweventcategories),
+ core::mem::transmute_copy(&ppszeventcategorydescs),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn QueryConditionNames<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::QueryConditionNames(
+ this,
+ core::mem::transmute_copy(&dweventcategory),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppszconditionnames),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn QuerySubConditionNames<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szconditionname: windows_core::PCWSTR,
+ pdwcount: *mut u32,
+ ppszsubconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::QuerySubConditionNames(
+ this,
+ core::mem::transmute(&szconditionname),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppszsubconditionnames),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn QuerySourceConditions<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szsource: windows_core::PCWSTR,
+ pdwcount: *mut u32,
+ ppszconditionnames: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::QuerySourceConditions(
+ this,
+ core::mem::transmute(&szsource),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppszconditionnames),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn QueryEventAttributes<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattrids: *mut *mut u32,
+ ppszattrdescs: *mut *mut windows_core::PWSTR,
+ ppvtattrtypes: *mut *mut u16,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::QueryEventAttributes(
+ this,
+ core::mem::transmute_copy(&dweventcategory),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppdwattrids),
+ core::mem::transmute_copy(&ppszattrdescs),
+ core::mem::transmute_copy(&ppvtattrtypes),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn TranslateToItemIDs<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szsource: windows_core::PCWSTR,
+ dweventcategory: u32,
+ szconditionname: windows_core::PCWSTR,
+ szsubconditionname: windows_core::PCWSTR,
+ dwcount: u32,
+ pdwassocattrids: *const u32,
+ ppszattritemids: *mut *mut windows_core::PWSTR,
+ ppsznodenames: *mut *mut windows_core::PWSTR,
+ ppclsids: *mut *mut windows_core::GUID,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::TranslateToItemIDs(
+ this,
+ core::mem::transmute(&szsource),
+ core::mem::transmute_copy(&dweventcategory),
+ core::mem::transmute(&szconditionname),
+ core::mem::transmute(&szsubconditionname),
+ core::mem::transmute_copy(&dwcount),
+ core::mem::transmute_copy(&pdwassocattrids),
+ core::mem::transmute_copy(&ppszattritemids),
+ core::mem::transmute_copy(&ppsznodenames),
+ core::mem::transmute_copy(&ppclsids),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetConditionState<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szsource: windows_core::PCWSTR,
+ szconditionname: windows_core::PCWSTR,
+ dwnumeventattrs: u32,
+ pdwattributeids: *const u32,
+ ppconditionstate: *mut *mut __MIDL___MIDL_itf_opc_ae_0000_0001_0006,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventServer_Impl::GetConditionState(
+ this,
+ core::mem::transmute(&szsource),
+ core::mem::transmute(&szconditionname),
+ core::mem::transmute_copy(&dwnumeventattrs),
+ core::mem::transmute_copy(&pdwattributeids),
+ ) {
+ Ok(ok__) => {
+ ppconditionstate.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn EnableConditionByArea<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::EnableConditionByArea(
+ this,
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszareas),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn EnableConditionBySource<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::EnableConditionBySource(
+ this,
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsources),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn DisableConditionByArea<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::DisableConditionByArea(
+ this,
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszareas),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn DisableConditionBySource<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::DisableConditionBySource(
+ this,
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsources),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn AckCondition<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwcount: u32,
+ szacknowledgerid: windows_core::PCWSTR,
+ szcomment: windows_core::PCWSTR,
+ pszsource: *const windows_core::PCWSTR,
+ pszconditionname: *const windows_core::PCWSTR,
+ pftactivetime: *const windows::Win32::Foundation::FILETIME,
+ pdwcookie: *const u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer_Impl::AckCondition(
+ this,
+ core::mem::transmute_copy(&dwcount),
+ core::mem::transmute(&szacknowledgerid),
+ core::mem::transmute(&szcomment),
+ core::mem::transmute_copy(&pszsource),
+ core::mem::transmute_copy(&pszconditionname),
+ core::mem::transmute_copy(&pftactivetime),
+ core::mem::transmute_copy(&pdwcookie),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn CreateAreaBrowser<
+ Identity: IOPCEventServer_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ riid: *const windows_core::GUID,
+ ppunk: *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventServer_Impl::CreateAreaBrowser(
+ this,
+ core::mem::transmute_copy(&riid),
+ ) {
+ Ok(ok__) => {
+ ppunk.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ GetStatus: GetStatus::,
+ CreateEventSubscription: CreateEventSubscription::,
+ QueryAvailableFilters: QueryAvailableFilters::,
+ QueryEventCategories: QueryEventCategories::,
+ QueryConditionNames: QueryConditionNames::,
+ QuerySubConditionNames: QuerySubConditionNames::,
+ QuerySourceConditions: QuerySourceConditions::,
+ QueryEventAttributes: QueryEventAttributes::,
+ TranslateToItemIDs: TranslateToItemIDs::,
+ GetConditionState: GetConditionState::,
+ EnableConditionByArea: EnableConditionByArea::,
+ EnableConditionBySource: EnableConditionBySource::,
+ DisableConditionByArea: DisableConditionByArea::,
+ DisableConditionBySource: DisableConditionBySource::,
+ AckCondition: AckCondition::,
+ CreateAreaBrowser: CreateAreaBrowser::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventServer {}
+windows_core::imp::define_interface!(
+ IOPCEventServer2,
+ IOPCEventServer2_Vtbl,
+ 0x71bbe88e_9564_4bcd_bcfc_71c558d94f2d
+);
+impl core::ops::Deref for IOPCEventServer2 {
+ type Target = IOPCEventServer;
+ fn deref(&self) -> &Self::Target {
+ unsafe { core::mem::transmute(self) }
+ }
+}
+windows_core::imp::interface_hierarchy!(IOPCEventServer2, windows_core::IUnknown, IOPCEventServer);
+impl IOPCEventServer2 {
+ pub unsafe fn EnableConditionByArea2(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).EnableConditionByArea2)(
+ windows_core::Interface::as_raw(self),
+ dwnumareas,
+ pszareas,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn EnableConditionBySource2(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).EnableConditionBySource2)(
+ windows_core::Interface::as_raw(self),
+ dwnumsources,
+ pszsources,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn DisableConditionByArea2(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).DisableConditionByArea2)(
+ windows_core::Interface::as_raw(self),
+ dwnumareas,
+ pszareas,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn DisableConditionBySource2(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).DisableConditionBySource2)(
+ windows_core::Interface::as_raw(self),
+ dwnumsources,
+ pszsources,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetEnableStateByArea(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetEnableStateByArea)(
+ windows_core::Interface::as_raw(self),
+ dwnumareas,
+ pszareas,
+ pbenabled as _,
+ pbeffectivelyenabled as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetEnableStateBySource(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetEnableStateBySource)(
+ windows_core::Interface::as_raw(self),
+ dwnumsources,
+ pszsources,
+ pbenabled as _,
+ pbeffectivelyenabled as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventServer2_Vtbl {
+ pub base__: IOPCEventServer_Vtbl,
+ pub EnableConditionByArea2: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub EnableConditionBySource2: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub DisableConditionByArea2: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub DisableConditionBySource2: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub GetEnableStateByArea: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::BOOL,
+ *mut *mut windows_core::BOOL,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub GetEnableStateBySource: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::PCWSTR,
+ *mut *mut windows_core::BOOL,
+ *mut *mut windows_core::BOOL,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEventServer2_Impl: IOPCEventServer_Impl {
+ fn EnableConditionByArea2(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn EnableConditionBySource2(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn DisableConditionByArea2(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn DisableConditionBySource2(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn GetEnableStateByArea(
+ &self,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn GetEnableStateBySource(
+ &self,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+}
+impl IOPCEventServer2_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn EnableConditionByArea2<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::EnableConditionByArea2(
+ this,
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszareas),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn EnableConditionBySource2<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::EnableConditionBySource2(
+ this,
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsources),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn DisableConditionByArea2<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::DisableConditionByArea2(
+ this,
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszareas),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn DisableConditionBySource2<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::DisableConditionBySource2(
+ this,
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsources),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetEnableStateByArea<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumareas: u32,
+ pszareas: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::GetEnableStateByArea(
+ this,
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszareas),
+ core::mem::transmute_copy(&pbenabled),
+ core::mem::transmute_copy(&pbeffectivelyenabled),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetEnableStateBySource<
+ Identity: IOPCEventServer2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwnumsources: u32,
+ pszsources: *const windows_core::PCWSTR,
+ pbenabled: *mut *mut windows_core::BOOL,
+ pbeffectivelyenabled: *mut *mut windows_core::BOOL,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventServer2_Impl::GetEnableStateBySource(
+ this,
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsources),
+ core::mem::transmute_copy(&pbenabled),
+ core::mem::transmute_copy(&pbeffectivelyenabled),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ Self {
+ base__: IOPCEventServer_Vtbl::new::(),
+ EnableConditionByArea2: EnableConditionByArea2::,
+ EnableConditionBySource2: EnableConditionBySource2::,
+ DisableConditionByArea2: DisableConditionByArea2::,
+ DisableConditionBySource2: DisableConditionBySource2::,
+ GetEnableStateByArea: GetEnableStateByArea::,
+ GetEnableStateBySource: GetEnableStateBySource::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ || iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventServer2 {}
+windows_core::imp::define_interface!(
+ IOPCEventSink,
+ IOPCEventSink_Vtbl,
+ 0x6516885f_5783_11d1_84a0_00608cb8a7e9
+);
+windows_core::imp::interface_hierarchy!(IOPCEventSink, windows_core::IUnknown);
+impl IOPCEventSink {
+ pub unsafe fn OnEvent(
+ &self,
+ hclientsubscription: u32,
+ brefresh: bool,
+ blastrefresh: bool,
+ pevents: &[__MIDL___MIDL_itf_opc_ae_0000_0001_0004],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).OnEvent)(
+ windows_core::Interface::as_raw(self),
+ hclientsubscription,
+ brefresh.into(),
+ blastrefresh.into(),
+ pevents.len().try_into().unwrap(),
+ core::mem::transmute(pevents.as_ptr()),
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventSink_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub OnEvent: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ windows_core::BOOL,
+ windows_core::BOOL,
+ u32,
+ *const __MIDL___MIDL_itf_opc_ae_0000_0001_0004,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEventSink_Impl: windows_core::IUnknownImpl {
+ fn OnEvent(
+ &self,
+ hclientsubscription: u32,
+ brefresh: windows_core::BOOL,
+ blastrefresh: windows_core::BOOL,
+ dwcount: u32,
+ pevents: *const __MIDL___MIDL_itf_opc_ae_0000_0001_0004,
+ ) -> windows_core::Result<()>;
+}
+impl IOPCEventSink_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn OnEvent(
+ this: *mut core::ffi::c_void,
+ hclientsubscription: u32,
+ brefresh: windows_core::BOOL,
+ blastrefresh: windows_core::BOOL,
+ dwcount: u32,
+ pevents: *const __MIDL___MIDL_itf_opc_ae_0000_0001_0004,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSink_Impl::OnEvent(
+ this,
+ core::mem::transmute_copy(&hclientsubscription),
+ core::mem::transmute_copy(&brefresh),
+ core::mem::transmute_copy(&blastrefresh),
+ core::mem::transmute_copy(&dwcount),
+ core::mem::transmute_copy(&pevents),
+ )
+ .into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ OnEvent: OnEvent::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventSink {}
+windows_core::imp::define_interface!(
+ IOPCEventSubscriptionMgt,
+ IOPCEventSubscriptionMgt_Vtbl,
+ 0x65168855_5783_11d1_84a0_00608cb8a7e9
+);
+windows_core::imp::interface_hierarchy!(IOPCEventSubscriptionMgt, windows_core::IUnknown);
+impl IOPCEventSubscriptionMgt {
+ pub unsafe fn SetFilter(
+ &self,
+ dweventtype: u32,
+ pdweventcategories: &[u32],
+ dwlowseverity: u32,
+ dwhighseverity: u32,
+ pszarealist: &[windows_core::PCWSTR],
+ pszsourcelist: &[windows_core::PCWSTR],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).SetFilter)(
+ windows_core::Interface::as_raw(self),
+ dweventtype,
+ pdweventcategories.len().try_into().unwrap(),
+ core::mem::transmute(pdweventcategories.as_ptr()),
+ dwlowseverity,
+ dwhighseverity,
+ pszarealist.len().try_into().unwrap(),
+ core::mem::transmute(pszarealist.as_ptr()),
+ pszsourcelist.len().try_into().unwrap(),
+ core::mem::transmute(pszsourcelist.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetFilter(
+ &self,
+ pdweventtype: *mut u32,
+ pdwnumcategories: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ pdwlowseverity: *mut u32,
+ pdwhighseverity: *mut u32,
+ pdwnumareas: *mut u32,
+ ppszarealist: *mut *mut windows_core::PWSTR,
+ pdwnumsources: *mut u32,
+ ppszsourcelist: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetFilter)(
+ windows_core::Interface::as_raw(self),
+ pdweventtype as _,
+ pdwnumcategories as _,
+ ppdweventcategories as _,
+ pdwlowseverity as _,
+ pdwhighseverity as _,
+ pdwnumareas as _,
+ ppszarealist as _,
+ pdwnumsources as _,
+ ppszsourcelist as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn SelectReturnedAttributes(
+ &self,
+ dweventcategory: u32,
+ dwattributeids: &[u32],
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).SelectReturnedAttributes)(
+ windows_core::Interface::as_raw(self),
+ dweventcategory,
+ dwattributeids.len().try_into().unwrap(),
+ core::mem::transmute(dwattributeids.as_ptr()),
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetReturnedAttributes(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattributeids: *mut *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetReturnedAttributes)(
+ windows_core::Interface::as_raw(self),
+ dweventcategory,
+ pdwcount as _,
+ ppdwattributeids as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Refresh(&self, dwconnection: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Refresh)(
+ windows_core::Interface::as_raw(self),
+ dwconnection,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn CancelRefresh(&self, dwconnection: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).CancelRefresh)(
+ windows_core::Interface::as_raw(self),
+ dwconnection,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetState(
+ &self,
+ pbactive: *mut windows_core::BOOL,
+ pdwbuffertime: *mut u32,
+ pdwmaxsize: *mut u32,
+ phclientsubscription: *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetState)(
+ windows_core::Interface::as_raw(self),
+ pbactive as _,
+ pdwbuffertime as _,
+ pdwmaxsize as _,
+ phclientsubscription as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn SetState(
+ &self,
+ pbactive: *const windows_core::BOOL,
+ pdwbuffertime: *const u32,
+ pdwmaxsize: *const u32,
+ hclientsubscription: u32,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).SetState)(
+ windows_core::Interface::as_raw(self),
+ pbactive,
+ pdwbuffertime,
+ pdwmaxsize,
+ hclientsubscription,
+ pdwrevisedbuffertime as _,
+ pdwrevisedmaxsize as _,
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventSubscriptionMgt_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub SetFilter: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ u32,
+ *const u32,
+ u32,
+ u32,
+ u32,
+ *const windows_core::PCWSTR,
+ u32,
+ *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+ pub GetFilter: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut u32,
+ *mut u32,
+ *mut *mut u32,
+ *mut u32,
+ *mut u32,
+ *mut u32,
+ *mut *mut windows_core::PWSTR,
+ *mut u32,
+ *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub SelectReturnedAttributes: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ u32,
+ *const u32,
+ ) -> windows_core::HRESULT,
+ pub GetReturnedAttributes: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut u32,
+ *mut *mut u32,
+ ) -> windows_core::HRESULT,
+ pub Refresh: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+ pub CancelRefresh:
+ unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+ pub GetState: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut windows_core::BOOL,
+ *mut u32,
+ *mut u32,
+ *mut u32,
+ ) -> windows_core::HRESULT,
+ pub SetState: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *const windows_core::BOOL,
+ *const u32,
+ *const u32,
+ u32,
+ *mut u32,
+ *mut u32,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEventSubscriptionMgt_Impl: windows_core::IUnknownImpl {
+ fn SetFilter(
+ &self,
+ dweventtype: u32,
+ dwnumcategories: u32,
+ pdweventcategories: *const u32,
+ dwlowseverity: u32,
+ dwhighseverity: u32,
+ dwnumareas: u32,
+ pszarealist: *const windows_core::PCWSTR,
+ dwnumsources: u32,
+ pszsourcelist: *const windows_core::PCWSTR,
+ ) -> windows_core::Result<()>;
+ fn GetFilter(
+ &self,
+ pdweventtype: *mut u32,
+ pdwnumcategories: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ pdwlowseverity: *mut u32,
+ pdwhighseverity: *mut u32,
+ pdwnumareas: *mut u32,
+ ppszarealist: *mut *mut windows_core::PWSTR,
+ pdwnumsources: *mut u32,
+ ppszsourcelist: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn SelectReturnedAttributes(
+ &self,
+ dweventcategory: u32,
+ dwcount: u32,
+ dwattributeids: *const u32,
+ ) -> windows_core::Result<()>;
+ fn GetReturnedAttributes(
+ &self,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattributeids: *mut *mut u32,
+ ) -> windows_core::Result<()>;
+ fn Refresh(&self, dwconnection: u32) -> windows_core::Result<()>;
+ fn CancelRefresh(&self, dwconnection: u32) -> windows_core::Result<()>;
+ fn GetState(
+ &self,
+ pbactive: *mut windows_core::BOOL,
+ pdwbuffertime: *mut u32,
+ pdwmaxsize: *mut u32,
+ phclientsubscription: *mut u32,
+ ) -> windows_core::Result<()>;
+ fn SetState(
+ &self,
+ pbactive: *const windows_core::BOOL,
+ pdwbuffertime: *const u32,
+ pdwmaxsize: *const u32,
+ hclientsubscription: u32,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::Result<()>;
+}
+impl IOPCEventSubscriptionMgt_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn SetFilter<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventtype: u32,
+ dwnumcategories: u32,
+ pdweventcategories: *const u32,
+ dwlowseverity: u32,
+ dwhighseverity: u32,
+ dwnumareas: u32,
+ pszarealist: *const windows_core::PCWSTR,
+ dwnumsources: u32,
+ pszsourcelist: *const windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::SetFilter(
+ this,
+ core::mem::transmute_copy(&dweventtype),
+ core::mem::transmute_copy(&dwnumcategories),
+ core::mem::transmute_copy(&pdweventcategories),
+ core::mem::transmute_copy(&dwlowseverity),
+ core::mem::transmute_copy(&dwhighseverity),
+ core::mem::transmute_copy(&dwnumareas),
+ core::mem::transmute_copy(&pszarealist),
+ core::mem::transmute_copy(&dwnumsources),
+ core::mem::transmute_copy(&pszsourcelist),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetFilter<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pdweventtype: *mut u32,
+ pdwnumcategories: *mut u32,
+ ppdweventcategories: *mut *mut u32,
+ pdwlowseverity: *mut u32,
+ pdwhighseverity: *mut u32,
+ pdwnumareas: *mut u32,
+ ppszarealist: *mut *mut windows_core::PWSTR,
+ pdwnumsources: *mut u32,
+ ppszsourcelist: *mut *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::GetFilter(
+ this,
+ core::mem::transmute_copy(&pdweventtype),
+ core::mem::transmute_copy(&pdwnumcategories),
+ core::mem::transmute_copy(&ppdweventcategories),
+ core::mem::transmute_copy(&pdwlowseverity),
+ core::mem::transmute_copy(&pdwhighseverity),
+ core::mem::transmute_copy(&pdwnumareas),
+ core::mem::transmute_copy(&ppszarealist),
+ core::mem::transmute_copy(&pdwnumsources),
+ core::mem::transmute_copy(&ppszsourcelist),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn SelectReturnedAttributes<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventcategory: u32,
+ dwcount: u32,
+ dwattributeids: *const u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::SelectReturnedAttributes(
+ this,
+ core::mem::transmute_copy(&dweventcategory),
+ core::mem::transmute_copy(&dwcount),
+ core::mem::transmute_copy(&dwattributeids),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetReturnedAttributes<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dweventcategory: u32,
+ pdwcount: *mut u32,
+ ppdwattributeids: *mut *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::GetReturnedAttributes(
+ this,
+ core::mem::transmute_copy(&dweventcategory),
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&ppdwattributeids),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn Refresh<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwconnection: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::Refresh(
+ this,
+ core::mem::transmute_copy(&dwconnection),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn CancelRefresh<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwconnection: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::CancelRefresh(
+ this,
+ core::mem::transmute_copy(&dwconnection),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetState<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pbactive: *mut windows_core::BOOL,
+ pdwbuffertime: *mut u32,
+ pdwmaxsize: *mut u32,
+ phclientsubscription: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::GetState(
+ this,
+ core::mem::transmute_copy(&pbactive),
+ core::mem::transmute_copy(&pdwbuffertime),
+ core::mem::transmute_copy(&pdwmaxsize),
+ core::mem::transmute_copy(&phclientsubscription),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn SetState<
+ Identity: IOPCEventSubscriptionMgt_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pbactive: *const windows_core::BOOL,
+ pdwbuffertime: *const u32,
+ pdwmaxsize: *const u32,
+ hclientsubscription: u32,
+ pdwrevisedbuffertime: *mut u32,
+ pdwrevisedmaxsize: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEventSubscriptionMgt_Impl::SetState(
+ this,
+ core::mem::transmute_copy(&pbactive),
+ core::mem::transmute_copy(&pdwbuffertime),
+ core::mem::transmute_copy(&pdwmaxsize),
+ core::mem::transmute_copy(&hclientsubscription),
+ core::mem::transmute_copy(&pdwrevisedbuffertime),
+ core::mem::transmute_copy(&pdwrevisedmaxsize),
+ )
+ .into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ SetFilter: SetFilter::,
+ GetFilter: GetFilter::,
+ SelectReturnedAttributes: SelectReturnedAttributes::,
+ GetReturnedAttributes: GetReturnedAttributes::,
+ Refresh: Refresh::,
+ CancelRefresh: CancelRefresh::,
+ GetState: GetState::,
+ SetState: SetState::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventSubscriptionMgt {}
+windows_core::imp::define_interface!(
+ IOPCEventSubscriptionMgt2,
+ IOPCEventSubscriptionMgt2_Vtbl,
+ 0x94c955dc_3684_4ccb_afab_f898ce19aac3
+);
+impl core::ops::Deref for IOPCEventSubscriptionMgt2 {
+ type Target = IOPCEventSubscriptionMgt;
+ fn deref(&self) -> &Self::Target {
+ unsafe { core::mem::transmute(self) }
+ }
+}
+windows_core::imp::interface_hierarchy!(
+ IOPCEventSubscriptionMgt2,
+ windows_core::IUnknown,
+ IOPCEventSubscriptionMgt
+);
+impl IOPCEventSubscriptionMgt2 {
+ pub unsafe fn SetKeepAlive(&self, dwkeepalivetime: u32) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).SetKeepAlive)(
+ windows_core::Interface::as_raw(self),
+ dwkeepalivetime,
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn GetKeepAlive(&self) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetKeepAlive)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEventSubscriptionMgt2_Vtbl {
+ pub base__: IOPCEventSubscriptionMgt_Vtbl,
+ pub SetKeepAlive:
+ unsafe extern "system" fn(*mut core::ffi::c_void, u32, *mut u32) -> windows_core::HRESULT,
+ pub GetKeepAlive:
+ unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
+}
+pub trait IOPCEventSubscriptionMgt2_Impl: IOPCEventSubscriptionMgt_Impl {
+ fn SetKeepAlive(&self, dwkeepalivetime: u32) -> windows_core::Result;
+ fn GetKeepAlive(&self) -> windows_core::Result;
+}
+impl IOPCEventSubscriptionMgt2_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn SetKeepAlive<
+ Identity: IOPCEventSubscriptionMgt2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwkeepalivetime: u32,
+ pdwrevisedkeepalivetime: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventSubscriptionMgt2_Impl::SetKeepAlive(
+ this,
+ core::mem::transmute_copy(&dwkeepalivetime),
+ ) {
+ Ok(ok__) => {
+ pdwrevisedkeepalivetime.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn GetKeepAlive<
+ Identity: IOPCEventSubscriptionMgt2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pdwkeepalivetime: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEventSubscriptionMgt2_Impl::GetKeepAlive(this) {
+ Ok(ok__) => {
+ pdwkeepalivetime.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: IOPCEventSubscriptionMgt_Vtbl::new::(),
+ SetKeepAlive: SetKeepAlive::,
+ GetKeepAlive: GetKeepAlive::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ || iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEventSubscriptionMgt2 {}
+pub const OPCAE_BROWSE_DOWN: __MIDL___MIDL_itf_opc_ae_0000_0001_0001 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0001(2i32);
+pub const OPCAE_BROWSE_TO: __MIDL___MIDL_itf_opc_ae_0000_0001_0001 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0001(3i32);
+pub const OPCAE_BROWSE_UP: __MIDL___MIDL_itf_opc_ae_0000_0001_0001 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0001(1i32);
+pub const OPCAE_STATUS_COMM_FAULT: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(6i32);
+pub const OPCAE_STATUS_FAILED: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(2i32);
+pub const OPCAE_STATUS_NOCONFIG: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(3i32);
+pub const OPCAE_STATUS_RUNNING: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(1i32);
+pub const OPCAE_STATUS_SUSPENDED: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(4i32);
+pub const OPCAE_STATUS_TEST: __MIDL___MIDL_itf_opc_ae_0000_0001_0003 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0003(5i32);
+windows_core::imp::define_interface!(
+ OPCEventServerCATID,
+ OPCEventServerCATID_Vtbl,
+ 0x58e13251_ac87_11d1_84d5_00608cb8a7e9
+);
+windows_core::imp::interface_hierarchy!(OPCEventServerCATID, windows_core::IUnknown);
+#[repr(C)]
+#[doc(hidden)]
+pub struct OPCEventServerCATID_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+}
+pub trait OPCEventServerCATID_Impl: windows_core::IUnknownImpl {}
+impl OPCEventServerCATID_Vtbl {
+ pub const fn new() -> Self {
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for OPCEventServerCATID {}
+pub const OPC_ALL_EVENTS: u32 = 7u32;
+pub const OPC_AREA: __MIDL___MIDL_itf_opc_ae_0000_0001_0002 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0002(1i32);
+pub const OPC_CATEGORY_DESCRIPTION_AE10: windows_core::PCWSTR =
+ windows_core::w!("OPC Alarm & Event Server Version 1.0");
+pub const OPC_CHANGE_ACK_STATE: u32 = 2u32;
+pub const OPC_CHANGE_ACTIVE_STATE: u32 = 1u32;
+pub const OPC_CHANGE_ATTRIBUTE: u32 = 128u32;
+pub const OPC_CHANGE_ENABLE_STATE: u32 = 4u32;
+pub const OPC_CHANGE_MESSAGE: u32 = 64u32;
+pub const OPC_CHANGE_QUALITY: u32 = 8u32;
+pub const OPC_CHANGE_SEVERITY: u32 = 16u32;
+pub const OPC_CHANGE_SUBCONDITION: u32 = 32u32;
+pub const OPC_CONDITION_ACKED: u32 = 4u32;
+pub const OPC_CONDITION_ACTIVE: u32 = 2u32;
+pub const OPC_CONDITION_ENABLED: u32 = 1u32;
+pub const OPC_CONDITION_EVENT: u32 = 4u32;
+pub const OPC_FILTER_BY_AREA: u32 = 8u32;
+pub const OPC_FILTER_BY_CATEGORY: u32 = 2u32;
+pub const OPC_FILTER_BY_EVENT: u32 = 1u32;
+pub const OPC_FILTER_BY_SEVERITY: u32 = 4u32;
+pub const OPC_FILTER_BY_SOURCE: u32 = 16u32;
+pub const OPC_SIMPLE_EVENT: u32 = 1u32;
+pub const OPC_SOURCE: __MIDL___MIDL_itf_opc_ae_0000_0001_0002 =
+ __MIDL___MIDL_itf_opc_ae_0000_0001_0002(2i32);
+pub const OPC_TRACKING_EVENT: u32 = 2u32;
+#[repr(transparent)]
+#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0001(pub i32);
+#[repr(transparent)]
+#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0002(pub i32);
+#[repr(transparent)]
+#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0003(pub i32);
+#[repr(C)]
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0004 {
+ pub wChangeMask: u16,
+ pub wNewState: u16,
+ pub szSource: windows_core::PWSTR,
+ pub ftTime: windows::Win32::Foundation::FILETIME,
+ pub szMessage: windows_core::PWSTR,
+ pub dwEventType: u32,
+ pub dwEventCategory: u32,
+ pub dwSeverity: u32,
+ pub szConditionName: windows_core::PWSTR,
+ pub szSubconditionName: windows_core::PWSTR,
+ pub wQuality: u16,
+ pub wReserved: u16,
+ pub bAckRequired: windows_core::BOOL,
+ pub ftActiveTime: windows::Win32::Foundation::FILETIME,
+ pub dwCookie: u32,
+ pub dwNumEventAttrs: u32,
+ pub pEventAttributes: *mut windows::Win32::System::Variant::VARIANT,
+ pub szActorID: windows_core::PWSTR,
+}
+impl Default for __MIDL___MIDL_itf_opc_ae_0000_0001_0004 {
+ fn default() -> Self {
+ unsafe { core::mem::zeroed() }
+ }
+}
+#[repr(C)]
+#[derive(Clone, Copy, Debug, Default, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0005 {
+ pub ftStartTime: windows::Win32::Foundation::FILETIME,
+ pub ftCurrentTime: windows::Win32::Foundation::FILETIME,
+ pub ftLastUpdateTime: windows::Win32::Foundation::FILETIME,
+ pub dwServerState: __MIDL___MIDL_itf_opc_ae_0000_0001_0003,
+ pub wMajorVersion: u16,
+ pub wMinorVersion: u16,
+ pub wBuildNumber: u16,
+ pub wReserved: u16,
+ pub szVendorInfo: windows_core::PWSTR,
+}
+#[repr(C)]
+#[derive(Clone, Copy, Debug, PartialEq)]
+pub struct __MIDL___MIDL_itf_opc_ae_0000_0001_0006 {
+ pub wState: u16,
+ pub wReserved1: u16,
+ pub szActiveSubCondition: windows_core::PWSTR,
+ pub szASCDefinition: windows_core::PWSTR,
+ pub dwASCSeverity: u32,
+ pub szASCDescription: windows_core::PWSTR,
+ pub wQuality: u16,
+ pub wReserved2: u16,
+ pub ftLastAckTime: windows::Win32::Foundation::FILETIME,
+ pub ftSubCondLastActive: windows::Win32::Foundation::FILETIME,
+ pub ftCondLastActive: windows::Win32::Foundation::FILETIME,
+ pub ftCondLastInactive: windows::Win32::Foundation::FILETIME,
+ pub szAcknowledgerID: windows_core::PWSTR,
+ pub szComment: windows_core::PWSTR,
+ pub dwNumSCs: u32,
+ pub pszSCNames: *mut windows_core::PWSTR,
+ pub pszSCDefinitions: *mut windows_core::PWSTR,
+ pub pdwSCSeverities: *mut u32,
+ pub pszSCDescriptions: *mut windows_core::PWSTR,
+ pub dwNumEventAttrs: u32,
+ pub pEventAttributes: *mut windows::Win32::System::Variant::VARIANT,
+ pub pErrors: *mut windows_core::HRESULT,
+}
+impl Default for __MIDL___MIDL_itf_opc_ae_0000_0001_0006 {
+ fn default() -> Self {
+ unsafe { core::mem::zeroed() }
+ }
+}
diff --git a/opc_ae_bindings/src/lib.rs b/opc_ae_bindings/src/lib.rs
new file mode 100644
index 0000000..892ac88
--- /dev/null
+++ b/opc_ae_bindings/src/lib.rs
@@ -0,0 +1,3 @@
+mod bindings;
+
+pub use bindings::*;
diff --git a/opc_comn_bindings/.gitignore b/opc_comn_bindings/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/opc_comn_bindings/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/opc_comn_bindings/.metadata/.gitignore b/opc_comn_bindings/.metadata/.gitignore
new file mode 100644
index 0000000..1746e32
--- /dev/null
+++ b/opc_comn_bindings/.metadata/.gitignore
@@ -0,0 +1,2 @@
+bin
+obj
diff --git a/opc_comn_bindings/.metadata/generate.proj b/opc_comn_bindings/.metadata/generate.proj
new file mode 100644
index 0000000..bce230e
--- /dev/null
+++ b/opc_comn_bindings/.metadata/generate.proj
@@ -0,0 +1,17 @@
+
+
+
+ ../.windows/winmd/OPCCOMN.winmd
+ 0.0.0.1
+ $(CompiledHeadersDir)
+
+
+
+
+
+ @(Headers)
+ OPCCOMN
+ true
+
+
+
\ No newline at end of file
diff --git a/opc_comn_bindings/.metadata/main.cpp b/opc_comn_bindings/.metadata/main.cpp
new file mode 100644
index 0000000..aae7e26
--- /dev/null
+++ b/opc_comn_bindings/.metadata/main.cpp
@@ -0,0 +1,3 @@
+#include
+
+#include "opccomn.h"
diff --git a/opc_da_bindings/.metadata/OPCComn.idl b/opc_comn_bindings/.metadata/opccomn.idl
similarity index 100%
rename from opc_da_bindings/.metadata/OPCComn.idl
rename to opc_comn_bindings/.metadata/opccomn.idl
diff --git a/opc_comn_bindings/.windows/winmd/OPCCOMN.winmd b/opc_comn_bindings/.windows/winmd/OPCCOMN.winmd
new file mode 100644
index 0000000..09c52e1
Binary files /dev/null and b/opc_comn_bindings/.windows/winmd/OPCCOMN.winmd differ
diff --git a/opc_comn_bindings/Cargo.toml b/opc_comn_bindings/Cargo.toml
new file mode 100644
index 0000000..966673e
--- /dev/null
+++ b/opc_comn_bindings/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "opc_comn_bindings"
+version = "0.3.0"
+edition = "2024"
+description = "OPC Common bindings"
+readme = "README.md"
+repository = "https://github.com/Ronbb/rust_opc"
+license = "MIT"
+keywords = ["bindings", "comn", "opc", "opccomn"]
+exclude = [".metadata/*", ".windows/*", "build.rs"]
+
+[package.metadata.docs.rs]
+default-target = "x86_64-pc-windows-msvc"
+targets = []
+
+[dependencies]
+windows = { workspace = true }
+windows-core = { workspace = true }
+windows-targets = { workspace = true }
+
+[build-dependencies]
+windows-bindgen = { workspace = true }
diff --git a/opc_comn_bindings/README.md b/opc_comn_bindings/README.md
new file mode 100644
index 0000000..d4e23a4
--- /dev/null
+++ b/opc_comn_bindings/README.md
@@ -0,0 +1,18 @@
+# OPC Common Bindings
+
+Please see docs on [docs.rs](https://docs.rs/opc_comn_bindings/).
+
+## Example
+
+```rust
+// TODO
+```
+
+## Rebuild metadata
+
+Open **Developer Powershell for VS2022**.
+
+```batch
+cd .metadata
+dotnet build
+```
diff --git a/opc_comn_bindings/build.rs b/opc_comn_bindings/build.rs
new file mode 100644
index 0000000..2c9cbd4
--- /dev/null
+++ b/opc_comn_bindings/build.rs
@@ -0,0 +1,19 @@
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ println!("cargo:rerun-if-changed=.windows/winmd/OPCCOMN.winmd");
+
+ windows_bindgen::bindgen([
+ "--in",
+ ".windows/winmd/OPCCOMN.winmd",
+ "default",
+ "--out",
+ "src/bindings.rs",
+ "--reference",
+ "windows,skip-root,Windows",
+ "--filter",
+ "OPCCOMN",
+ "--flat",
+ "--implement",
+ ])
+ .unwrap();
+}
diff --git a/opc_comn_bindings/src/bindings.rs b/opc_comn_bindings/src/bindings.rs
new file mode 100644
index 0000000..30d4c77
--- /dev/null
+++ b/opc_comn_bindings/src/bindings.rs
@@ -0,0 +1,781 @@
+// Bindings generated by `windows-bindgen` 0.62.1
+
+#![allow(
+ non_snake_case,
+ non_upper_case_globals,
+ non_camel_case_types,
+ dead_code,
+ clippy::all
+)]
+
+windows_core::imp::define_interface!(
+ IOPCCommon,
+ IOPCCommon_Vtbl,
+ 0xf31dfde2_07b6_11d2_b2d8_0060083ba1fb
+);
+windows_core::imp::interface_hierarchy!(IOPCCommon, windows_core::IUnknown);
+impl IOPCCommon {
+ pub unsafe fn SetLocaleID(&self, dwlcid: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).SetLocaleID)(
+ windows_core::Interface::as_raw(self),
+ dwlcid,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetLocaleID(&self) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetLocaleID)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn QueryAvailableLocaleIDs(
+ &self,
+ pdwcount: *mut u32,
+ pdwlcid: *mut *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).QueryAvailableLocaleIDs)(
+ windows_core::Interface::as_raw(self),
+ pdwcount as _,
+ pdwlcid as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn GetErrorString(
+ &self,
+ dwerror: windows_core::HRESULT,
+ ) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).GetErrorString)(
+ windows_core::Interface::as_raw(self),
+ dwerror,
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn SetClientName(&self, szname: P0) -> windows_core::Result<()>
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).SetClientName)(
+ windows_core::Interface::as_raw(self),
+ szname.param().abi(),
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCCommon_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub SetLocaleID:
+ unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+ pub GetLocaleID:
+ unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
+ pub QueryAvailableLocaleIDs: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut u32,
+ *mut *mut u32,
+ ) -> windows_core::HRESULT,
+ pub GetErrorString: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::HRESULT,
+ *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub SetClientName: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCCommon_Impl: windows_core::IUnknownImpl {
+ fn SetLocaleID(&self, dwlcid: u32) -> windows_core::Result<()>;
+ fn GetLocaleID(&self) -> windows_core::Result;
+ fn QueryAvailableLocaleIDs(
+ &self,
+ pdwcount: *mut u32,
+ pdwlcid: *mut *mut u32,
+ ) -> windows_core::Result<()>;
+ fn GetErrorString(
+ &self,
+ dwerror: windows_core::HRESULT,
+ ) -> windows_core::Result;
+ fn SetClientName(&self, szname: &windows_core::PCWSTR) -> windows_core::Result<()>;
+}
+impl IOPCCommon_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn SetLocaleID(
+ this: *mut core::ffi::c_void,
+ dwlcid: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCCommon_Impl::SetLocaleID(this, core::mem::transmute_copy(&dwlcid)).into()
+ }
+ }
+ unsafe extern "system" fn GetLocaleID(
+ this: *mut core::ffi::c_void,
+ pdwlcid: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCCommon_Impl::GetLocaleID(this) {
+ Ok(ok__) => {
+ pdwlcid.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn QueryAvailableLocaleIDs<
+ Identity: IOPCCommon_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pdwcount: *mut u32,
+ pdwlcid: *mut *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCCommon_Impl::QueryAvailableLocaleIDs(
+ this,
+ core::mem::transmute_copy(&pdwcount),
+ core::mem::transmute_copy(&pdwlcid),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn GetErrorString(
+ this: *mut core::ffi::c_void,
+ dwerror: windows_core::HRESULT,
+ ppstring: *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCCommon_Impl::GetErrorString(this, core::mem::transmute_copy(&dwerror)) {
+ Ok(ok__) => {
+ ppstring.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn SetClientName(
+ this: *mut core::ffi::c_void,
+ szname: windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCCommon_Impl::SetClientName(this, core::mem::transmute(&szname)).into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ SetLocaleID: SetLocaleID::,
+ GetLocaleID: GetLocaleID::,
+ QueryAvailableLocaleIDs: QueryAvailableLocaleIDs::,
+ GetErrorString: GetErrorString::,
+ SetClientName: SetClientName::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCCommon {}
+windows_core::imp::define_interface!(
+ IOPCEnumGUID,
+ IOPCEnumGUID_Vtbl,
+ 0x55c382c8_21c7_4e88_96c1_becfb1e3f483
+);
+windows_core::imp::interface_hierarchy!(IOPCEnumGUID, windows_core::IUnknown);
+impl IOPCEnumGUID {
+ pub unsafe fn Next(
+ &self,
+ rgelt: &mut [windows_core::GUID],
+ pceltfetched: *mut u32,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Next)(
+ windows_core::Interface::as_raw(self),
+ rgelt.len().try_into().unwrap(),
+ core::mem::transmute(rgelt.as_ptr()),
+ pceltfetched as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Skip(&self, celt: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Skip)(
+ windows_core::Interface::as_raw(self),
+ celt,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Reset(&self) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Reset)(windows_core::Interface::as_raw(self))
+ .ok()
+ }
+ }
+ pub unsafe fn Clone(&self) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).Clone)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .and_then(|| windows_core::Type::from_abi(result__))
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCEnumGUID_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub Next: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut windows_core::GUID,
+ *mut u32,
+ ) -> windows_core::HRESULT,
+ pub Skip: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+ pub Reset: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT,
+ pub Clone: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCEnumGUID_Impl: windows_core::IUnknownImpl {
+ fn Next(
+ &self,
+ celt: u32,
+ rgelt: *mut windows_core::GUID,
+ pceltfetched: *mut u32,
+ ) -> windows_core::Result<()>;
+ fn Skip(&self, celt: u32) -> windows_core::Result<()>;
+ fn Reset(&self) -> windows_core::Result<()>;
+ fn Clone(&self) -> windows_core::Result;
+}
+impl IOPCEnumGUID_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn Next(
+ this: *mut core::ffi::c_void,
+ celt: u32,
+ rgelt: *mut windows_core::GUID,
+ pceltfetched: *mut u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEnumGUID_Impl::Next(
+ this,
+ core::mem::transmute_copy(&celt),
+ core::mem::transmute_copy(&rgelt),
+ core::mem::transmute_copy(&pceltfetched),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn Skip(
+ this: *mut core::ffi::c_void,
+ celt: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEnumGUID_Impl::Skip(this, core::mem::transmute_copy(&celt)).into()
+ }
+ }
+ unsafe extern "system" fn Reset(
+ this: *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCEnumGUID_Impl::Reset(this).into()
+ }
+ }
+ unsafe extern "system" fn Clone(
+ this: *mut core::ffi::c_void,
+ ppenum: *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCEnumGUID_Impl::Clone(this) {
+ Ok(ok__) => {
+ ppenum.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ Next: Next::,
+ Skip: Skip::,
+ Reset: Reset::,
+ Clone: Clone::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCEnumGUID {}
+windows_core::imp::define_interface!(
+ IOPCServerList,
+ IOPCServerList_Vtbl,
+ 0x13486d50_4821_11d2_a494_3cb306c10000
+);
+windows_core::imp::interface_hierarchy!(IOPCServerList, windows_core::IUnknown);
+impl IOPCServerList {
+ pub unsafe fn EnumClassesOfCategories(
+ &self,
+ rgcatidimpl: &[windows_core::GUID],
+ rgcatidreq: &[windows_core::GUID],
+ ) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).EnumClassesOfCategories)(
+ windows_core::Interface::as_raw(self),
+ rgcatidimpl.len().try_into().unwrap(),
+ core::mem::transmute(rgcatidimpl.as_ptr()),
+ rgcatidreq.len().try_into().unwrap(),
+ core::mem::transmute(rgcatidreq.as_ptr()),
+ &mut result__,
+ )
+ .and_then(|| windows_core::Type::from_abi(result__))
+ }
+ }
+ pub unsafe fn GetClassDetails(
+ &self,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetClassDetails)(
+ windows_core::Interface::as_raw(self),
+ clsid,
+ ppszprogid as _,
+ ppszusertype as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn CLSIDFromProgID(
+ &self,
+ szprogid: P0,
+ ) -> windows_core::Result
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).CLSIDFromProgID)(
+ windows_core::Interface::as_raw(self),
+ szprogid.param().abi(),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCServerList_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub EnumClassesOfCategories: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::GUID,
+ u32,
+ *const windows_core::GUID,
+ *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT,
+ pub GetClassDetails: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *const windows_core::GUID,
+ *mut windows_core::PWSTR,
+ *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub CLSIDFromProgID: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut windows_core::GUID,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCServerList_Impl: windows_core::IUnknownImpl {
+ fn EnumClassesOfCategories(
+ &self,
+ cimplemented: u32,
+ rgcatidimpl: *const windows_core::GUID,
+ crequired: u32,
+ rgcatidreq: *const windows_core::GUID,
+ ) -> windows_core::Result;
+ fn GetClassDetails(
+ &self,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn CLSIDFromProgID(
+ &self,
+ szprogid: &windows_core::PCWSTR,
+ ) -> windows_core::Result;
+}
+impl IOPCServerList_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn EnumClassesOfCategories<
+ Identity: IOPCServerList_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ cimplemented: u32,
+ rgcatidimpl: *const windows_core::GUID,
+ crequired: u32,
+ rgcatidreq: *const windows_core::GUID,
+ ppenumclsid: *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCServerList_Impl::EnumClassesOfCategories(
+ this,
+ core::mem::transmute_copy(&cimplemented),
+ core::mem::transmute_copy(&rgcatidimpl),
+ core::mem::transmute_copy(&crequired),
+ core::mem::transmute_copy(&rgcatidreq),
+ ) {
+ Ok(ok__) => {
+ ppenumclsid.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn GetClassDetails<
+ Identity: IOPCServerList_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCServerList_Impl::GetClassDetails(
+ this,
+ core::mem::transmute_copy(&clsid),
+ core::mem::transmute_copy(&ppszprogid),
+ core::mem::transmute_copy(&ppszusertype),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn CLSIDFromProgID<
+ Identity: IOPCServerList_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szprogid: windows_core::PCWSTR,
+ clsid: *mut windows_core::GUID,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCServerList_Impl::CLSIDFromProgID(this, core::mem::transmute(&szprogid)) {
+ Ok(ok__) => {
+ clsid.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ EnumClassesOfCategories: EnumClassesOfCategories::,
+ GetClassDetails: GetClassDetails::,
+ CLSIDFromProgID: CLSIDFromProgID::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCServerList {}
+windows_core::imp::define_interface!(
+ IOPCServerList2,
+ IOPCServerList2_Vtbl,
+ 0x9dd0b56c_ad9e_43ee_8305_487f3188bf7a
+);
+windows_core::imp::interface_hierarchy!(IOPCServerList2, windows_core::IUnknown);
+impl IOPCServerList2 {
+ pub unsafe fn EnumClassesOfCategories(
+ &self,
+ rgcatidimpl: &[windows_core::GUID],
+ rgcatidreq: &[windows_core::GUID],
+ ) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).EnumClassesOfCategories)(
+ windows_core::Interface::as_raw(self),
+ rgcatidimpl.len().try_into().unwrap(),
+ core::mem::transmute(rgcatidimpl.as_ptr()),
+ rgcatidreq.len().try_into().unwrap(),
+ core::mem::transmute(rgcatidreq.as_ptr()),
+ &mut result__,
+ )
+ .and_then(|| windows_core::Type::from_abi(result__))
+ }
+ }
+ pub unsafe fn GetClassDetails(
+ &self,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ppszverindprogid: *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).GetClassDetails)(
+ windows_core::Interface::as_raw(self),
+ clsid,
+ ppszprogid as _,
+ ppszusertype as _,
+ ppszverindprogid as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn CLSIDFromProgID(
+ &self,
+ szprogid: P0,
+ ) -> windows_core::Result
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).CLSIDFromProgID)(
+ windows_core::Interface::as_raw(self),
+ szprogid.param().abi(),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCServerList2_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub EnumClassesOfCategories: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *const windows_core::GUID,
+ u32,
+ *const windows_core::GUID,
+ *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT,
+ pub GetClassDetails: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *const windows_core::GUID,
+ *mut windows_core::PWSTR,
+ *mut windows_core::PWSTR,
+ *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT,
+ pub CLSIDFromProgID: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ *mut windows_core::GUID,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCServerList2_Impl: windows_core::IUnknownImpl {
+ fn EnumClassesOfCategories(
+ &self,
+ cimplemented: u32,
+ rgcatidimpl: *const windows_core::GUID,
+ crequired: u32,
+ rgcatidreq: *const windows_core::GUID,
+ ) -> windows_core::Result;
+ fn GetClassDetails(
+ &self,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ppszverindprogid: *mut windows_core::PWSTR,
+ ) -> windows_core::Result<()>;
+ fn CLSIDFromProgID(
+ &self,
+ szprogid: &windows_core::PCWSTR,
+ ) -> windows_core::Result;
+}
+impl IOPCServerList2_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn EnumClassesOfCategories<
+ Identity: IOPCServerList2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ cimplemented: u32,
+ rgcatidimpl: *const windows_core::GUID,
+ crequired: u32,
+ rgcatidreq: *const windows_core::GUID,
+ ppenumclsid: *mut *mut core::ffi::c_void,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCServerList2_Impl::EnumClassesOfCategories(
+ this,
+ core::mem::transmute_copy(&cimplemented),
+ core::mem::transmute_copy(&rgcatidimpl),
+ core::mem::transmute_copy(&crequired),
+ core::mem::transmute_copy(&rgcatidreq),
+ ) {
+ Ok(ok__) => {
+ ppenumclsid.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn GetClassDetails<
+ Identity: IOPCServerList2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ clsid: *const windows_core::GUID,
+ ppszprogid: *mut windows_core::PWSTR,
+ ppszusertype: *mut windows_core::PWSTR,
+ ppszverindprogid: *mut windows_core::PWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCServerList2_Impl::GetClassDetails(
+ this,
+ core::mem::transmute_copy(&clsid),
+ core::mem::transmute_copy(&ppszprogid),
+ core::mem::transmute_copy(&ppszusertype),
+ core::mem::transmute_copy(&ppszverindprogid),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn CLSIDFromProgID<
+ Identity: IOPCServerList2_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szprogid: windows_core::PCWSTR,
+ clsid: *mut windows_core::GUID,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCServerList2_Impl::CLSIDFromProgID(this, core::mem::transmute(&szprogid)) {
+ Ok(ok__) => {
+ clsid.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ EnumClassesOfCategories: EnumClassesOfCategories::,
+ GetClassDetails: GetClassDetails::,
+ CLSIDFromProgID: CLSIDFromProgID::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCServerList2 {}
+windows_core::imp::define_interface!(
+ IOPCShutdown,
+ IOPCShutdown_Vtbl,
+ 0xf31dfde1_07b6_11d2_b2d8_0060083ba1fb
+);
+windows_core::imp::interface_hierarchy!(IOPCShutdown, windows_core::IUnknown);
+impl IOPCShutdown {
+ pub unsafe fn ShutdownRequest(&self, szreason: P0) -> windows_core::Result<()>
+ where
+ P0: windows_core::Param,
+ {
+ unsafe {
+ (windows_core::Interface::vtable(self).ShutdownRequest)(
+ windows_core::Interface::as_raw(self),
+ szreason.param().abi(),
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCShutdown_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub ShutdownRequest: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ windows_core::PCWSTR,
+ ) -> windows_core::HRESULT,
+}
+pub trait IOPCShutdown_Impl: windows_core::IUnknownImpl {
+ fn ShutdownRequest(&self, szreason: &windows_core::PCWSTR) -> windows_core::Result<()>;
+}
+impl IOPCShutdown_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn ShutdownRequest<
+ Identity: IOPCShutdown_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ szreason: windows_core::PCWSTR,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCShutdown_Impl::ShutdownRequest(this, core::mem::transmute(&szreason)).into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ ShutdownRequest: ShutdownRequest::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCShutdown {}
diff --git a/opc_comn_bindings/src/lib.rs b/opc_comn_bindings/src/lib.rs
new file mode 100644
index 0000000..892ac88
--- /dev/null
+++ b/opc_comn_bindings/src/lib.rs
@@ -0,0 +1,3 @@
+mod bindings;
+
+pub use bindings::*;
diff --git a/opc_da/Cargo.toml b/opc_da/Cargo.toml
index 3a6a168..e32de6a 100644
--- a/opc_da/Cargo.toml
+++ b/opc_da/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "opc_da"
-version = "0.3.0"
+version = "0.3.1"
edition = "2024"
description = "OPC Data Access"
repository = "https://github.com/Ronbb/rust_opc"
@@ -14,7 +14,8 @@ targets = []
[dependencies]
actix = "0.13.5"
globset = "0.4.16"
-opc_da_bindings = { version = "0.3.0", path = "../opc_da_bindings" }
+opc_comn_bindings = { version = "0.3.0", path = "../opc_comn_bindings" }
+opc_da_bindings = { version = "0.3.1", path = "../opc_da_bindings" }
tokio = { version = "1.46.1", features = ["full", "rt-multi-thread"] }
windows = { version = "0.61.3", features = [
"Win32_Foundation",
diff --git a/opc_da/src/client/traits/client.rs b/opc_da/src/client/traits/client.rs
index 10936fe..ec7495f 100644
--- a/opc_da/src/client/traits/client.rs
+++ b/opc_da/src/client/traits/client.rs
@@ -21,7 +21,7 @@ pub trait ClientTrait for Client {
/// - `IOPCBrowseServerAddressSpace` for browsing the address space
pub struct Server {
pub(crate) server: opc_da_bindings::IOPCServer,
- pub(crate) common: opc_da_bindings::IOPCCommon,
+ pub(crate) common: opc_comn_bindings::IOPCCommon,
pub(crate) connection_point_container: windows::Win32::System::Com::IConnectionPointContainer,
pub(crate) item_properties: opc_da_bindings::IOPCItemProperties,
pub(crate) server_public_groups: Option,
@@ -62,7 +62,7 @@ impl ServerTrait for Server {
}
impl CommonTrait for Server {
- fn interface(&self) -> windows::core::Result<&opc_da_bindings::IOPCCommon> {
+ fn interface(&self) -> windows::core::Result<&opc_comn_bindings::IOPCCommon> {
Ok(&self.common)
}
}
diff --git a/opc_da/src/client/v3/mod.rs b/opc_da/src/client/v3/mod.rs
index ccae580..fa485a5 100644
--- a/opc_da/src/client/v3/mod.rs
+++ b/opc_da/src/client/v3/mod.rs
@@ -6,12 +6,12 @@
use windows::core::Interface as _;
use super::{
+ ClientTrait,
traits::{
AsyncIo2Trait, AsyncIo3Trait, BrowseTrait, CommonTrait, ConnectionPointContainerTrait,
GroupStateMgt2Trait, GroupStateMgtTrait, ItemDeadbandMgtTrait, ItemIoTrait, ItemMgtTrait,
ItemSamplingMgtTrait, ServerTrait, SyncIo2Trait, SyncIoTrait,
},
- ClientTrait,
};
/// Client for OPC DA 3.0 servers.
@@ -31,7 +31,7 @@ impl ClientTrait for Client {
/// - `IOPCItemIO` for direct item read/write operations
pub struct Server {
pub(crate) server: opc_da_bindings::IOPCServer,
- pub(crate) common: opc_da_bindings::IOPCCommon,
+ pub(crate) common: opc_comn_bindings::IOPCCommon,
pub(crate) connection_point_container: windows::Win32::System::Com::IConnectionPointContainer,
pub(crate) browse: opc_da_bindings::IOPCBrowse,
pub(crate) item_io: opc_da_bindings::IOPCItemIO,
@@ -58,7 +58,7 @@ impl ServerTrait for Server {
}
impl CommonTrait for Server {
- fn interface(&self) -> windows::core::Result<&opc_da_bindings::IOPCCommon> {
+ fn interface(&self) -> windows::core::Result<&opc_comn_bindings::IOPCCommon> {
Ok(&self.common)
}
}
diff --git a/opc_da/src/server/com/server.rs b/opc_da/src/server/com/server.rs
index 1e404ae..6cf251a 100644
--- a/opc_da/src/server/com/server.rs
+++ b/opc_da/src/server/com/server.rs
@@ -14,7 +14,7 @@ use super::{
#[windows::core::implement(
// implicit implement IUnknown
opc_da_bindings::IOPCServer,
- opc_da_bindings::IOPCCommon,
+ opc_comn_bindings::IOPCCommon,
windows::Win32::System::Com::IConnectionPointContainer,
opc_da_bindings::IOPCItemProperties,
opc_da_bindings::IOPCBrowse,
@@ -122,7 +122,7 @@ impl opc_da_bindings::IOPCServer_Impl for Server_Impl<
// 1.0 N/A
// 2.0 required
// 3.0 required
-impl opc_da_bindings::IOPCCommon_Impl for Server_Impl {
+impl opc_comn_bindings::IOPCCommon_Impl for Server_Impl {
fn SetLocaleID(&self, locale_id: u32) -> windows::core::Result<()> {
self.set_locale_id(locale_id)
}
diff --git a/opc_da_bindings/.metadata/generate.proj b/opc_da_bindings/.metadata/generate.proj
index c0be630..a65f77e 100644
--- a/opc_da_bindings/.metadata/generate.proj
+++ b/opc_da_bindings/.metadata/generate.proj
@@ -6,8 +6,8 @@
$(CompiledHeadersDir)
-
-
+
+
@(Headers)
OPCDA
diff --git a/opc_da_bindings/.metadata/main.cpp b/opc_da_bindings/.metadata/main.cpp
index 3b3be26..a78c1e4 100644
--- a/opc_da_bindings/.metadata/main.cpp
+++ b/opc_da_bindings/.metadata/main.cpp
@@ -1,4 +1,3 @@
#include
-#include "opccomn.h"
#include "opcda.h"
diff --git a/opc_da_bindings/.windows/winmd/OPCDA.winmd b/opc_da_bindings/.windows/winmd/OPCDA.winmd
index 9e9554f..8801ed3 100644
Binary files a/opc_da_bindings/.windows/winmd/OPCDA.winmd and b/opc_da_bindings/.windows/winmd/OPCDA.winmd differ
diff --git a/opc_da_bindings/Cargo.toml b/opc_da_bindings/Cargo.toml
index 0f093d4..9859ed7 100644
--- a/opc_da_bindings/Cargo.toml
+++ b/opc_da_bindings/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "opc_da_bindings"
-version = "0.3.0"
+version = "0.3.1"
edition = "2024"
description = "OPC Data Access bindings"
readme = "README.md"
@@ -14,17 +14,9 @@ default-target = "x86_64-pc-windows-msvc"
targets = []
[dependencies]
-windows = { version = "0.61.3", features = [
- "Win32_Foundation",
- "Win32_System_Com",
- "Win32_System_Ole",
- "Win32_System_Variant",
-] }
-windows-core = "0.61.2"
-windows-targets = "0.53.2"
+windows = { workspace = true }
+windows-core = { workspace = true }
+windows-targets = { workspace = true }
[build-dependencies]
-windows-bindgen = "0.62.1"
-
-[profile.dev.build-override]
-debug = true
+windows-bindgen = { workspace = true }
diff --git a/opc_da_bindings/README.md b/opc_da_bindings/README.md
index 5058913..ee7c298 100644
--- a/opc_da_bindings/README.md
+++ b/opc_da_bindings/README.md
@@ -1,4 +1,4 @@
-# OPC DA Bindings
+# OPC Data Access (DA) Bindings
Please see docs on [docs.rs](https://docs.rs/opc_da_bindings/).
@@ -7,8 +7,9 @@ Please see docs on [docs.rs](https://docs.rs/opc_da_bindings/).
### Enumerate server list
```rust
-use opc_da_bindings::{
- CATID_OPCDAServer10, CATID_OPCDAServer20, CATID_OPCDAServer30, IOPCServerList,
+use opc_common_bindings::IOPCServerList;
+use opc_da_bindings::{C
+ ATID_OPCDAServer10, CATID_OPCDAServer20, CATID_OPCDAServer30,
};
use windows::Win32::System::Com::{
CLSIDFromProgID, CoCreateInstance, CoInitializeEx, ProgIDFromCLSID, CLSCTX_ALL,
diff --git a/opc_da_bindings/src/bindings.rs b/opc_da_bindings/src/bindings.rs
index 8f234ea..3f8fa5e 100644
--- a/opc_da_bindings/src/bindings.rs
+++ b/opc_da_bindings/src/bindings.rs
@@ -1449,198 +1449,6 @@ impl IOPCBrowseServerAddressSpace_Vtbl {
}
}
impl windows_core::RuntimeName for IOPCBrowseServerAddressSpace {}
-windows_core::imp::define_interface!(
- IOPCCommon,
- IOPCCommon_Vtbl,
- 0xf31dfde2_07b6_11d2_b2d8_0060083ba1fb
-);
-windows_core::imp::interface_hierarchy!(IOPCCommon, windows_core::IUnknown);
-impl IOPCCommon {
- pub unsafe fn SetLocaleID(&self, dwlcid: u32) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).SetLocaleID)(
- windows_core::Interface::as_raw(self),
- dwlcid,
- )
- .ok()
- }
- }
- pub unsafe fn GetLocaleID(&self) -> windows_core::Result {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).GetLocaleID)(
- windows_core::Interface::as_raw(self),
- &mut result__,
- )
- .map(|| result__)
- }
- }
- pub unsafe fn QueryAvailableLocaleIDs(
- &self,
- pdwcount: *mut u32,
- pdwlcid: *mut *mut u32,
- ) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).QueryAvailableLocaleIDs)(
- windows_core::Interface::as_raw(self),
- pdwcount as _,
- pdwlcid as _,
- )
- .ok()
- }
- }
- pub unsafe fn GetErrorString(
- &self,
- dwerror: windows_core::HRESULT,
- ) -> windows_core::Result {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).GetErrorString)(
- windows_core::Interface::as_raw(self),
- dwerror,
- &mut result__,
- )
- .map(|| result__)
- }
- }
- pub unsafe fn SetClientName(&self, szname: P0) -> windows_core::Result<()>
- where
- P0: windows_core::Param,
- {
- unsafe {
- (windows_core::Interface::vtable(self).SetClientName)(
- windows_core::Interface::as_raw(self),
- szname.param().abi(),
- )
- .ok()
- }
- }
-}
-#[repr(C)]
-#[doc(hidden)]
-pub struct IOPCCommon_Vtbl {
- pub base__: windows_core::IUnknown_Vtbl,
- pub SetLocaleID:
- unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
- pub GetLocaleID:
- unsafe extern "system" fn(*mut core::ffi::c_void, *mut u32) -> windows_core::HRESULT,
- pub QueryAvailableLocaleIDs: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- *mut u32,
- *mut *mut u32,
- ) -> windows_core::HRESULT,
- pub GetErrorString: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- windows_core::HRESULT,
- *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT,
- pub SetClientName: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- windows_core::PCWSTR,
- ) -> windows_core::HRESULT,
-}
-pub trait IOPCCommon_Impl: windows_core::IUnknownImpl {
- fn SetLocaleID(&self, dwlcid: u32) -> windows_core::Result<()>;
- fn GetLocaleID(&self) -> windows_core::Result;
- fn QueryAvailableLocaleIDs(
- &self,
- pdwcount: *mut u32,
- pdwlcid: *mut *mut u32,
- ) -> windows_core::Result<()>;
- fn GetErrorString(
- &self,
- dwerror: windows_core::HRESULT,
- ) -> windows_core::Result;
- fn SetClientName(&self, szname: &windows_core::PCWSTR) -> windows_core::Result<()>;
-}
-impl IOPCCommon_Vtbl {
- pub const fn new() -> Self {
- unsafe extern "system" fn SetLocaleID(
- this: *mut core::ffi::c_void,
- dwlcid: u32,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCCommon_Impl::SetLocaleID(this, core::mem::transmute_copy(&dwlcid)).into()
- }
- }
- unsafe extern "system" fn GetLocaleID(
- this: *mut core::ffi::c_void,
- pdwlcid: *mut u32,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCCommon_Impl::GetLocaleID(this) {
- Ok(ok__) => {
- pdwlcid.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- unsafe extern "system" fn QueryAvailableLocaleIDs<
- Identity: IOPCCommon_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- pdwcount: *mut u32,
- pdwlcid: *mut *mut u32,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCCommon_Impl::QueryAvailableLocaleIDs(
- this,
- core::mem::transmute_copy(&pdwcount),
- core::mem::transmute_copy(&pdwlcid),
- )
- .into()
- }
- }
- unsafe extern "system" fn GetErrorString(
- this: *mut core::ffi::c_void,
- dwerror: windows_core::HRESULT,
- ppstring: *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCCommon_Impl::GetErrorString(this, core::mem::transmute_copy(&dwerror)) {
- Ok(ok__) => {
- ppstring.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- unsafe extern "system" fn SetClientName(
- this: *mut core::ffi::c_void,
- szname: windows_core::PCWSTR,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCCommon_Impl::SetClientName(this, core::mem::transmute(&szname)).into()
- }
- }
- Self {
- base__: windows_core::IUnknown_Vtbl::new::(),
- SetLocaleID: SetLocaleID::,
- GetLocaleID: GetLocaleID::,
- QueryAvailableLocaleIDs: QueryAvailableLocaleIDs::,
- GetErrorString: GetErrorString::,
- SetClientName: SetClientName::,
- }
- }
- pub fn matches(iid: &windows_core::GUID) -> bool {
- iid == &::IID
- }
-}
-impl windows_core::RuntimeName for IOPCCommon {}
windows_core::imp::define_interface!(
IOPCDataCallback,
IOPCDataCallback_Vtbl,
@@ -1952,150 +1760,6 @@ impl IOPCDataCallback_Vtbl {
}
}
impl windows_core::RuntimeName for IOPCDataCallback {}
-windows_core::imp::define_interface!(
- IOPCEnumGUID,
- IOPCEnumGUID_Vtbl,
- 0x55c382c8_21c7_4e88_96c1_becfb1e3f483
-);
-windows_core::imp::interface_hierarchy!(IOPCEnumGUID, windows_core::IUnknown);
-impl IOPCEnumGUID {
- pub unsafe fn Next(
- &self,
- rgelt: &mut [windows_core::GUID],
- pceltfetched: *mut u32,
- ) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).Next)(
- windows_core::Interface::as_raw(self),
- rgelt.len().try_into().unwrap(),
- core::mem::transmute(rgelt.as_ptr()),
- pceltfetched as _,
- )
- .ok()
- }
- }
- pub unsafe fn Skip(&self, celt: u32) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).Skip)(
- windows_core::Interface::as_raw(self),
- celt,
- )
- .ok()
- }
- }
- pub unsafe fn Reset(&self) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).Reset)(windows_core::Interface::as_raw(self))
- .ok()
- }
- }
- pub unsafe fn Clone(&self) -> windows_core::Result {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).Clone)(
- windows_core::Interface::as_raw(self),
- &mut result__,
- )
- .and_then(|| windows_core::Type::from_abi(result__))
- }
- }
-}
-#[repr(C)]
-#[doc(hidden)]
-pub struct IOPCEnumGUID_Vtbl {
- pub base__: windows_core::IUnknown_Vtbl,
- pub Next: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- u32,
- *mut windows_core::GUID,
- *mut u32,
- ) -> windows_core::HRESULT,
- pub Skip: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
- pub Reset: unsafe extern "system" fn(*mut core::ffi::c_void) -> windows_core::HRESULT,
- pub Clone: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT,
-}
-pub trait IOPCEnumGUID_Impl: windows_core::IUnknownImpl {
- fn Next(
- &self,
- celt: u32,
- rgelt: *mut windows_core::GUID,
- pceltfetched: *mut u32,
- ) -> windows_core::Result<()>;
- fn Skip(&self, celt: u32) -> windows_core::Result<()>;
- fn Reset(&self) -> windows_core::Result<()>;
- fn Clone(&self) -> windows_core::Result;
-}
-impl IOPCEnumGUID_Vtbl {
- pub const fn new() -> Self {
- unsafe extern "system" fn Next(
- this: *mut core::ffi::c_void,
- celt: u32,
- rgelt: *mut windows_core::GUID,
- pceltfetched: *mut u32,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCEnumGUID_Impl::Next(
- this,
- core::mem::transmute_copy(&celt),
- core::mem::transmute_copy(&rgelt),
- core::mem::transmute_copy(&pceltfetched),
- )
- .into()
- }
- }
- unsafe extern "system" fn Skip(
- this: *mut core::ffi::c_void,
- celt: u32,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCEnumGUID_Impl::Skip(this, core::mem::transmute_copy(&celt)).into()
- }
- }
- unsafe extern "system" fn Reset(
- this: *mut core::ffi::c_void,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCEnumGUID_Impl::Reset(this).into()
- }
- }
- unsafe extern "system" fn Clone(
- this: *mut core::ffi::c_void,
- ppenum: *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCEnumGUID_Impl::Clone(this) {
- Ok(ok__) => {
- ppenum.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- Self {
- base__: windows_core::IUnknown_Vtbl::new::(),
- Next: Next::,
- Skip: Skip::,
- Reset: Reset::,
- Clone: Clone::,
- }
- }
- pub fn matches(iid: &windows_core::GUID) -> bool {
- iid == &::IID
- }
-}
-impl windows_core::RuntimeName for IOPCEnumGUID {}
windows_core::imp::define_interface!(
IOPCGroupStateMgt,
IOPCGroupStateMgt_Vtbl,
@@ -4160,384 +3824,6 @@ impl IOPCServer_Vtbl {
}
}
impl windows_core::RuntimeName for IOPCServer {}
-windows_core::imp::define_interface!(
- IOPCServerList,
- IOPCServerList_Vtbl,
- 0x13486d50_4821_11d2_a494_3cb306c10000
-);
-windows_core::imp::interface_hierarchy!(IOPCServerList, windows_core::IUnknown);
-impl IOPCServerList {
- pub unsafe fn EnumClassesOfCategories(
- &self,
- rgcatidimpl: &[windows_core::GUID],
- rgcatidreq: &[windows_core::GUID],
- ) -> windows_core::Result {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).EnumClassesOfCategories)(
- windows_core::Interface::as_raw(self),
- rgcatidimpl.len().try_into().unwrap(),
- core::mem::transmute(rgcatidimpl.as_ptr()),
- rgcatidreq.len().try_into().unwrap(),
- core::mem::transmute(rgcatidreq.as_ptr()),
- &mut result__,
- )
- .and_then(|| windows_core::Type::from_abi(result__))
- }
- }
- pub unsafe fn GetClassDetails(
- &self,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).GetClassDetails)(
- windows_core::Interface::as_raw(self),
- clsid,
- ppszprogid as _,
- ppszusertype as _,
- )
- .ok()
- }
- }
- pub unsafe fn CLSIDFromProgID(
- &self,
- szprogid: P0,
- ) -> windows_core::Result
- where
- P0: windows_core::Param,
- {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).CLSIDFromProgID)(
- windows_core::Interface::as_raw(self),
- szprogid.param().abi(),
- &mut result__,
- )
- .map(|| result__)
- }
- }
-}
-#[repr(C)]
-#[doc(hidden)]
-pub struct IOPCServerList_Vtbl {
- pub base__: windows_core::IUnknown_Vtbl,
- pub EnumClassesOfCategories: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- u32,
- *const windows_core::GUID,
- u32,
- *const windows_core::GUID,
- *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT,
- pub GetClassDetails: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- *const windows_core::GUID,
- *mut windows_core::PWSTR,
- *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT,
- pub CLSIDFromProgID: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- windows_core::PCWSTR,
- *mut windows_core::GUID,
- ) -> windows_core::HRESULT,
-}
-pub trait IOPCServerList_Impl: windows_core::IUnknownImpl {
- fn EnumClassesOfCategories(
- &self,
- cimplemented: u32,
- rgcatidimpl: *const windows_core::GUID,
- crequired: u32,
- rgcatidreq: *const windows_core::GUID,
- ) -> windows_core::Result;
- fn GetClassDetails(
- &self,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ) -> windows_core::Result<()>;
- fn CLSIDFromProgID(
- &self,
- szprogid: &windows_core::PCWSTR,
- ) -> windows_core::Result;
-}
-impl IOPCServerList_Vtbl {
- pub const fn new() -> Self {
- unsafe extern "system" fn EnumClassesOfCategories<
- Identity: IOPCServerList_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- cimplemented: u32,
- rgcatidimpl: *const windows_core::GUID,
- crequired: u32,
- rgcatidreq: *const windows_core::GUID,
- ppenumclsid: *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCServerList_Impl::EnumClassesOfCategories(
- this,
- core::mem::transmute_copy(&cimplemented),
- core::mem::transmute_copy(&rgcatidimpl),
- core::mem::transmute_copy(&crequired),
- core::mem::transmute_copy(&rgcatidreq),
- ) {
- Ok(ok__) => {
- ppenumclsid.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- unsafe extern "system" fn GetClassDetails<
- Identity: IOPCServerList_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCServerList_Impl::GetClassDetails(
- this,
- core::mem::transmute_copy(&clsid),
- core::mem::transmute_copy(&ppszprogid),
- core::mem::transmute_copy(&ppszusertype),
- )
- .into()
- }
- }
- unsafe extern "system" fn CLSIDFromProgID<
- Identity: IOPCServerList_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- szprogid: windows_core::PCWSTR,
- clsid: *mut windows_core::GUID,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCServerList_Impl::CLSIDFromProgID(this, core::mem::transmute(&szprogid)) {
- Ok(ok__) => {
- clsid.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- Self {
- base__: windows_core::IUnknown_Vtbl::new::(),
- EnumClassesOfCategories: EnumClassesOfCategories::,
- GetClassDetails: GetClassDetails::,
- CLSIDFromProgID: CLSIDFromProgID::,
- }
- }
- pub fn matches(iid: &windows_core::GUID) -> bool {
- iid == &::IID
- }
-}
-impl windows_core::RuntimeName for IOPCServerList {}
-windows_core::imp::define_interface!(
- IOPCServerList2,
- IOPCServerList2_Vtbl,
- 0x9dd0b56c_ad9e_43ee_8305_487f3188bf7a
-);
-windows_core::imp::interface_hierarchy!(IOPCServerList2, windows_core::IUnknown);
-impl IOPCServerList2 {
- pub unsafe fn EnumClassesOfCategories(
- &self,
- rgcatidimpl: &[windows_core::GUID],
- rgcatidreq: &[windows_core::GUID],
- ) -> windows_core::Result {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).EnumClassesOfCategories)(
- windows_core::Interface::as_raw(self),
- rgcatidimpl.len().try_into().unwrap(),
- core::mem::transmute(rgcatidimpl.as_ptr()),
- rgcatidreq.len().try_into().unwrap(),
- core::mem::transmute(rgcatidreq.as_ptr()),
- &mut result__,
- )
- .and_then(|| windows_core::Type::from_abi(result__))
- }
- }
- pub unsafe fn GetClassDetails(
- &self,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ppszverindprogid: *mut windows_core::PWSTR,
- ) -> windows_core::Result<()> {
- unsafe {
- (windows_core::Interface::vtable(self).GetClassDetails)(
- windows_core::Interface::as_raw(self),
- clsid,
- ppszprogid as _,
- ppszusertype as _,
- ppszverindprogid as _,
- )
- .ok()
- }
- }
- pub unsafe fn CLSIDFromProgID(
- &self,
- szprogid: P0,
- ) -> windows_core::Result
- where
- P0: windows_core::Param,
- {
- unsafe {
- let mut result__ = core::mem::zeroed();
- (windows_core::Interface::vtable(self).CLSIDFromProgID)(
- windows_core::Interface::as_raw(self),
- szprogid.param().abi(),
- &mut result__,
- )
- .map(|| result__)
- }
- }
-}
-#[repr(C)]
-#[doc(hidden)]
-pub struct IOPCServerList2_Vtbl {
- pub base__: windows_core::IUnknown_Vtbl,
- pub EnumClassesOfCategories: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- u32,
- *const windows_core::GUID,
- u32,
- *const windows_core::GUID,
- *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT,
- pub GetClassDetails: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- *const windows_core::GUID,
- *mut windows_core::PWSTR,
- *mut windows_core::PWSTR,
- *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT,
- pub CLSIDFromProgID: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- windows_core::PCWSTR,
- *mut windows_core::GUID,
- ) -> windows_core::HRESULT,
-}
-pub trait IOPCServerList2_Impl: windows_core::IUnknownImpl {
- fn EnumClassesOfCategories(
- &self,
- cimplemented: u32,
- rgcatidimpl: *const windows_core::GUID,
- crequired: u32,
- rgcatidreq: *const windows_core::GUID,
- ) -> windows_core::Result;
- fn GetClassDetails(
- &self,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ppszverindprogid: *mut windows_core::PWSTR,
- ) -> windows_core::Result<()>;
- fn CLSIDFromProgID(
- &self,
- szprogid: &windows_core::PCWSTR,
- ) -> windows_core::Result;
-}
-impl IOPCServerList2_Vtbl {
- pub const fn new() -> Self {
- unsafe extern "system" fn EnumClassesOfCategories<
- Identity: IOPCServerList2_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- cimplemented: u32,
- rgcatidimpl: *const windows_core::GUID,
- crequired: u32,
- rgcatidreq: *const windows_core::GUID,
- ppenumclsid: *mut *mut core::ffi::c_void,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCServerList2_Impl::EnumClassesOfCategories(
- this,
- core::mem::transmute_copy(&cimplemented),
- core::mem::transmute_copy(&rgcatidimpl),
- core::mem::transmute_copy(&crequired),
- core::mem::transmute_copy(&rgcatidreq),
- ) {
- Ok(ok__) => {
- ppenumclsid.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- unsafe extern "system" fn GetClassDetails<
- Identity: IOPCServerList2_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- clsid: *const windows_core::GUID,
- ppszprogid: *mut windows_core::PWSTR,
- ppszusertype: *mut windows_core::PWSTR,
- ppszverindprogid: *mut windows_core::PWSTR,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCServerList2_Impl::GetClassDetails(
- this,
- core::mem::transmute_copy(&clsid),
- core::mem::transmute_copy(&ppszprogid),
- core::mem::transmute_copy(&ppszusertype),
- core::mem::transmute_copy(&ppszverindprogid),
- )
- .into()
- }
- }
- unsafe extern "system" fn CLSIDFromProgID<
- Identity: IOPCServerList2_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- szprogid: windows_core::PCWSTR,
- clsid: *mut windows_core::GUID,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- match IOPCServerList2_Impl::CLSIDFromProgID(this, core::mem::transmute(&szprogid)) {
- Ok(ok__) => {
- clsid.write(core::mem::transmute(ok__));
- windows_core::HRESULT(0)
- }
- Err(err) => err.into(),
- }
- }
- }
- Self {
- base__: windows_core::IUnknown_Vtbl::new::(),
- EnumClassesOfCategories: EnumClassesOfCategories::,
- GetClassDetails: GetClassDetails::,
- CLSIDFromProgID: CLSIDFromProgID::,
- }
- }
- pub fn matches(iid: &windows_core::GUID) -> bool {
- iid == &::IID
- }
-}
-impl windows_core::RuntimeName for IOPCServerList2 {}
windows_core::imp::define_interface!(
IOPCServerPublicGroups,
IOPCServerPublicGroups_Vtbl,
@@ -4664,63 +3950,6 @@ impl IOPCServerPublicGroups_Vtbl {
}
}
impl windows_core::RuntimeName for IOPCServerPublicGroups {}
-windows_core::imp::define_interface!(
- IOPCShutdown,
- IOPCShutdown_Vtbl,
- 0xf31dfde1_07b6_11d2_b2d8_0060083ba1fb
-);
-windows_core::imp::interface_hierarchy!(IOPCShutdown, windows_core::IUnknown);
-impl IOPCShutdown {
- pub unsafe fn ShutdownRequest(&self, szreason: P0) -> windows_core::Result<()>
- where
- P0: windows_core::Param,
- {
- unsafe {
- (windows_core::Interface::vtable(self).ShutdownRequest)(
- windows_core::Interface::as_raw(self),
- szreason.param().abi(),
- )
- .ok()
- }
- }
-}
-#[repr(C)]
-#[doc(hidden)]
-pub struct IOPCShutdown_Vtbl {
- pub base__: windows_core::IUnknown_Vtbl,
- pub ShutdownRequest: unsafe extern "system" fn(
- *mut core::ffi::c_void,
- windows_core::PCWSTR,
- ) -> windows_core::HRESULT,
-}
-pub trait IOPCShutdown_Impl: windows_core::IUnknownImpl {
- fn ShutdownRequest(&self, szreason: &windows_core::PCWSTR) -> windows_core::Result<()>;
-}
-impl IOPCShutdown_Vtbl {
- pub const fn new() -> Self {
- unsafe extern "system" fn ShutdownRequest<
- Identity: IOPCShutdown_Impl,
- const OFFSET: isize,
- >(
- this: *mut core::ffi::c_void,
- szreason: windows_core::PCWSTR,
- ) -> windows_core::HRESULT {
- unsafe {
- let this: &Identity =
- &*((this as *const *const ()).offset(OFFSET) as *const Identity);
- IOPCShutdown_Impl::ShutdownRequest(this, core::mem::transmute(&szreason)).into()
- }
- }
- Self {
- base__: windows_core::IUnknown_Vtbl::new::(),
- ShutdownRequest: ShutdownRequest::,
- }
- }
- pub fn matches(iid: &windows_core::GUID) -> bool {
- iid == &::IID
- }
-}
-impl windows_core::RuntimeName for IOPCShutdown {}
windows_core::imp::define_interface!(
IOPCSyncIO,
IOPCSyncIO_Vtbl,
diff --git a/opc_hda_bindings/.gitignore b/opc_hda_bindings/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/opc_hda_bindings/.gitignore
@@ -0,0 +1 @@
+/target
diff --git a/opc_hda_bindings/.metadata/.gitignore b/opc_hda_bindings/.metadata/.gitignore
new file mode 100644
index 0000000..1746e32
--- /dev/null
+++ b/opc_hda_bindings/.metadata/.gitignore
@@ -0,0 +1,2 @@
+bin
+obj
diff --git a/opc_hda_bindings/.metadata/generate.proj b/opc_hda_bindings/.metadata/generate.proj
new file mode 100644
index 0000000..12daebf
--- /dev/null
+++ b/opc_hda_bindings/.metadata/generate.proj
@@ -0,0 +1,17 @@
+
+
+
+ ../.windows/winmd/OPCHDA.winmd
+ 0.0.0.1
+ $(CompiledHeadersDir)
+
+
+
+
+
+ @(Headers)
+ OPCHDA
+ true
+
+
+
\ No newline at end of file
diff --git a/opc_hda_bindings/.metadata/main.cpp b/opc_hda_bindings/.metadata/main.cpp
new file mode 100644
index 0000000..f183697
--- /dev/null
+++ b/opc_hda_bindings/.metadata/main.cpp
@@ -0,0 +1,3 @@
+#include
+
+#include "opchda.h"
diff --git a/opc_hda_bindings/.metadata/opchda.idl b/opc_hda_bindings/.metadata/opchda.idl
new file mode 100644
index 0000000..83d0110
--- /dev/null
+++ b/opc_hda_bindings/.metadata/opchda.idl
@@ -0,0 +1,881 @@
+//==============================================================================
+// TITLE: opchda.idl
+//
+// CONTENTS:
+//
+// Interface declarations for the OPC Historial Data Access specifications.
+//
+// (c) Copyright 1999-2003 The OPC Foundation
+// ALL RIGHTS RESERVED.
+//
+// DISCLAIMER:
+// This code is provided by the OPC Foundation solely to assist in
+// understanding and use of the appropriate OPC Specification(s) and may be
+// used as set forth in the License Grant section of the OPC Specification.
+// This code is provided as-is and without warranty or support of any sort
+// and is subject to the Warranty and Liability Disclaimers which appear
+// in the printed OPC Specification.
+//
+// MODIFICATION LOG:
+//
+// Date By Notes
+// ---------- --- -----
+// 2001/01/26 OPC Made revisions for version 1.1
+// 2003/01/06 RSA Fixed formatting to comply with coding guidelines.
+//
+
+import "oaidl.idl";
+
+//==============================================================================
+// Category ID declarations (defined as interfaces to ensure they show up in the typelib).
+
+[uuid(7DE5B060-E089-11d2-A5E6-000086339399)] interface CATID_OPCHDAServer10 : IUnknown {}
+
+cpp_quote("#define CATID_OPCHDAServer10 IID_CATID_OPCHDAServer10")
+
+//==============================================================================
+// Structures, Typedefs and Enumerations.
+
+typedef enum tagOPCHDA_SERVERSTATUS
+{
+ OPCHDA_UP =1,
+ OPCHDA_DOWN,
+ OPCHDA_INDETERMINATE
+}
+OPCHDA_SERVERSTATUS;
+
+typedef enum tagOPCHDA_BROWSEDIRECTION
+{
+ OPCHDA_BROWSE_UP =1,
+ OPCHDA_BROWSE_DOWN,
+ OPCHDA_BROWSE_DIRECT
+}
+OPCHDA_BROWSEDIRECTION;
+
+typedef enum tagOPCHDA_BROWSETYPE
+{
+ OPCHDA_BRANCH =1,
+ OPCHDA_LEAF,
+ OPCHDA_FLAT,
+ OPCHDA_ITEMS
+}
+OPCHDA_BROWSETYPE;
+
+typedef enum tagOPCHDA_ANNOTATIONCAPABILITIES
+{
+ OPCHDA_READANNOTATIONCAP = 0x01,
+ OPCHDA_INSERTANNOTATIONCAP = 0x02
+}
+OPCHDA_ANNOTATIONCAPABILITIES;
+
+
+typedef enum tagOPCHDA_UPDATECAPABILITIES
+{
+ OPCHDA_INSERTCAP = 0x01,
+ OPCHDA_REPLACECAP = 0x02,
+ OPCHDA_INSERTREPLACECAP = 0x04,
+ OPCHDA_DELETERAWCAP = 0x08,
+ OPCHDA_DELETEATTIMECAP = 0x10
+}
+OPCHDA_UPDATECAPABILITIES;
+
+typedef enum tagOPCHDA_OPERATORCODES
+{
+ OPCHDA_EQUAL =1,
+ OPCHDA_LESS,
+ OPCHDA_LESSEQUAL,
+ OPCHDA_GREATER,
+ OPCHDA_GREATEREQUAL,
+ OPCHDA_NOTEQUAL
+}
+OPCHDA_OPERATORCODES;
+
+typedef enum tagOPCHDA_EDITTYPE
+{
+ OPCHDA_INSERT = 1,
+ OPCHDA_REPLACE,
+ OPCHDA_INSERTREPLACE,
+ OPCHDA_DELETE
+}
+OPCHDA_EDITTYPE;
+
+typedef enum tagOPCHDA_AGGREGATE
+{
+ OPCHDA_NOAGGREGATE = 0,
+ OPCHDA_INTERPOLATIVE,
+ OPCHDA_TOTAL,
+ OPCHDA_AVERAGE,
+ OPCHDA_TIMEAVERAGE,
+ OPCHDA_COUNT,
+ OPCHDA_STDEV,
+ OPCHDA_MINIMUMACTUALTIME,
+ OPCHDA_MINIMUM,
+ OPCHDA_MAXIMUMACTUALTIME,
+ OPCHDA_MAXIMUM,
+ OPCHDA_START,
+ OPCHDA_END,
+ OPCHDA_DELTA,
+ OPCHDA_REGSLOPE,
+ OPCHDA_REGCONST,
+ OPCHDA_REGDEV,
+ OPCHDA_VARIANCE,
+ OPCHDA_RANGE,
+ OPCHDA_DURATIONGOOD,
+ OPCHDA_DURATIONBAD,
+ OPCHDA_PERCENTGOOD,
+ OPCHDA_PERCENTBAD,
+ OPCHDA_WORSTQUALITY,
+ OPCHDA_ANNOTATIONS
+}
+OPCHDA_AGGREGATE;
+
+typedef DWORD OPCHANDLE;
+
+typedef struct tagOPCHDA_ANNOTATION
+{
+ OPCHANDLE hClient;
+ DWORD dwNumValues;
+ [size_is (dwNumValues)] FILETIME* ftTimeStamps;
+ [size_is (dwNumValues), string] LPWSTR* szAnnotation;
+ [size_is (dwNumValues)] FILETIME* ftAnnotationTime;
+ [size_is (dwNumValues), string] LPWSTR* szUser;
+}
+OPCHDA_ANNOTATION;
+
+typedef struct tagOPCHDA_MODIFIEDITEM
+{
+ OPCHANDLE hClient;
+ DWORD dwCount;
+ [size_is(dwCount)] FILETIME* pftTimeStamps;
+ [size_is(dwCount)] DWORD* pdwQualities;
+ [size_is(dwCount)] VARIANT* pvDataValues;
+ [size_is(dwCount)] FILETIME* pftModificationTime;
+ [size_is(dwCount)] OPCHDA_EDITTYPE* pEditType;
+ [size_is(dwCount)] LPWSTR* szUser;
+}
+OPCHDA_MODIFIEDITEM;
+
+typedef struct tagOPCHDA_ATTRIBUTE
+{
+ OPCHANDLE hClient;
+ DWORD dwNumValues;
+ DWORD dwAttributeID;
+ [size_is (dwNumValues)] FILETIME* ftTimeStamps;
+ [size_is (dwNumValues)] VARIANT* vAttributeValues;
+}
+OPCHDA_ATTRIBUTE;
+
+typedef struct tagOPCHDA_TIME
+{
+ BOOL bString;
+ [string] LPWSTR szTime;
+ FILETIME ftTime;
+}
+OPCHDA_TIME;
+
+typedef struct tagOPCHDA_ITEM
+{
+ OPCHANDLE hClient;
+ DWORD haAggregate;
+ DWORD dwCount;
+ [size_is(dwCount)] FILETIME* pftTimeStamps;
+ [size_is(dwCount)] DWORD* pdwQualities;
+ [size_is(dwCount)] VARIANT* pvDataValues;
+}
+OPCHDA_ITEM;
+
+//==============================================================================
+// IOPCHDA_Browser
+
+[
+ object,
+ uuid(1F1217B1-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_Browser : IUnknown
+{
+ HRESULT GetEnum(
+ [in] OPCHDA_BROWSETYPE dwBrowseType,
+ [out] LPENUMSTRING* ppIEnumString
+ );
+
+ HRESULT ChangeBrowsePosition(
+ [in] OPCHDA_BROWSEDIRECTION dwBrowseDirection,
+ [in, string] LPCWSTR szString
+ );
+
+ HRESULT GetItemID(
+ [in, string] LPCWSTR szNode,
+ [out, string] LPWSTR* pszItemID
+ );
+
+
+ HRESULT GetBranchPosition(
+ [out, string] LPWSTR* pszBranchPos
+ );
+}
+
+//==============================================================================
+// IOPCHDA_Server
+
+[
+ object,
+ uuid(1F1217B0-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_Server : IUnknown
+{
+ HRESULT GetItemAttributes(
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] DWORD** ppdwAttrID,
+ [out, size_is(,*pdwCount),string] LPWSTR** ppszAttrName,
+ [out, size_is(,*pdwCount),string] LPWSTR** ppszAttrDesc,
+ [out, size_is(,*pdwCount)] VARTYPE** ppvtAttrDataType
+ );
+
+ HRESULT GetAggregates(
+ [out] DWORD* pdwCount,
+ [out, size_is(,*pdwCount)] DWORD** ppdwAggrID,
+ [out, size_is(,*pdwCount), string] LPWSTR** ppszAggrName,
+ [out, size_is(,*pdwCount), string] LPWSTR** ppszAggrDesc
+ );
+
+ HRESULT GetHistorianStatus(
+ [out] OPCHDA_SERVERSTATUS* pwStatus,
+ [out] FILETIME** pftCurrentTime,
+ [out] FILETIME** pftStartTime,
+ [out] WORD* pwMajorVersion,
+ [out] WORD* pwMinorVersion,
+ [out] WORD* pwBuildNumber,
+ [out] DWORD* pdwMaxReturnValues,
+ [out, string] LPWSTR* ppszStatusString,
+ [out, string] LPWSTR* ppszVendorInfo
+ );
+
+ HRESULT GetItemHandles(
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] LPWSTR* pszItemID,
+ [in, size_is(dwCount)] OPCHANDLE* phClient,
+ [out, size_is(,dwCount)] OPCHANDLE** pphServer,
+ [out, size_is(,dwCount)] HRESULT** ppErrors
+ );
+
+ HRESULT ReleaseItemHandles(
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] OPCHANDLE* phServer,
+ [out, size_is(,dwCount)] HRESULT** ppErrors
+ );
+
+ HRESULT ValidateItemIDs(
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] LPWSTR* pszItemID,
+ [out, size_is(,dwCount)] HRESULT** ppErrors
+ );
+
+ HRESULT CreateBrowse(
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] DWORD* pdwAttrID,
+ [in, size_is(dwCount)] OPCHDA_OPERATORCODES* pOperator,
+ [in, size_is(dwCount)] VARIANT* vFilter,
+ [out] IOPCHDA_Browser** pphBrowser,
+ [out, size_is(,dwCount)] HRESULT** ppErrors
+ );
+}
+
+//==============================================================================
+// IOPCHDA_SyncRead
+
+[
+ object,
+ uuid(1F1217B2-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_SyncRead: IUnknown
+{
+ HRESULT ReadRaw(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumValues,
+ [in] BOOL bBounds,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out, size_is(,dwNumItems)] OPCHDA_ITEM** ppItemValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadProcessed(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] FILETIME ftResampleInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] DWORD* haAggregate,
+ [out, size_is(,dwNumItems)] OPCHDA_ITEM** ppItemValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadAtTime(
+ [in] DWORD dwNumTimeStamps,
+ [in, size_is(dwNumTimeStamps)] FILETIME* ftTimeStamps,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out, size_is(,dwNumItems)] OPCHDA_ITEM** ppItemValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadModified(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumValues,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out, size_is(,dwNumItems)] OPCHDA_MODIFIEDITEM** ppItemValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadAttribute(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] OPCHANDLE hServer,
+ [in] DWORD dwNumAttributes,
+ [in, size_is(dwNumAttributes)] DWORD* pdwAttributeIDs,
+ [out, size_is(,dwNumAttributes)] OPCHDA_ATTRIBUTE** ppAttributeValues,
+ [out, size_is(,dwNumAttributes)] HRESULT** ppErrors
+ );
+}
+
+//==============================================================================
+// IOPCHDA_SyncUpdate
+
+[
+ object,
+ uuid(1F1217B3-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_SyncUpdate : IUnknown
+{
+ HRESULT QueryCapabilities(
+ [out] OPCHDA_UPDATECAPABILITIES* pCapabilities
+ );
+
+ HRESULT Insert(
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Replace(
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT InsertReplace(
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT DeleteRaw(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT DeleteAtTime(
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+}
+
+//==============================================================================
+// IOPCHDA_SyncAnnotations
+
+[
+ object,
+ uuid(1F1217B4-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_SyncAnnotations : IUnknown
+{
+ HRESULT QueryCapabilities(
+ [out] OPCHDA_ANNOTATIONCAPABILITIES* pCapabilities
+ );
+
+ HRESULT Read(
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out, size_is(,dwNumItems)] OPCHDA_ANNOTATION** ppAnnotationValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Insert(
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] OPCHDA_ANNOTATION* pAnnotationValues,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+}
+
+//==============================================================================
+// IOPCHDA_AsyncRead
+
+[
+ object,
+ uuid(1F1217B5-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_AsyncRead : IUnknown
+{
+ HRESULT ReadRaw(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumValues,
+ [in] BOOL bBounds,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT AdviseRaw(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in] FILETIME ftUpdateInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadProcessed(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] FILETIME ftResampleInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] DWORD* haAggregate,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT AdviseProcessed(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in] FILETIME ftResampleInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] DWORD* haAggregate,
+ [in] DWORD dwNumIntervals,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadAtTime(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumTimeStamps,
+ [in, size_is(dwNumTimeStamps)] FILETIME* ftTimeStamps,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadModified(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumValues,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadAttribute(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] OPCHANDLE hServer,
+ [in] DWORD dwNumAttributes,
+ [in, size_is(dwNumAttributes)] DWORD* dwAttributeIDs,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumAttributes)] HRESULT** ppErrors
+ );
+
+ HRESULT Cancel(
+ [in] DWORD dwCancelID
+ );
+}
+
+//==============================================================================
+// IOPCHDA_AsyncUpdate
+
+[
+ object,
+ uuid(1F1217B6-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_AsyncUpdate : IUnknown
+{
+ HRESULT QueryCapabilities(
+ [out] OPCHDA_UPDATECAPABILITIES* pCapabilities
+ );
+
+ HRESULT Insert(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Replace(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT InsertReplace(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] VARIANT* vDataValues,
+ [in, size_is(dwNumItems)] DWORD* pdwQualities,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT DeleteRaw(
+ [in] DWORD dwTransactionID,
+ [in,out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumItems,
+ [in, size_is (dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT DeleteAtTime(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Cancel(
+ [in] DWORD dwCancelID
+ );
+}
+
+//==============================================================================
+// IOPCHDA_AsyncAnnotations
+
+[
+ object,
+ uuid(1F1217B7-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_AsyncAnnotations: IUnknown
+{
+ HRESULT QueryCapabilities(
+ [out] OPCHDA_ANNOTATIONCAPABILITIES* pCapabilities
+ );
+
+ HRESULT Read(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Insert(
+ [in] DWORD dwTransactionID,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] FILETIME* ftTimeStamps,
+ [in, size_is(dwNumItems)] OPCHDA_ANNOTATION* pAnnotationValues,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Cancel(
+ [in] DWORD dwCancelID
+ );
+}
+
+//==============================================================================
+// IOPCHDA_Playback
+
+[
+ object,
+ uuid(1F1217B8-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_Playback : IUnknown
+{
+ HRESULT ReadRawWithUpdate(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] DWORD dwNumValues,
+ [in] FILETIME ftUpdateDuration,
+ [in] FILETIME ftUpdateInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT ReadProcessedWithUpdate(
+ [in] DWORD dwTransactionID,
+ [in, out] OPCHDA_TIME* htStartTime,
+ [in, out] OPCHDA_TIME* htEndTime,
+ [in] FILETIME ftResampleInterval,
+ [in] DWORD dwNumIntervals,
+ [in] FILETIME ftUpdateInterval,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHANDLE* phServer,
+ [in, size_is(dwNumItems)] DWORD* haAggregate,
+ [out] DWORD* pdwCancelID,
+ [out, size_is(,dwNumItems)] HRESULT** ppErrors
+ );
+
+ HRESULT Cancel(
+ [in] DWORD dwCancelID
+ );
+}
+
+//==============================================================================
+// IOPCHDA_DataCallback
+
+[
+ object,
+ uuid(1F1217B9-DEE0-11d2-A5E5-000086339399),
+ pointer_default(unique)
+]
+interface IOPCHDA_DataCallback : IUnknown
+{
+ HRESULT OnDataChange(
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_ITEM* pItemValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnReadComplete(
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_ITEM* pItemValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnReadModifiedComplete(
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_MODIFIEDITEM* pItemValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnReadAttributeComplete(
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] OPCHANDLE hClient,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_ATTRIBUTE* pAttributeValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnReadAnnotations(
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_ANNOTATION* pAnnotationValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnInsertAnnotations (
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] OPCHANDLE* phClients,
+ [in, size_is(dwCount)] HRESULT* phrErrors
+ );
+
+ HRESULT OnPlayback (
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems)] OPCHDA_ITEM** ppItemValues,
+ [in, size_is(dwNumItems)] HRESULT* phrErrors
+ );
+
+ HRESULT OnUpdateComplete (
+ [in] DWORD dwTransactionID,
+ [in] HRESULT hrStatus,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] OPCHANDLE* phClients,
+ [in, size_is(dwCount)] HRESULT* phrErrors
+ );
+
+ HRESULT OnCancelComplete(
+ [in] DWORD dwCancelID
+ );
+}
+
+//==============================================================================
+// Type Library
+
+[
+ uuid(1F1217BA-DEE0-11d2-A5E5-000086339399),
+ version(1.10),
+ helpstring("OPC Historial Data Access 1.10 Type Library")
+]
+library OPCHDA
+{
+ importlib("stdole32.tlb");
+ importlib("stdole2.tlb");
+
+ //==========================================================================
+ // Category IDs
+
+ interface CATID_OPCHDAServer10;
+
+ //==========================================================================
+ // Constants
+
+ module OPCHDA_Constants
+ {
+ // category description.
+ const LPCWSTR OPC_CATEGORY_DESCRIPTION_HDA10 = L"OPC History Data Access Servers Version 1.0";
+
+ // attribute ids.
+ const DWORD OPCHDA_DATA_TYPE = 0x01;
+ const DWORD OPCHDA_DESCRIPTION = 0x02;
+ const DWORD OPCHDA_ENG_UNITS = 0x03;
+ const DWORD OPCHDA_STEPPED = 0x04;
+ const DWORD OPCHDA_ARCHIVING = 0x05;
+ const DWORD OPCHDA_DERIVE_EQUATION = 0x06;
+ const DWORD OPCHDA_NODE_NAME = 0x07;
+ const DWORD OPCHDA_PROCESS_NAME = 0x08;
+ const DWORD OPCHDA_SOURCE_NAME = 0x09;
+ const DWORD OPCHDA_SOURCE_TYPE = 0x0a;
+ const DWORD OPCHDA_NORMAL_MAXIMUM = 0x0b;
+ const DWORD OPCHDA_NORMAL_MINIMUM = 0x0c;
+ const DWORD OPCHDA_ITEMID = 0x0d;
+ const DWORD OPCHDA_MAX_TIME_INT = 0x0e;
+ const DWORD OPCHDA_MIN_TIME_INT = 0x0f;
+ const DWORD OPCHDA_EXCEPTION_DEV = 0x10;
+ const DWORD OPCHDA_EXCEPTION_DEV_TYPE = 0x11;
+ const DWORD OPCHDA_HIGH_ENTRY_LIMIT = 0x12;
+ const DWORD OPCHDA_LOW_ENTRY_LIMIT = 0x13;
+
+ // attribute names.
+ const LPCWSTR OPCHDA_ATTRNAME_DATA_TYPE = L"Data Type";
+ const LPCWSTR OPCHDA_ATTRNAME_DESCRIPTION = L"Description";
+ const LPCWSTR OPCHDA_ATTRNAME_ENG_UNITS = L"Eng Units";
+ const LPCWSTR OPCHDA_ATTRNAME_STEPPED = L"Stepped";
+ const LPCWSTR OPCHDA_ATTRNAME_ARCHIVING = L"Archiving";
+ const LPCWSTR OPCHDA_ATTRNAME_DERIVE_EQUATION = L"Derive Equation";
+ const LPCWSTR OPCHDA_ATTRNAME_NODE_NAME = L"Node Name";
+ const LPCWSTR OPCHDA_ATTRNAME_PROCESS_NAME = L"Process Name";
+ const LPCWSTR OPCHDA_ATTRNAME_SOURCE_NAME = L"Source Name";
+ const LPCWSTR OPCHDA_ATTRNAME_SOURCE_TYPE = L"Source Type";
+ const LPCWSTR OPCHDA_ATTRNAME_NORMAL_MAXIMUM = L"Normal Maximum";
+ const LPCWSTR OPCHDA_ATTRNAME_NORMAL_MINIMUM = L"Normal Minimum";
+ const LPCWSTR OPCHDA_ATTRNAME_ITEMID = L"ItemID";
+ const LPCWSTR OPCHDA_ATTRNAME_MAX_TIME_INT = L"Max Time Interval";
+ const LPCWSTR OPCHDA_ATTRNAME_MIN_TIME_INT = L"Min Time Interval";
+ const LPCWSTR OPCHDA_ATTRNAME_EXCEPTION_DEV = L"Exception Deviation";
+ const LPCWSTR OPCHDA_ATTRNAME_EXCEPTION_DEV_TYPE = L"Exception Dev Type";
+ const LPCWSTR OPCHDA_ATTRNAME_HIGH_ENTRY_LIMIT = L"High Entry Limit";
+ const LPCWSTR OPCHDA_ATTRNAME_LOW_ENTRY_LIMIT = L"Low Entry Limit";
+
+ // aggregate names.
+ const LPCWSTR OPCHDA_AGGRNAME_INTERPOLATIVE = L"Interpolative";
+ const LPCWSTR OPCHDA_AGGRNAME_TOTAL = L"Total";
+ const LPCWSTR OPCHDA_AGGRNAME_AVERAGE = L"Average";
+ const LPCWSTR OPCHDA_AGGRNAME_TIMEAVERAGE = L"Time Average";
+ const LPCWSTR OPCHDA_AGGRNAME_COUNT = L"Count";
+ const LPCWSTR OPCHDA_AGGRNAME_STDEV = L"Standard Deviation";
+ const LPCWSTR OPCHDA_AGGRNAME_MINIMUMACTUALTIME = L"Minimum Actual Time";
+ const LPCWSTR OPCHDA_AGGRNAME_MINIMUM = L"Minimum";
+ const LPCWSTR OPCHDA_AGGRNAME_MAXIMUMACTUALTIME = L"Maximum Actual Time";
+ const LPCWSTR OPCHDA_AGGRNAME_MAXIMUM = L"Maximum";
+ const LPCWSTR OPCHDA_AGGRNAME_START = L"Start";
+ const LPCWSTR OPCHDA_AGGRNAME_END = L"End";
+ const LPCWSTR OPCHDA_AGGRNAME_DELTA = L"Delta";
+ const LPCWSTR OPCHDA_AGGRNAME_REGSLOPE = L"Regression Line Slope";
+ const LPCWSTR OPCHDA_AGGRNAME_REGCONST = L"Regression Line Constant";
+ const LPCWSTR OPCHDA_AGGRNAME_REGDEV = L"Regression Line Error";
+ const LPCWSTR OPCHDA_AGGRNAME_VARIANCE = L"Variance";
+ const LPCWSTR OPCHDA_AGGRNAME_RANGE = L"Range";
+ const LPCWSTR OPCHDA_AGGRNAME_DURATIONGOOD = L"Duration Good";
+ const LPCWSTR OPCHDA_AGGRNAME_DURATIONBAD = L"Duration Bad";
+ const LPCWSTR OPCHDA_AGGRNAME_PERCENTGOOD = L"Percent Good";
+ const LPCWSTR OPCHDA_AGGRNAME_PERCENTBAD = L"Percent Bad";
+ const LPCWSTR OPCHDA_AGGRNAME_WORSTQUALITY = L"Worst Quality";
+ const LPCWSTR OPCHDA_AGGRNAME_ANNOTATIONS = L"Annotations";
+
+ // OPCHDA_QUALITY -- these are the high-order 16 bits, OPC DA Quality occupies low-order 16 bits.
+ const DWORD OPCHDA_EXTRADATA = 0x00010000;
+ const DWORD OPCHDA_INTERPOLATED = 0x00020000;
+ const DWORD OPCHDA_RAW = 0x00040000;
+ const DWORD OPCHDA_CALCULATED = 0x00080000;
+ const DWORD OPCHDA_NOBOUND = 0x00100000;
+ const DWORD OPCHDA_NODATA = 0x00200000;
+ const DWORD OPCHDA_DATALOST = 0x00400000;
+ const DWORD OPCHDA_CONVERSION = 0x00800000;
+ const DWORD OPCHDA_PARTIAL = 0x01000000;
+ }
+
+ //==========================================================================
+ // Synchronous Interfaces
+
+ interface IOPCHDA_Server;
+ interface IOPCHDA_Browser;
+ interface IOPCHDA_SyncRead;
+ interface IOPCHDA_SyncUpdate;
+ interface IOPCHDA_SyncAnnotations;
+ interface IOPCHDA_AsyncRead;
+ interface IOPCHDA_AsyncUpdate;
+ interface IOPCHDA_AsyncAnnotations;
+ interface IOPCHDA_Playback;
+ interface IOPCHDA_DataCallback;
+};
+
diff --git a/opc_hda_bindings/.windows/winmd/OPCHDA.winmd b/opc_hda_bindings/.windows/winmd/OPCHDA.winmd
new file mode 100644
index 0000000..7400e23
Binary files /dev/null and b/opc_hda_bindings/.windows/winmd/OPCHDA.winmd differ
diff --git a/opc_hda_bindings/Cargo.toml b/opc_hda_bindings/Cargo.toml
new file mode 100644
index 0000000..03330bf
--- /dev/null
+++ b/opc_hda_bindings/Cargo.toml
@@ -0,0 +1,22 @@
+[package]
+name = "opc_hda_bindings"
+version = "0.3.0"
+edition = "2024"
+description = "OPC Historical Data Access bindings"
+readme = "README.md"
+repository = "https://github.com/Ronbb/rust_opc"
+license = "MIT"
+keywords = ["bindings", "hda", "opc", "opchda"]
+exclude = [".metadata/*", ".windows/*", "build.rs"]
+
+[package.metadata.docs.rs]
+default-target = "x86_64-pc-windows-msvc"
+targets = []
+
+[dependencies]
+windows = { workspace = true }
+windows-core = { workspace = true }
+windows-targets = { workspace = true }
+
+[build-dependencies]
+windows-bindgen = { workspace = true }
diff --git a/opc_hda_bindings/README.md b/opc_hda_bindings/README.md
new file mode 100644
index 0000000..83ddcff
--- /dev/null
+++ b/opc_hda_bindings/README.md
@@ -0,0 +1,18 @@
+# OPC Historical Data Access (HDA) Bindings
+
+Please see docs on [docs.rs](https://docs.rs/opc_hda_bindings/).
+
+## Example
+
+```rust
+// TODO
+```
+
+## Rebuild metadata
+
+Open **Developer Powershell for VS2022**.
+
+```batch
+cd .metadata
+dotnet build
+```
diff --git a/opc_hda_bindings/build.rs b/opc_hda_bindings/build.rs
new file mode 100644
index 0000000..edfbc7d
--- /dev/null
+++ b/opc_hda_bindings/build.rs
@@ -0,0 +1,19 @@
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+ println!("cargo:rerun-if-changed=.windows/winmd/OPCHDA.winmd");
+
+ windows_bindgen::bindgen([
+ "--in",
+ ".windows/winmd/OPCHDA.winmd",
+ "default",
+ "--out",
+ "src/bindings.rs",
+ "--reference",
+ "windows,skip-root,Windows",
+ "--filter",
+ "OPCHDA",
+ "--flat",
+ "--implement",
+ ])
+ .unwrap();
+}
diff --git a/opc_hda_bindings/src/bindings.rs b/opc_hda_bindings/src/bindings.rs
new file mode 100644
index 0000000..738befe
--- /dev/null
+++ b/opc_hda_bindings/src/bindings.rs
@@ -0,0 +1,3997 @@
+// Bindings generated by `windows-bindgen` 0.62.1
+
+#![allow(
+ non_snake_case,
+ non_upper_case_globals,
+ non_camel_case_types,
+ dead_code,
+ clippy::all
+)]
+
+windows_core::imp::define_interface!(
+ CATID_OPCHDAServer10,
+ CATID_OPCHDAServer10_Vtbl,
+ 0x7de5b060_e089_11d2_a5e6_000086339399
+);
+windows_core::imp::interface_hierarchy!(CATID_OPCHDAServer10, windows_core::IUnknown);
+#[repr(C)]
+#[doc(hidden)]
+pub struct CATID_OPCHDAServer10_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+}
+pub trait CATID_OPCHDAServer10_Impl: windows_core::IUnknownImpl {}
+impl CATID_OPCHDAServer10_Vtbl {
+ pub const fn new() -> Self {
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for CATID_OPCHDAServer10 {}
+windows_core::imp::define_interface!(
+ IOPCHDA_AsyncAnnotations,
+ IOPCHDA_AsyncAnnotations_Vtbl,
+ 0x1f1217b7_dee0_11d2_a5e5_000086339399
+);
+windows_core::imp::interface_hierarchy!(IOPCHDA_AsyncAnnotations, windows_core::IUnknown);
+impl IOPCHDA_AsyncAnnotations {
+ pub unsafe fn QueryCapabilities(
+ &self,
+ ) -> windows_core::Result {
+ unsafe {
+ let mut result__ = core::mem::zeroed();
+ (windows_core::Interface::vtable(self).QueryCapabilities)(
+ windows_core::Interface::as_raw(self),
+ &mut result__,
+ )
+ .map(|| result__)
+ }
+ }
+ pub unsafe fn Read(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Read)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ htendtime as _,
+ dwnumitems,
+ phserver,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Insert(
+ &self,
+ dwtransactionid: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ fttimestamps: *const windows::Win32::Foundation::FILETIME,
+ pannotationvalues: *const tagOPCHDA_ANNOTATION,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Insert)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ dwnumitems,
+ phserver,
+ fttimestamps,
+ pannotationvalues,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Cancel(&self, dwcancelid: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Cancel)(
+ windows_core::Interface::as_raw(self),
+ dwcancelid,
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCHDA_AsyncAnnotations_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub QueryCapabilities: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ *mut tagOPCHDA_ANNOTATIONCAPABILITIES,
+ ) -> windows_core::HRESULT,
+ pub Read: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ *mut tagOPCHDA_TIME,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub Insert: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ u32,
+ *const u32,
+ *const windows::Win32::Foundation::FILETIME,
+ *const tagOPCHDA_ANNOTATION,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub Cancel: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+}
+pub trait IOPCHDA_AsyncAnnotations_Impl: windows_core::IUnknownImpl {
+ fn QueryCapabilities(&self) -> windows_core::Result;
+ fn Read(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn Insert(
+ &self,
+ dwtransactionid: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ fttimestamps: *const windows::Win32::Foundation::FILETIME,
+ pannotationvalues: *const tagOPCHDA_ANNOTATION,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn Cancel(&self, dwcancelid: u32) -> windows_core::Result<()>;
+}
+impl IOPCHDA_AsyncAnnotations_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn QueryCapabilities<
+ Identity: IOPCHDA_AsyncAnnotations_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ pcapabilities: *mut tagOPCHDA_ANNOTATIONCAPABILITIES,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ match IOPCHDA_AsyncAnnotations_Impl::QueryCapabilities(this) {
+ Ok(ok__) => {
+ pcapabilities.write(core::mem::transmute(ok__));
+ windows_core::HRESULT(0)
+ }
+ Err(err) => err.into(),
+ }
+ }
+ }
+ unsafe extern "system" fn Read<
+ Identity: IOPCHDA_AsyncAnnotations_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncAnnotations_Impl::Read(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute_copy(&htendtime),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn Insert<
+ Identity: IOPCHDA_AsyncAnnotations_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ fttimestamps: *const windows::Win32::Foundation::FILETIME,
+ pannotationvalues: *const tagOPCHDA_ANNOTATION,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncAnnotations_Impl::Insert(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&fttimestamps),
+ core::mem::transmute_copy(&pannotationvalues),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn Cancel<
+ Identity: IOPCHDA_AsyncAnnotations_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwcancelid: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncAnnotations_Impl::Cancel(this, core::mem::transmute_copy(&dwcancelid))
+ .into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ QueryCapabilities: QueryCapabilities::,
+ Read: Read::,
+ Insert: Insert::,
+ Cancel: Cancel::,
+ }
+ }
+ pub fn matches(iid: &windows_core::GUID) -> bool {
+ iid == &::IID
+ }
+}
+impl windows_core::RuntimeName for IOPCHDA_AsyncAnnotations {}
+windows_core::imp::define_interface!(
+ IOPCHDA_AsyncRead,
+ IOPCHDA_AsyncRead_Vtbl,
+ 0x1f1217b5_dee0_11d2_a5e5_000086339399
+);
+windows_core::imp::interface_hierarchy!(IOPCHDA_AsyncRead, windows_core::IUnknown);
+impl IOPCHDA_AsyncRead {
+ pub unsafe fn ReadRaw(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ bbounds: bool,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).ReadRaw)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ htendtime as _,
+ dwnumvalues,
+ bbounds.into(),
+ dwnumitems,
+ phserver,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn AdviseRaw(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftupdateinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).AdviseRaw)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ core::mem::transmute(ftupdateinterval),
+ dwnumitems,
+ phserver,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn ReadProcessed(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).ReadProcessed)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ htendtime as _,
+ core::mem::transmute(ftresampleinterval),
+ dwnumitems,
+ phserver,
+ haaggregate,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn AdviseProcessed(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ dwnumintervals: u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).AdviseProcessed)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ core::mem::transmute(ftresampleinterval),
+ dwnumitems,
+ phserver,
+ haaggregate,
+ dwnumintervals,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn ReadAtTime(
+ &self,
+ dwtransactionid: u32,
+ fttimestamps: &[windows::Win32::Foundation::FILETIME],
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).ReadAtTime)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ fttimestamps.len().try_into().unwrap(),
+ core::mem::transmute(fttimestamps.as_ptr()),
+ dwnumitems,
+ phserver,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn ReadModified(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).ReadModified)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ htendtime as _,
+ dwnumvalues,
+ dwnumitems,
+ phserver,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn ReadAttribute(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ hserver: u32,
+ dwnumattributes: u32,
+ dwattributeids: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).ReadAttribute)(
+ windows_core::Interface::as_raw(self),
+ dwtransactionid,
+ htstarttime as _,
+ htendtime as _,
+ hserver,
+ dwnumattributes,
+ dwattributeids,
+ pdwcancelid as _,
+ pperrors as _,
+ )
+ .ok()
+ }
+ }
+ pub unsafe fn Cancel(&self, dwcancelid: u32) -> windows_core::Result<()> {
+ unsafe {
+ (windows_core::Interface::vtable(self).Cancel)(
+ windows_core::Interface::as_raw(self),
+ dwcancelid,
+ )
+ .ok()
+ }
+ }
+}
+#[repr(C)]
+#[doc(hidden)]
+pub struct IOPCHDA_AsyncRead_Vtbl {
+ pub base__: windows_core::IUnknown_Vtbl,
+ pub ReadRaw: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ *mut tagOPCHDA_TIME,
+ u32,
+ windows_core::BOOL,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub AdviseRaw: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ windows::Win32::Foundation::FILETIME,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub ReadProcessed: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ *mut tagOPCHDA_TIME,
+ windows::Win32::Foundation::FILETIME,
+ u32,
+ *const u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub AdviseProcessed: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ windows::Win32::Foundation::FILETIME,
+ u32,
+ *const u32,
+ *const u32,
+ u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub ReadAtTime: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ u32,
+ *const windows::Win32::Foundation::FILETIME,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub ReadModified: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ *mut tagOPCHDA_TIME,
+ u32,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub ReadAttribute: unsafe extern "system" fn(
+ *mut core::ffi::c_void,
+ u32,
+ *mut tagOPCHDA_TIME,
+ *mut tagOPCHDA_TIME,
+ u32,
+ u32,
+ *const u32,
+ *mut u32,
+ *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT,
+ pub Cancel: unsafe extern "system" fn(*mut core::ffi::c_void, u32) -> windows_core::HRESULT,
+}
+pub trait IOPCHDA_AsyncRead_Impl: windows_core::IUnknownImpl {
+ fn ReadRaw(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ bbounds: windows_core::BOOL,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn AdviseRaw(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftupdateinterval: &windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn ReadProcessed(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: &windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn AdviseProcessed(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: &windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ dwnumintervals: u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn ReadAtTime(
+ &self,
+ dwtransactionid: u32,
+ dwnumtimestamps: u32,
+ fttimestamps: *const windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn ReadModified(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn ReadAttribute(
+ &self,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ hserver: u32,
+ dwnumattributes: u32,
+ dwattributeids: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::Result<()>;
+ fn Cancel(&self, dwcancelid: u32) -> windows_core::Result<()>;
+}
+impl IOPCHDA_AsyncRead_Vtbl {
+ pub const fn new() -> Self {
+ unsafe extern "system" fn ReadRaw(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ bbounds: windows_core::BOOL,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::ReadRaw(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute_copy(&htendtime),
+ core::mem::transmute_copy(&dwnumvalues),
+ core::mem::transmute_copy(&bbounds),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn AdviseRaw<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftupdateinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::AdviseRaw(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute(&ftupdateinterval),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn ReadProcessed<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::ReadProcessed(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute_copy(&htendtime),
+ core::mem::transmute(&ftresampleinterval),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&haaggregate),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn AdviseProcessed<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ ftresampleinterval: windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ haaggregate: *const u32,
+ dwnumintervals: u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::AdviseProcessed(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute(&ftresampleinterval),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&haaggregate),
+ core::mem::transmute_copy(&dwnumintervals),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn ReadAtTime<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ dwnumtimestamps: u32,
+ fttimestamps: *const windows::Win32::Foundation::FILETIME,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::ReadAtTime(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&dwnumtimestamps),
+ core::mem::transmute_copy(&fttimestamps),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn ReadModified<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ dwnumvalues: u32,
+ dwnumitems: u32,
+ phserver: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::ReadModified(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute_copy(&htendtime),
+ core::mem::transmute_copy(&dwnumvalues),
+ core::mem::transmute_copy(&dwnumitems),
+ core::mem::transmute_copy(&phserver),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn ReadAttribute<
+ Identity: IOPCHDA_AsyncRead_Impl,
+ const OFFSET: isize,
+ >(
+ this: *mut core::ffi::c_void,
+ dwtransactionid: u32,
+ htstarttime: *mut tagOPCHDA_TIME,
+ htendtime: *mut tagOPCHDA_TIME,
+ hserver: u32,
+ dwnumattributes: u32,
+ dwattributeids: *const u32,
+ pdwcancelid: *mut u32,
+ pperrors: *mut *mut windows_core::HRESULT,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::ReadAttribute(
+ this,
+ core::mem::transmute_copy(&dwtransactionid),
+ core::mem::transmute_copy(&htstarttime),
+ core::mem::transmute_copy(&htendtime),
+ core::mem::transmute_copy(&hserver),
+ core::mem::transmute_copy(&dwnumattributes),
+ core::mem::transmute_copy(&dwattributeids),
+ core::mem::transmute_copy(&pdwcancelid),
+ core::mem::transmute_copy(&pperrors),
+ )
+ .into()
+ }
+ }
+ unsafe extern "system" fn Cancel(
+ this: *mut core::ffi::c_void,
+ dwcancelid: u32,
+ ) -> windows_core::HRESULT {
+ unsafe {
+ let this: &Identity =
+ &*((this as *const *const ()).offset(OFFSET) as *const Identity);
+ IOPCHDA_AsyncRead_Impl::Cancel(this, core::mem::transmute_copy(&dwcancelid)).into()
+ }
+ }
+ Self {
+ base__: windows_core::IUnknown_Vtbl::new::(),
+ ReadRaw: ReadRaw::,
+ AdviseRaw: AdviseRaw::