Skip to content

Commit

Permalink
Initial work on OPC-DA driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
riclolsen committed Jul 21, 2024
1 parent bc76d8c commit 11af4d9
Show file tree
Hide file tree
Showing 210 changed files with 61,187 additions and 0 deletions.
119 changes: 119 additions & 0 deletions src/opcdaaehda-client-solution-net/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 2.0.2

### Changes
- Added support of .NET 8.0
- Removed support of .NET 4.6.2 and .NET 4.7.2
- NuGet packages are now only distributed locally in the repository

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 2.0.1

### Changes
- Clarified license of the NuGet package (SCLA 1.0)

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 2.0.0

### Breaking Changes
- Splitted into 3 DLLs.
- Technosoftware.DaAeHdaClient.dll
- Technosoftware.DaAeHdaClient.Com.dll
- Technosoftware.OpcRcw.dll
- Connection to a server is now done differently. See examples!

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.4.1

### Changes
- Added .NET 7.0

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.4.0

### Changes
- Merged https://github.com/technosoftware-gmbh/opcua-solution-net-samples into this repository
- NuGet packages are now also GPL 3.0 or SCLA 1.0

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.3.0

### Breaking Changes
- removed support of .NET 5.0 because of end of life (see [here](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core))

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.6

### Changes
- Update to enable/disable DCOM call cancellation

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.5

### Fixed Issues
- Support of .NET 6.0

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.4

### Fixed Issues
- Added README to nuget package
- Changed lock for subscription to instance lock to increase performance. Might affect callback handling.

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.3

### Fixed Issues
- For OPC DA 2.0 only servers Subscription GetState() was called wrong. The OPC DA 3.0 version was used instead of the DA 2.0 version.

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.2

### Changes
- Added ApplicationInstance class containing Property TimAsUtc (from LicenseHandler) and InitializeSecurity
- InitializeSecurity can be used to set the authentication level to Integrity as requested in [KB5004442—Manage changes for Windows DCOM Server Security Feature Bypass (CVE-2021-26414)](https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c)

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.2.0

### Changes
- NuGet packages are now available under a commercial license

### Fixed Issues
- Issue #14: Fix Connect method(). It ended correctly even if connection is not established
- Issue #15: Disconnect() method is not executed correctly because of wrong implemented Dispose() methods.

### Refactoring
- Refactored Technosoftware.DaAeHdaClient.Da
- Refactored Technosoftware.DaAeHdaClient.Ae
- Refactored Technosoftware.DaAeHdaClient.Hda
- Removed OpcServerType class because it is not used at all

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.1.1

### Changes
- Changed copyright year
- Examples are now using the NuGet packages

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.1.0

### Enhancements
- Support of .NET 5.0
- Added nuget packages

-------------------------------------------------------------------------------------------------------------
## OPC DA/AE/HDA Solution .NET - 1.0.0902

### Enhancements
- Support of .NET Standard 2.1
- Also supported: .NET 4.8, .NET 4.7.2, .NET 4.6.2
- Support of OPC Classic Core Components 108.41
- Enhanced COM call tracing for OPC DA
- For missing required OPC Interfaces a NotSupportedException is thrown and for optional ones just an entry in the log created.

