MSLNZ / equipment-register-schema

XML Schema Definition (XSD) for an Equipment Register
https://mslnz.github.io/equipment-register-schema/
0 stars 0 forks source link

whether to add a connection element #3

Closed jborbely closed 4 months ago

jborbely commented 1 year ago

This issue will discuss whether <equipment> should have a <connection> child.

If yes, then <connection> should always exist, but may be empty.

One way to define <connection> is

<xsd:element name="connection" type="msl:custom" minOccurs="0">

Some examples how one could implement <connection> are

<connection/>  <!-- empty -->
<connection>
    <baudRate>115200</baudRate> 
    <dataBits>7</dataBits>
</connection>
<connection>
    <ipAddress>192.168.1.100</address>
    <port>5000</port>
    <macAddress>12:B2:14:F6:E7:40</macAddress>
    <readTermination>\r</readTermination>
    <writeTermination>\r</writeTermination>
</connection>

Using type msl:custom (essentially xsd:any) as the base type may be too unstructured. For example, we could specify some required elements, like <address>, so that people can rely on some basic structure and then dump anything else in <properties>

<xsd:element name="connection">
    <xsd:complexType>
        <xsd:sequence minOccurs="0" maxOccurs="1">
            <xsd:element name="address" type="xsd:string"/>
            <xsd:element name="properties" type="msl:custom"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

The above examples would then become

<connection>
    <address/>  <!-- COM port numbers change too often, leave empty -->
    <properties> <!-- but these are static and useful for everyone to know -->
        <baudRate>115200</baudRate> 
        <dataBits>7</dataBits>
    </properties>
</connection>
<connection>
    <address>TCPIP::192.168.1.100::5000::SOCKET</address>
    <properties>
      <macAddress>12:B2:14:F6:E7:40</macAddress>
      <readTermination>\r</readTermination>
      <writeTermination>\r</writeTermination>
    </properties>
</connection>

People could also maintain a separate Connection Register, without as strict quality control as an Equipment Register, and we could define a separate XSD for connecting to equipment and link records between Equipment and Connection Registers.

rebeccahawke commented 4 months ago

As discussed, it may be cleaner to create a separate connections register, as the connection information is very dynamic! It could also be a place to note software versions (even though this register may not be subject to strict quality control).

jborbely commented 4 months ago

Decide to not include information about connections in the equipment register.

Will consider creating a separate connections-register schema.