File tree Expand file tree Collapse file tree
src/extensions/BootstrapBlazor.OpcDa Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33// Website: https://www.blazor.zone or https://argozhang.github.io/
44
5+ using Opc . Da ;
6+
57namespace BootstrapBlazor . OpcDa ;
68
79/// <summary>
@@ -59,4 +61,20 @@ public interface IOpcDaServer : IDisposable
5961 /// <param name="items"></param>
6062 /// <returns></returns>
6163 HashSet < OpcWriteItem > Write ( params HashSet < OpcWriteItem > items ) ;
64+
65+ /// <summary>
66+ /// 浏览 OPC Server 中的位号 (即数据项或者标签)
67+ /// </summary>
68+ /// <param name="name"></param>
69+ /// <param name="filters"></param>
70+ /// <param name="position"></param>
71+ /// <returns></returns>
72+ BrowseElement [ ] Browser ( string name , BrowseFilters filters , out BrowsePosition position ) ;
73+
74+ /// <summary>
75+ /// 浏览 OPC Server 中的位号 (即数据项或者标签)
76+ /// </summary>
77+ /// <param name="position"></param>
78+ /// <returns></returns>
79+ BrowseElement [ ] BrowserNext ( ref BrowsePosition position ) ;
6280}
Original file line number Diff line number Diff line change @@ -48,6 +48,39 @@ public bool Connect(string serverName)
4848 return IsConnected ;
4949 }
5050
51+ /// <summary>
52+ /// <inheritdoc/>
53+ /// </summary>
54+ /// <param name="name"></param>
55+ /// <param name="filters"></param>
56+ /// <param name="position"></param>
57+ /// <returns></returns>
58+ public BrowseElement [ ] Browser ( string name , BrowseFilters filters , out BrowsePosition position )
59+ {
60+ if ( _server is not { IsConnected : true } )
61+ {
62+ throw new InvalidOperationException ( "OPC Server is not connected." ) ;
63+ }
64+
65+ return _server . Browse ( new ItemIdentifier ( name ) , filters , out position ) ;
66+ }
67+
68+ /// <summary>
69+ /// <inheritdoc/>
70+ /// </summary>
71+ /// <param name="position"></param>
72+ /// <returns></returns>
73+ public BrowseElement [ ] BrowserNext ( ref BrowsePosition position )
74+ {
75+ if ( _server is not { IsConnected : true } )
76+ {
77+ throw new InvalidOperationException ( "OPC Server is not connected." ) ;
78+ }
79+
80+
81+ return _server . BrowseNext ( ref position ) ;
82+ }
83+
5184 /// <summary>
5285 /// 断开连接方法
5386 /// </summary>
You can’t perform that action at this time.
0 commit comments