### Redistributables
- Redistributables are available [here](https://opcfoundation.org/developer-tools/samples-and-tools-classic/core-components/)


5 changes: 5 additions & 0 deletions src/opcdaaehda-client-solution-net/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Contribution

We strongly encourage community participation and contribution to this project. First, please fork the repository and commit your changes there. Once happy with your changes you can generate a 'pull request'.

You must agree to the contributor license agreement before we can accept your changes. The CLA and "I AGREE" button is automatically displayed when you perform the pull request. You can preview CLA [here](https://cla-assistant.io/technosoftware-gmbh/opcdaaehda-solution-net).
39 changes: 39 additions & 0 deletions src/opcdaaehda-client-solution-net/DaAeHdaNetStandard.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Technosoftware.DaAeHdaClient", "src\Technosoftware\DaAeHdaClient\Technosoftware.DaAeHdaClient.csproj", "{EEFD269C-B83E-4C9B-8F96-432FAD558B98}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{90E1FABC-FFC1-47D4-A7EF-99F4E2839AD9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Technosoftware.DaAeHdaClient.Com", "src\Technosoftware\DaAeHdaClient.Com\Technosoftware.DaAeHdaClient.Com.csproj", "{8756C220-19E3-4275-A1B3-DAEB81AEF184}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Technosoftware.OpcRcw", "src\Technosoftware\OpcRcw\Technosoftware.OpcRcw.csproj", "{3852C942-F26F-49D4-9FAB-4DEB8396DA61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EEFD269C-B83E-4C9B-8F96-432FAD558B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEFD269C-B83E-4C9B-8F96-432FAD558B98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEFD269C-B83E-4C9B-8F96-432FAD558B98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEFD269C-B83E-4C9B-8F96-432FAD558B98}.Release|Any CPU.Build.0 = Release|Any CPU
{8756C220-19E3-4275-A1B3-DAEB81AEF184}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8756C220-19E3-4275-A1B3-DAEB81AEF184}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8756C220-19E3-4275-A1B3-DAEB81AEF184}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8756C220-19E3-4275-A1B3-DAEB81AEF184}.Release|Any CPU.Build.0 = Release|Any CPU
{3852C942-F26F-49D4-9FAB-4DEB8396DA61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3852C942-F26F-49D4-9FAB-4DEB8396DA61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3852C942-F26F-49D4-9FAB-4DEB8396DA61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3852C942-F26F-49D4-9FAB-4DEB8396DA61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D398263E-3EFA-493B-94F3-F6271B79C4A6}
EndGlobalSection
EndGlobal
5 changes: 5 additions & 0 deletions src/opcdaaehda-client-solution-net/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<Import Project="targets.props" />
<Import Project="common.props" />
<Import Project="version.props" />
</Project>
26 changes: 26 additions & 0 deletions src/opcdaaehda-client-solution-net/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SOFTWARE LICENSE AGREEMENT

TECHNOSOFTWARE (THE "LICENSOR") IS WILLING TO LICENSE THE ACCOMPANYING SOFTWARE AND ASSOCIATED DOCUMENTATION INCLUDING AUTHORIZED COPIES OF EACH (THE "SOFTWARE") TO YOU ("LICENSEE") ONLY ON THE CONDITION THAT LICENSEE ACCEPTS ALL OF THE TERMS IN THIS AGREEMENT.

The licensed Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. The licensed Software is licensed, not sold. Technosoftware shall own all right, title and interest including the intellectual property rights in and to the information on bug fixes or error corrections relating to the licensed Software that are submitted by Licensee to Technosoftware as well as any intellectual property rights to the correction of any errors, if any.

PLEASE READ THE TERMS CAREFULLY BEFORE INSTALLING THE SOFTWARE. BY INSTALLING THE SOFTWARE, LICENSEE ACKNOWLEDGES THAT LICENSEE HAS READ AND UNDERSTANDS THIS AGREEMENT AND AGREES TO BE BOUND BY ITS TERMS AND CONDITIONS. THE EFFECTIVE DATE OF THIS AGREEMENT SHALL BE THE DATE UPON THE SOFTWARE WAS FIRST DELIVERED TO YOU OR FIRST DOWNLOADED BY YOU.

IF LICENSEE DOES NOT ACCEPT THESE LICENSE TERMS, THEN TECHNOSOFTWARE DOES NOT GRANT ANY LICENSE TO THE SOFTWARE, AND LICENSEE MUST NOT DOWNLOAD OR INSTALL THE SOFTWARE.

TECHNOSOFTWARE provides different licenses depending on the component and on the ownership of a purchased license of the user of the sources. A single ZIP file or a single repository can contain multiple components where the sources have different license models. The valid license is in the header of each source file.

Following are basic rules on how TECHNOSOFTWARE licenses the different components:

1. OPC DA/AE/HDA and OPC UA core components follow a dual-license model:
- Owner of a purchased license: [SCLA 1.0](licenses/Source_Code_License_Agreement.pdf)

enables Owner of a purchased license to deploy their applications using the core component sources without being required to disclose the application code.

- Users that are not Owner of a purchased license: [GPL 3.0](licenses/GPLv3License.txt)

