Browse all the fields of a point
- Last UpdatedApr 08, 2026
- 2 minute read
This scenario guides you through the steps required to browse all the fields of a point.
To identify the code associated with each step, see the code comments in the Example code sections.
To browse all the fields of a point
- Open the Program.cs file from the created project.
- Add the following private global variables that will be processed in the callback:
- AutoResetEvent waitHandle = new AutoResetEvent(false);
- Create the status connection callback method to process the status of the connection call.
- Create the browse callback method to process the browse call by doing the following:
- Handle the output of the data returned by the browse callback method if there are no errors.
- Set the state of the event to signal after processing the browse callback.
- Verify that the Data Access Layer (DAL) service has initialized.
- Get the global connection.
- Block the current thread until the current instance receives a signal or the timeout expires.
- Reset the global AutoResetEvent waitHandle variable.
- Browse the topic information in the RealTime database (RTDB).
- Block the current thread until the current instance receives a signal or the timeout expires.
Example code
The following example code details creating the status connection callback.
private void StatusConnectionCallback(BaseMessage response)
{
switch (response.MessageType)
{
case DALMessageType.ConnectionDisconnectedNotification:
Console.WriteLine("Subscriber:Connection disconnected from the driver.");
break;
case DALMessageType.ConnectionEstablishedNotification:
Console.WriteLine("Subscriber:Connection established with the driver.");
break;
case DALMessageType.DataSourceConnectionNotification:
Console.WriteLine("Subscriber:Connection established with pubsub.");
waitHandle.Set();
break;
case DALMessageType.ConnectionTimeoutNotification:
Console.WriteLine("Subscriber:Connection timed out.");
break;
default:
Console.WriteLine("Subscriber:Unknown Connection notification: " + response.MessageType.ToString());
break;
}
}The following example code details creating the browse callback method to process the browse call.
private void BrowseCallback(String nodeName, String filterRegExp, DataSet data, DALPSBrowseStatus browseStatus, DALResponseStatus dalResponseStatus, Object clientObject, String failureReason)
{
// Handle the ouput of the data returned by the browse callback method if there are no errors.
if (browseStatus == DALPSBrowseStatus.Success)
{
foreach (DataRow curRow in data.Tables[0]?.Rows)
{
Console.WriteLine(curRow.ItemArray[0]);
}
}
else
{
Console.WriteLine("BrowseCallback: Failed to browse attribute due to " + failureReason);
}
// Set the state of the event to signal after processing the browse callback.
waitHandle.Set();
}The following example code details browsing the topic information in the RTDB.
internal void Browse()
{
try
{
// Verify that the DAL service has initialized.
if (DALService.IsInitialized == false)
{
DALService.Initialize();
}
var statusConnectionDelegate = new DALConnectionStatusCallBackMethod(SubConnectionCallback);
var browseDelegate = new DALPSConnection.DALPSBrowseDelegate(BrowseCallback);
// Get the global connection.
var psSubConn = DALPSClient.GetGlobalConnection("common", statusConnectionDelegate);
// Block the current thread until the current instance receives a signal or the timeout expires.
waitHandle.WaitOne(TimeSpan.FromSeconds(10));
if (psSubConn.IsConnected)
{
var topic = "analog.AutoCommandAnalog01";
// Reset the global AutoResetEvent waitHandle.
waitHandle = new AutoResetEvent(false);
// Browse the topic information in the RTDB.
psSubConn.Browse(topic, "", browseDelegate, this);
// Block the current thread until the current instance receives a signal or the timeout expires.
waitHandle.WaitOne(TimeSpan.FromSeconds(15));
}
}
catch (Exception e)
{
Console.WriteLine("Error:" + e.Message);
}
}