-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathExtensions.cs
More file actions
27 lines (22 loc) · 972 Bytes
/
Extensions.cs
File metadata and controls
27 lines (22 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
using Opc.Da;
namespace BootstrapBlazor.OpcDa;
/// <summary>
/// 扩展方法类
/// </summary>
internal static class Extensions
{
public static Quality ToQuality(this Opc.Da.Quality quality)
{
return quality.QualityBits == qualityBits.good
? Quality.Good
: Quality.Bad;
}
public static IOpcSubscription ToOpcSubscription(this ISubscription subscription)
{
return new OpcSubscription(subscription);
}
public static ISubscription CreateSubscription(this Server server, string name, int updateRate = 1000, bool active = true) => server.CreateSubscription(new SubscriptionState { Name = name, Deadband = 0, UpdateRate = updateRate, Active = active });
}