Based on the GPL 3.0 license terms these users must disclose their application code when using the core component sources.

2. Samples and Utilities:

- All samples and most of the utilities are provided under the [MIT](licenses/MITLicense.txt) license for everyone.
18 changes: 18 additions & 0 deletions src/opcdaaehda-client-solution-net/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Technosoftware SDK" value="./nuget/packages" />
</packageSources>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<bindingRedirects>
<add key="skip" value="False" />
</bindingRedirects>
<packageManagement>
<add key="format" value="0" />
<add key="disabled" value="False" />
</packageManagement>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* IEC 60870-5-104 Server Protocol driver for {json:scada}
* {json:scada} - Copyright (c) 2024 - Ricardo L. Olsen
* This file is part of the JSON-SCADA distribution (https://github.com/riclolsen/json-scada).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Globalization;
using Technosoftware.DaAeHdaClient.Da;

namespace OPCDAClientDriver
{
partial class MainClass
{
/// <summary>
/// A delegate to receive data change updates from the server.
/// </summary>
/// <param name="subscriptionHandle">
/// A unique identifier for the subscription assigned by the client. If the parameter
/// <see cref="TsCDaSubscriptionState.ClientHandle">ClientHandle</see> is not defined this
/// parameter is empty.</param>
/// <param name="requestHandle">
/// An identifier for the request assigned by the caller. This parameter is empty if
/// the corresponding parameter in the calls Read(), Write() or Refresh() is not defined.
/// Can be used to Cancel an outstanding operation.
/// </param>
/// <param name="values">
/// <para class="MsoBodyText" style="MARGIN: 1pt 0in">The set of changed values.</para>
/// <para class="MsoBodyText" style="MARGIN: 1pt 0in">Each value will always have
/// item’s ClientHandle field specified.</para>
/// </param>
public static void OnDataChangeEvent(object subscriptionHandle, object requestHandle, TsCDaItemValueResult[] values)
{
Log(string.Format("----------------------------------------------------------- DataChange: {0}", values.Length));
if (requestHandle != null)
{
Log("DataChange() for requestHandle :" + requestHandle.GetHashCode().ToString());
}
for (var i = 0; i < values.Length; i++)
{

string strHandle = string.Format("{0}", values[i].ClientHandle);
// Console.Write(" Client Handle : "); Console.WriteLine(values[i].ClientHandle);
if (values[i].Result.IsSuccess() && values[i].Value != null)
{
if (values[i].Value.GetType().IsArray)
{
for (var j = 0; j < values.Length; j++)
{
Log($"{MapHandlerToConnName[strHandle]} - Change: {MapHandlerToItemName[strHandle]} Val[{j}]: " + string.Format("{0}", values[j].Value));
}
Log($"{MapHandlerToConnName[strHandle]} - Change: {MapHandlerToItemName[strHandle]} TS: " + values[i].Timestamp.ToString(CultureInfo.InvariantCulture));
Log($"{MapHandlerToConnName[strHandle]} - Change: {MapHandlerToItemName[strHandle]} Q: " + values[i].Quality);
}
else
{
var valueResult = values[i];
//var quality = new TsCDaQuality(193);
//valueResult.Quality = quality;
//var message =
// $"\r\n Quality: is not good : {valueResult.Quality} Code:{valueResult.Quality.GetCode()} LimitBits: {valueResult.Quality.LimitBits} QualityBits: {valueResult.Quality.QualityBits} VendorBits: {valueResult.Quality.VendorBits}";
//if (valueResult.Quality.QualityBits != TsDaQualityBits.Good && valueResult.Quality.QualityBits != TsDaQualityBits.GoodLocalOverride)
//{
// Log(message);
//}

Log($"{MapHandlerToConnName[strHandle]} - Change: {MapHandlerToItemName[strHandle]} Val: {values[i].Value} Q: {values[i].Quality} TS: {values[i].Timestamp.ToString(CultureInfo.InvariantCulture)}");
}
}
//Console.Write(" Result : "); Console.WriteLine(values[i].Result.Description());
}
Log("----------------------------------------------------------- End");
}
}
}
Loading

0 comments on commit 11af4d9

Please sign in to comment.