Skip to content

Conversation

@Ronbb
Copy link
Owner

@Ronbb Ronbb commented Apr 20, 2025

Summary by CodeRabbit

  • New Features

    • Introduced new OPC Data Access interface definitions, supporting enhanced server enumeration and property handling.
    • Added new interfaces for GUID enumeration and advanced server list management.
    • Expanded set of OPC constants for properties, types, and behaviors.
  • Refactor

    • Updated and modernized OPC Common interface definitions for improved clarity and documentation.
    • Replaced and renamed interface files for consistency.
  • Chores

    • Added NOTICE and LICENSE files to clarify licensing and third-party attributions.

@coderabbitai
Copy link

coderabbitai bot commented Apr 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update restructures and modernizes the OPC Data Access (DA) interface definitions and their bindings. It removes the old OPCDA_3.00.idl file and introduces a new, comprehensive opcda.idl with updated and expanded OPC DA 3.00 interface declarations. The OPC Common IDL (OPCComn.idl) is revised to improve documentation, update interface formatting, and add new interfaces (IOPCEnumGUID, IOPCServerList2). The Rust bindings are extended to include these new interfaces and related constants. Build scripts and source includes are updated to use the new file names. Additionally, license and notice files are added to clarify legal terms and third-party content.

Changes

File(s) Change Summary
opc_da_bindings/.metadata/OPCComn.idl Reformatted and updated OPC Common interface definitions; improved documentation; added placeholders for asynchronous UUIDs; added new interfaces IOPCEnumGUID and IOPCServerList2; updated type library declaration and imports.
opc_da_bindings/.metadata/OPCDA_3.00.idl Removed the file. All OPC DA 3.00 interface, structure, constant, and type library declarations are deleted.
opc_da_bindings/.metadata/opcda.idl Added a new, comprehensive IDL file defining OPC DA 3.00 interfaces, structures, enumerations, constants, category IDs, and the type library.
opc_da_bindings/.metadata/generate.proj Updated IDL and header file references from uppercase (OPCDA_3.00.idl, OPCComn.idl) to lowercase (opcda.idl, opccomn.idl).
opc_da_bindings/.metadata/main.cpp Changed header includes from uppercase (OPCComn.h, OPCDA_3.00.h) to lowercase (opccomn.h, opcda.h).
opc_da_bindings/src/bindings.rs Added Rust COM bindings for IOPCEnumGUID and IOPCServerList2; implemented their vtables and traits; added new and updated OPC constants for properties, types, and behaviors; corrected values for OPC_ENUM_PRIVATE and OPC_ENUM_PUBLIC.
LICENSE Added the MIT License text.
NOTICE Added a notice listing OPC Foundation files included in the project and their license terms.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant IOPCServerList2
    participant IOPCEnumGUID

    Client->>IOPCServerList2: EnumClassesOfCategories(...)
    IOPCServerList2-->>Client: IOPCEnumGUID

    Client->>IOPCEnumGUID: Next/Skip/Reset/Clone
    IOPCEnumGUID-->>Client: GUIDs / status

    Client->>IOPCServerList2: GetClassDetails(clsid)
    IOPCServerList2-->>Client: ProgID, UserType, VerIndProgID

    Client->>IOPCServerList2: CLSIDFromProgID(ProgID)
    IOPCServerList2-->>Client: CLSID
Loading

This diagram illustrates the enhanced OPC server enumeration and class detail retrieval using the new IOPCServerList2 and IOPCEnumGUID interfaces.

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75b1c3f and 7a92495.

