iml6yu.DataService.OpcUa
1.2.5
dotnet add package iml6yu.DataService.OpcUa --version 1.2.5
NuGet\Install-Package iml6yu.DataService.OpcUa -Version 1.2.5
<PackageReference Include="iml6yu.DataService.OpcUa" Version="1.2.5" />
<PackageVersion Include="iml6yu.DataService.OpcUa" Version="1.2.5" />
<PackageReference Include="iml6yu.DataService.OpcUa" />
paket add iml6yu.DataService.OpcUa --version 1.2.5
#r "nuget: iml6yu.DataService.OpcUa, 1.2.5"
#:package iml6yu.DataService.OpcUa@1.2.5
#addin nuget:?package=iml6yu.DataService.OpcUa&version=1.2.5
#tool nuget:?package=iml6yu.DataService.OpcUa&version=1.2.5
iml6yu.DataService.OpcUa
iml6yu.DataService.OpcUa is a .NET library for OPCUA server data.
license
MIT License
Copyright (c) 2021 iml6yu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
用法
ILogger logger;
DataServiceOpcUaOption option = builder.Configuration.GetSection("option").Get<DataServiceOpcUaOption>();
var dataService = new DataServiceOpcUa(option, logger);
//启动Slave服务
dataService.StartServicer(token);
//停止服务
dataService?.StopServicer();
依赖
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
配置
{
"option": {
"IPAddress": "localhost",
"Port": 4840,
"ServiceName": "Test",
"Storages": [
{
"Id": "DataServiceTest001",
"Heart": {
"HeartType": "Number",
"HeartAddress": "ns=2;HeartNumber",
"HeartInterval": 1000
},
"DefaultValues": [
{
"Address": "ns=2;TestBoolean1",
"DefaultValue": true,
"ValueType": "Boolean"
},
{
"Address": "ns=2;TestBoolean2",
"DefaultValue": true,
"ValueType": "Boolean"
},
{
"Address": "ns=2;TestInt1",
"DefaultValue": 1,
"ValueType": "Int32"
},
{
"Address": "ns=2;TestInt2",
"DefaultValue": 1,
"ValueType": "Int64"
},
{
"Address": "ns=2;TestDouble1",
"DefaultValue": 1.0001234,
"ValueType": "Double"
},
{
"Address": "ns=2;TestFloat1",
"DefaultValue": 1.1234321,
"ValueType": "Single"
},
{
"Address": "ns=2;TestDateTime",
"DefaultValue": "2020-01-01 00:00:01",
"ValueType": "DateTime"
},
{
"Address": "ns=2;TestString",
"DefaultValue": "iml6yu",
"ValueType": "String"
}
]
}
]
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
源码
- DataServiceOpcUaOption (一个数据服务的配置)
- 源码
public class DataServiceOpcUaOption : Core.Configs.DataServiceOption<string>
{
/// <summary>
/// 地址 默认localhost
/// </summary>
public string IPAddress { get; set; } = "localhost";
/// <summary>
/// 默认端口4840
/// </summary>
public int Port { get; set; } = 4840;
}
最后
如果在使用过程中遇到任何bug或者困难,可以添加WeChat或者是Microsoft Teams
| Microsoft Teams | |
|---|---|
| Join Us |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- iml6yu.DataService.Core (>= 1.2.1)
- OPCFoundation.NetStandard.Opc.Ua.Server (>= 1.5.377.22)
-
net8.0
- iml6yu.DataService.Core (>= 1.2.1)
- OPCFoundation.NetStandard.Opc.Ua.Server (>= 1.5.377.22)
-
net9.0
- iml6yu.DataService.Core (>= 1.2.1)
- OPCFoundation.NetStandard.Opc.Ua.Server (>= 1.5.377.22)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.