Definitions for the OPC defined Item Property Names.
Object Model
Syntax
C# | |
---|
public class PropertyNames |
Example
C# | Copy Code |
---|
string SrvUrl = "http://tswinc.us/XMLDADemo/ts_sim/OpcDaGateway.asmx";
private void btnPropertyNames_Click(object sender, System.EventArgs e)
{
XmlServer Srv = new XmlServer( SrvUrl );
try
{
//------------ browse the server with all properties
OPCError[] err ;
TreeNode[] tns = Srv.BrowseTree( null, "SimulatedData", null, true, true, out err );
foreach( TreeNode tn in tns )
{
BrowseElement be = (BrowseElement)tn.Tag;
if( be.IsItem )
{
foreach( ItemProperty ip in be.Properties )
{
if( ip.Name == PropertyNames.accessRights ) // access rights property
{
if( (string)ip.Value == xmldanet.AccessRightsValue.writable )
{
// this item is writable
}
}
else if( ip.Name == PropertyNames.euType ) // euType property
{
if( (string)ip.Value == xmldanet.euTypeValue.analog )
{
// is analog type
}
}
}
}
}
}
catch( Exception ex )
{
MessageBox.Show( ex.Message, "Exception in Browse" );
this.Close();
}
} |
Visual Basic | Copy Code |
---|
Dim sUrl As String = "http://tswinc.us/XMLDADemo/ts_sim/OpcDaGateway.asmx"
Private Sub btnPropertyNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPropertyNames.Click
Dim Srv As XmlServer = New XmlServer(sUrl)
Try
'------------ browse the server with all properties
Dim err As OPCError()
Dim tns As TreeNode() = Srv.BrowseTree(Nothing, "SimulatedData", Nothing, True, True, err)
Dim tn As TreeNode
For Each tn In tns
Dim be As BrowseElement = tn.Tag
If be.IsItem Then
Dim ip As ItemProperty
For Each ip In be.Properties
If ip.Name.Equals(PropertyNames.accessRights) Then ' access rights property
If (ip.Value = xmldanet.AccessRightsValue.writable) Then
' this item is writable
End If
End If
If ip.Name.Equals(PropertyNames.euType) Then ' euType property
If ip.Value = xmldanet.euTypeValue.analog Then
' is analog type
End If
End If
Next
End If
Next
Catch ex As Exception
MessageBox.Show(ex.Message, "Exception in Browse")
Me.Close()
End Try
End Sub |
Inheritance Hierarchy
Requirements
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows 7, Windows Server 2008 family
See Also