📒 Files selected for processing (1)
  • LICENSE (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (5)
opc_da_bindings/.metadata/generate.proj (2)

9-10: Keep naming convention consistent between WinMD output and inputs

You switched all inputs to lower‑case (opcda.idl, opccomn.idl) but the produced WinMD is still OPCDA.winmd (upper‑case).
While the file will be generated, the mixed‑case naming could cause confusion and grepping difficulties. Consider renaming to opcda.winmd for symmetry, or add a comment explaining the deliberate deviation.


9-10: Missing explicit %(Identity) wildcard prevents incremental builds

Hard‑coding two filenames inside the same <Idls> and <Headers> item means MSBuild can’t track changes individually; a touch to one IDL forces regeneration of both headers/winmds.
Define them as two separate Idl items – or use the built‑in %(Identity) metadata – to enable incremental recompilation.

-    <Idls Include="opcda.idl;opccomn.idl" />
+    <Idls Include="opcda.idl" />
+    <Idls Include="opccomn.idl" />
opc_da_bindings/.metadata/OPCComn.idl (2)

124-131: Fix typos in documentation comments

impelmentedimplemented; small polish but it appears in a public‑facing spec header.

-// system configurations. IOPCEnumGUID is impelmented
+// system configurations. IOPCEnumGUID is implemented

195-239: Consider exposing async interfaces or remove commented stubs

Commented‑out async interfaces (// interface AsyncIOPCServerList2;, etc.) clutter the type‑library section. Either:

  1. Provide real async UUIDs & definitions, or
  2. Remove the commented stubs to keep the IDL concise.

Leaving placeholders risks confusion in downstream bindings.

opc_da_bindings/.metadata/opcda.idl (1)

665-670: Spelling / naming consistency in OnWriteComplete parameters

The parameter is spelled hrMastererr, unlike hrMastererror used in the two previous callbacks.
Although purely cosmetic, this breaks the otherwise consistent public interface and can trip code generators.

-[in]                   HRESULT    hrMastererr, 
+[in]                   HRESULT    hrMastererror, 
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d6101d and 6677c9e.

📒 Files selected for processing (6)
  • opc_da_bindings/.metadata/OPCComn.idl (1 hunks)
  • opc_da_bindings/.metadata/OPCDA_3.00.idl (0 hunks)
  • opc_da_bindings/.metadata/generate.proj (1 hunks)
  • opc_da_bindings/.metadata/main.cpp (1 hunks)
  • opc_da_bindings/.metadata/opcda.idl (1 hunks)
  • opc_da_bindings/src/bindings.rs (8 hunks)
💤 Files with no reviewable changes (1)
  • opc_da_bindings/.metadata/OPCDA_3.00.idl
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: analyzing
🔇 Additional comments (14)
opc_da_bindings/.metadata/main.cpp (1)

3-4: Confirm header‑case strategy for cross‑platform builds

Changing OPCComn.hopccomn.h and OPCDA_3.00.hopcda.h is fine on Windows (case‑insensitive) but will break *nix cross‑compiles if the physical filenames are still mixed‑case.
Double‑check the actual filenames emitted by MIDL / winmd‑generator and make sure CI (or future users) compiling on case‑sensitive filesystems won’t hit a No such file error.

Suggest adding a Linux‑container build to the pipeline to catch this class of issue early.

opc_da_bindings/.metadata/OPCComn.idl (1)

142-147: Attributes on Next out‑array are inconsistent with count parameter

Next uses [size_is(celt), length_is(*pceltFetched)].
The standard pattern for enumerators is [size_is(celt), length_is(celtFetched)] (without pointer indirection) to avoid dereferencing a null pceltFetched.
Confirm that the Win32 headers generated by midlrt match the intended signature.

opc_da_bindings/src/bindings.rs (12)

1943-2085: Good addition of the IOPCEnumGUID interface

This adds a standard COM-style enumeration interface specifically for GUIDs with the expected methods: Next, Skip, Reset, and Clone. The implementation follows the proper Rust COM binding patterns with appropriate vtable structures and trait definitions.


4326-4516: Well-structured implementation of IOPCServerList2

The new IOPCServerList2 interface properly extends the server list capabilities with methods for enumerating server classes, getting class details (with the added version-independent ProgID parameter), and converting ProgIDs to CLSIDs. The implementation correctly uses the new IOPCEnumGUID interface rather than the generic IEnumGUID.


5009-5011: Added appropriate consistency window state constants

These string constants for consistency window states align with the updated OPC DA specification.


5017-5019: Swapped enum scope values to match updated specification

The values for OPC_ENUM_PRIVATE (changed from 5 to 4) and OPC_ENUM_PUBLIC (changed from 4 to 5) have been swapped to match the updated enumeration scope definitions in the new IDL.


5038-5038: Added property ID and description for consistency window

This property addition aligns with the updated OPC DA specification.

Also applies to: 5057-5058


5040-5040: Added property ID and description for data filter value

The data filter value property is properly defined with appropriate ID and description.

Also applies to: 5061-5062


5106-5107: Added dictionary properties

Dictionary and Dictionary ID properties are now properly included in the bindings.

Also applies to: 5068-5069


5127-5129: Added type system property definitions

Type Description, Type ID, and Type System ID properties have been properly added with appropriate constants and descriptions.

Also applies to: 5093-5097


5130-5131: Added item identifier properties

Unconverted Item ID and Unfiltered Item ID properties have been properly added with appropriate constants and descriptions.

Also applies to: 5098-5101


5133-5133: Added write behavior property definition

The Write Behavior property is now properly defined with appropriate ID and description.

Also applies to: 5103-5104


5159-5160: Added type system string constants

OPCBinary and XMLSchema type system string constants have been added to support the updated specification.


5162-5164: Added write behavior descriptor constants

"All or Nothing" and "Best Effort" write behavior string constants properly complement the write behavior property.

Comment on lines +216 to +219
interface IOPCCommon;
interface IOPCShutdown;
interface IOpcServerList;
interface IOPCServerList2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Interface name case‑mismatch will break MIDL builds

In the type‑library section the declaration uses IOpcServerList, but the interface defined above is IOPCServerList (upper‑case “PC”). MIDL treats identifiers as case‑sensitive inside IDL.

-   interface IOpcServerList;
+   interface IOPCServerList;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
interface IOPCCommon;
interface IOPCShutdown;
interface IOpcServerList;
interface IOPCServerList2;
interface IOPCCommon;
interface IOPCShutdown;
interface IOPCServerList;
interface IOPCServerList2;

Comment on lines +140 to +156
typedef [unique] IOPCEnumGUID * LPOPCENUMGUID;

HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] GUID * rgelt,
[out] ULONG * pceltFetched
);

