We have seen that in the virtual OPC-UA device we could repeatedly read the values of the variable "Sensor_Door_IsOpen".
However, we will not always know which variables or methods exist within a device. For example, a file service might list directories, or a database might expose tables whose names change.
For this purpose, the BRIDGE_BROWSE block exists, allowing you to query the internal structure of the connected device or service.
Why use BRIDGE_BROWSE?
The BRIDGE_BROWSE command is used to discover:
- Which variables are available.
- What data type each one has (Boolean, Double, String, etc.).
- Whether they are read-only, writable, or both.
- What methods or operations are exposed.
In other words, it is the capability map of the device.
Out of the 5 BRIDGER blocks, let's see what is obtained from BRIDGE_BROWSE:
- BRIDGE_READ
- BRIDGE_WRITE
- BRIDGE_SUBSCRIBE
- BRIDGE_BROWSE
- BRIDGE_CALL
BRIDGE_BROWSE runs automatically during the first connection, but it can also be invoked manually if you wish to explore a new device or verify what has changed.
Example Output (Debug or Canvas)
When executing BRIDGE_BROWSE, the middleware returns a hierarchical list of accessible variables:
Sensor_Motion_Detected: ns=1;i=1000 [Boolean] Sensor_Door_IsOpen: ns=1;i=1001 [Boolean] PIDControl_CurrentTemperature: ns=1;i=1002 [Double] PIDControl_Setpoint: ns=1;i=1003 [Double] (writable) PIDControl_PIDOutput: ns=1;i=1004 [Double] Device_Motor_Enabled: ns=1;i=1005 [Boolean] (writable) System_Battery_BatteryLevel: ns=1;i=1006 [Double] Device_Scale_Weight: ns=1;i=1007 [Double] Device_Scale_Trigger: ns=1;i=1008 [Boolean] (writable) Device_Piston_IsExtended: ns=1;i=1009 [Boolean] Device_Piston_Trigger: ns=1;i=1010 [Boolean] (writable) ...
Each line shows:
- The variable name.
- Its internal identifier (
ns=1;i=1000, typical in OPC-UA). - The data type.
- Whether it is writable (
(writable)). - Whether it is an executable method.
Using BRIDGE_BROWSE Manually
Before interacting with a new device, run BRIDGE_BROWSE once to understand its structure.
Afterward, you can use BRIDGE_READ, BRIDGE_WRITE, or BRIDGE_SUBSCRIBE accurately on the variables you have identified.
Example
SYSTEM {TYPE:PRE_RUN,TRIGGER:PRE_RUN}
SYSTEM {TYPE:OPTIONS, REAL_TIME:1}
Graphic {Type:TEXT,Name:Text1,X:653,Y:294}
Graphic {Type:TEXT,Name:TextError,X:440,Y:329,Text:"On error...."}
Initial options,{user:"user", pass:"1234"}
BRIDGER {NAME:bridge1,X:443,Y:405
,SERVER:"wss://bridger.gpss-plus.com:3000"
,CLIENT:"opc.tcp://opcua.gpss-plus.com:4840"
,OPTIONS:V$options
,on_error:bridge1_on_error
}
POSITION {NAME:POS1,X:209,Y:347}
START 1
;*****************************************************
PROCEDURE PRE_RUN
BRIDGE_BROWSE { NAME: bridge1
, TRIGGER: on_browse
}
TERMINATE_VE
ENDPROCEDURE
;*****************************************************
GENERATE 10,0,0,1 {NAME:GEN1,X:141,Y:351}
ADVANCE 5,0 {TO:POS1}
ENDGENERATE 1
;----------------------------------------------------------------------------
procedure on_browse
move {name:Text1,TEXT:"BROWSE P$(PARAM_A)"}
TERMINATE_VE
endprocedure
;----------------------------------------------------------------------------
procedure bridge1_on_error
move {name:TextError,TEXT:"P$PARAM_A"}
TERMINATE_VE
endprocedure