Viewer XML Details

Introduction

viewer.xml defines the views available to the Viewer tool. The elements in the XML define the user interface and layout as rendered in the View.

Data Record Sources

Viewer elements can use data record fields to update their value. The data record, as defined in record.xml, defines data fields referenced by the s attribute.

The viewer elements also use the s attribute to reference the data record fields defined in record.xml. If the data record contains no field with the given s attribute, the element will not be rendered in the Viewer.

Setters

In order to write a value to the hardware, a setter is used. For example, the setter for a digital output is "OB%r,%n". The symbol %r is replaced by GDK with a range value. The symbol %n is replaced by GDK with the value to be set.

The following is a list of symbols replaced by GDK. Only symbols used by the Viewer tool are shown here.

SymbolMeaningExampleExample after Substitution
%nValue to set."OB%r,%n"OB0,1
%rA range argument inferred from the value type of the data record field starting from the optional <r> tag."OB%r,%n"OB0,1

Getters and Non-Data Record Sources

A view can be configured to poll a non-data record source at a regular interval. This is done with the use of a getter. For example, the getter for the currently executing line number of thread zero is "MG{Z10}_XQ0".

See Examples of Polled View Elements for examples of using polled commands in place of data record sources.

The Element Tags


<viewer version="3.0">

This is the XML root element. It contains the version of the viewer syntax.


<views>

<views key="DMC40_0, DMC50_0, DMC41_3, DMC18_6, DMC18_2, DMC21_2, DMC30_0, DMC31_0, DMC42_0, DMC52_0">

Defines a group of views.


<view>

<view i="A" name="Axis A">

Defines a single view for rendering in a viewer tab.

The <view> element has one mandatory attribute, name. This is the name used to reference the view.


<v>

<v title="Profiler">

All elements within a <v> element are placed in the view in a vertical, top-to-bottom layout.

The optional attribute title causes the contents to be enclosed in a group box with the value of the title as the group box title. An empty string will provide a group box without a title.

In the absence of an <h> or <v> element, all elements are laid out first in a horizontal, left-to-right layout. If the view area is too narrow to accomodate all the elements, the layout wraps top-to-bottom. This allows the Viewer to dock well in either format.


<h>

<h title="I/O">

All elements within an <h> element are placed in the view in a non-breaking, horizontal, left-to-right layout.

The optional attribute title causes the contents to be enclosed in a group box with the value of the title as the group box title. An empty string will provide a group box without a title.

In the abscence of an <h> or <v> element, all elements are laid out first in a horizontal, left-to-right layout. If the view area is too narrow to accomodate all the elements, the layout wraps top-to-bottom. This allows the Viewer to dock well in either format.


<vr />

<vr />

Draws a vertical rule.


<hr />

<hr />

Draws a horizontal rule.


<value>

<value s="_RPE" animation="motor" />

Displays the scaled value of a data record field. The field's description is printed along with the scaled value. If the field has a value map, the label will be two lines. The second line will show the appropriate mapped string for the current unscaled value.

The attribute s provides the data record field source from record.xml. Values can also be polled.

The optional attribute animation allows for an animated indicator. The valid values for this attribute are the following.

  • "motor" displays a rotating circle to indicate a motor. The circle turns whenever the value changes.

<motion>

<motion s="AXISA" />

Provides a graphical representation of the axis status data. This element is designed specifically for this particular field, namely AXISA, AXISB, AXISC, AXISD, AXISE, AXISF, AXISG, and AXISH.

The mandatory attribute s provides the data record field source from record.xml.


<led>

<led s="_LFA" type="error" invert="true">

Displays the value of a data record field as an array of soft LEDs. The number of LEDs displayed is dependent on the data type of the data record field.

The attribute s provides the data record field source from record.xml. Values can also be polled.

The optional attribute type changes the behavior of the LED(s). The valid values for this attribute are the following.

  • "error" displays the active state of the LED in a different color to differentiate error state from others.

The optional attribute invert changes the behavior of the LED(s) by inverting the active state.


<scale>

<scale s="_TTA"/>

Displays the scaled value of a data record field on a linear scale similar to an analog thermometer.

The attribute s provides the data record field source from record.xml. Values can also be polled.

The optional attribute orientation changes the look of the scale. The valid values for this attribute are the following.

  • "vertical" displays the scale vertically
  • "horizontal" displays the scale horizontally. This is the default if no attribute is provided.

<lcd>

<lcd s="_TPA" />

Displays the scaled value of a data record field in a retro-looking LCD style similar to a digital readout (DRO).

The attribute s provides the data record field source from record.xml. Values can also be polled.


<s>

<led s="_OP2" i="O2">
  <s>"OB%r,%n"</s>
  <r>17</r>          
</led>

Defines the setter for bidirectional UI elements.


<r>

<led s="_OP2" i="O2">
  <s>"OB%r,%n"</s>
  <r>17</r>          
</led>

Defines the minimum value for the %r symbol in the setter tag. The maximum value is inferred from the type of the date in record.xml.


<min>

<scale>
  <g>"MG@AN[8]"</g>
  <d>"Polled Analog Input"</d>
  <min>-10.0</min>
  <max>10.0</max>
</scale>

Defines the minimum value for the viewer element. If omitted, the range is determined from the data type.


<max>

<scale s="_LMS" orientation="vertical" key="DMC30_0, DMC31_0, EDD37_0">
  <max>31</max>
</scale>

Defines the maximum value for the viewer element. If omitted, the range is determined from the data type.

The led element uses this value to set the number of soft LEDs displayed for polled values.

The scale element uses this value to limit the graphical extent of the scale when the operational values are smaller than the data record value size.

Examples of Polled View Elements

Alternatively, a g getter element may be provided to define the command to be polled. When using g, use the d tag to specify the value description.

  <view name="Polled"> 
    <v title="Polled View Elements">
    
      <value>
        <g>"MG{Z10}_XQ0"</g>
        <d>"Thread 0 Line number"</d>
      </value>
     
      <value>
        <g>"IA?"</g>
        <d>"IP Address"</d>
      </value>
    
      <led>
        <g>"MG{Z1}@IN[81]"</g>
        <d>"Axis A Aux Encoder Input (AA)"</d>
      </led>
      
      <led>
        <g>"TB"</g>
        <d>"Tell Status Byte"</d>
        <max>255</max>
      </led>
      
      <lcd>
        <g>"MG{Z10}_PVA"</g>
        <d>"PVT Segment Space"</d>
      </lcd>
   
      <v title="Analog Input 8 (NOT in DR if axes &lt; 8)">
        <scale>
          <g>"MG@AN[8]"</g>
          <d>"Polled Analog Input"</d>
          <min>-10.0</min>
          <max>10.0</max>
        </scale>
      </v>
      
    </v> 
  </view>