HRESULT Skip(
[in] ULONG celt
);

HRESULT Reset();

HRESULT Clone(
[out] IOPCEnumGUID **ppenum
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Place typedefs outside the interface definition

typedef [unique] IOPCEnumGUID * LPOPCENUMGUID; is nested inside interface IOPCEnumGUID.
Although MIDL allows it, several compilers and language bindings (Rust/Bindgen, midlrt) ignore nested typedefs, leading to the pointer alias being unavailable.

Move it above the interface block:

-[
-    object,
-    ...
-]
-typedef [unique] IOPCEnumGUID * LPOPCENUMGUID;
-interface IOPCEnumGUID : IUnknown
+typedef [unique] IOPCEnumGUID * LPOPCENUMGUID;
+[
+    object,
+    ...
+]
+interface IOPCEnumGUID : IUnknown
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
typedef [unique] IOPCEnumGUID * LPOPCENUMGUID;
HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] GUID * rgelt,
[out] ULONG * pceltFetched
);
HRESULT Skip(
[in] ULONG celt
);
HRESULT Reset();
HRESULT Clone(
[out] IOPCEnumGUID **ppenum
);
// Move this typedef above the interface declaration:
typedef [unique] IOPCEnumGUID * LPOPCENUMGUID;
[
object,
...
]
interface IOPCEnumGUID : IUnknown
{
HRESULT Next(
[in] ULONG celt,
[out, size_is(celt), length_is(*pceltFetched)] GUID * rgelt,
[out] ULONG * pceltFetched
);
HRESULT Skip(
[in] ULONG celt
);
HRESULT Reset();
HRESULT Clone(
[out] IOPCEnumGUID **ppenum
);
};

Comment on lines +968 to +971
[
uuid(8E368666-D72E-4f78-87ED-647611C61C9F),
pointer_default(unique)
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add the [object] attribute so the interface is recognised as COM

Every other interface is declared with [object, uuid, …].
Without [object], IOPCGroupStateMgt2 is generated as a plain C struct and the v‑table isn’t emitted, preventing clients from QueryInterface‑ing for it.

-[
-    uuid(8E368666-D72E-4f78-87ED-647611C61C9F),
-    pointer_default(unique)
-]
+[
+    object,
+    uuid(8E368666-D72E-4f78-87ED-647611C61C9F),
+    pointer_default(unique)
+]

Comment on lines +858 to +860
[in, string] LPWSTR szItemID,
[in,out, string] LPWSTR* pszContinuationPoint,
[in] DWORD dwMaxElementsReturned,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

[string] cannot be applied to a double‑indirection parameter

pszContinuationPoint is an LPWSTR*. In MIDL the [string] attribute is valid for a single NUL‑terminated character array (e.g. LPWSTR), not for a pointer‑to‑pointer.
Keeping the attribute here produces midl : error MIDL2025 : syntax error : expecting a type specification.

-[in,out, string]               LPWSTR*            pszContinuationPoint,
+[in,out]                       LPWSTR*            pszContinuationPoint,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[in, string] LPWSTR szItemID,
[in,out, string] LPWSTR* pszContinuationPoint,
[in] DWORD dwMaxElementsReturned,
[in, string] LPWSTR szItemID,
[in,out] LPWSTR* pszContinuationPoint,
[in] DWORD dwMaxElementsReturned,

Comment on lines +295 to +301
typedef enum tagOPCBROWSEFILTER
{
OPC_BROWSE_FILTER_ALL = 1,
OPC_BROWSE_FILTER_BRANCHES,
OPC_BROWSE_FILTER_ITEMS,
}
OPCBROWSEFILTER;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove the trailing comma to avoid a MIDL syntax error

OPCBROWSEFILTER is the only enumeration that ends with a trailing comma (OPC_BROWSE_FILTER_ITEMS,).
While C compilers accept this, midl.exe flags it as a syntax error.

 typedef enum tagOPCBROWSEFILTER 
 {
     OPC_BROWSE_FILTER_ALL = 1,
     OPC_BROWSE_FILTER_BRANCHES,
-    OPC_BROWSE_FILTER_ITEMS,
+    OPC_BROWSE_FILTER_ITEMS
 }
 OPCBROWSEFILTER;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
typedef enum tagOPCBROWSEFILTER
{
OPC_BROWSE_FILTER_ALL = 1,
OPC_BROWSE_FILTER_BRANCHES,
OPC_BROWSE_FILTER_ITEMS,
}
OPCBROWSEFILTER;
typedef enum tagOPCBROWSEFILTER
{
OPC_BROWSE_FILTER_ALL = 1,
OPC_BROWSE_FILTER_BRANCHES,
OPC_BROWSE_FILTER_ITEMS
}
OPCBROWSEFILTER;

@Ronbb Ronbb merged commit a10d787 into master Apr 20, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants