Class ConnectionConfigXml


  • public class ConnectionConfigXml
    extends java.lang.Object
    This class encapsulates common code for reading and writing per-connection information from/to the XML of the connection profile. It is intended to be called by all conforming Adapter implementations that are the possible choices for an OpenLCB connection.

    (C) Balazs Racz, 2018.

    • Method Detail

      • maybeLoadOlcbProfileSettings

        public static void maybeLoadOlcbProfileSettings​(org.jdom2.Element shared,
                                                        org.jdom2.Element perNode,
                                                        PortAdapter adapter)
        Checks if we are loading an OpenLCB protocol adapter. If no, returns without doing anything. If yes, loads the protocol settings from the XML elements. Must be called after loadOptions is done.
        Parameters:
        shared - The <connection> element in the shared profile configuration.
        perNode - The <connection> element in the per-node profile configuration.
        adapter - The adapter that's in the process of initializing this connection.
      • maybeSaveOlcbProfileSettings

        public static void maybeSaveOlcbProfileSettings​(org.jdom2.Element element,
                                                        PortAdapter adapter)
        Checks if we are saving an OpenLCB protocol connection. If no, does nothing. If yes, saves the protocol options from the SystemConnectionMemo into the XML element. This function needs to be called from the extendElement(Element e) override in a ConnectionConfigXml of an adaptor.
        Parameters:
        element - <connection> XML node
        adapter - Adaptor object that we are trying to save; used to access the system connection memo.
      • isOpenLCBProtocol

        public static CanSystemConnectionMemo isOpenLCBProtocol​(PortAdapter adapter)
        Tests whether a CAN adapter is set to openLCB protocol or not.
        Parameters:
        adapter - CAN adapter 9may be serial, loopback or network).
        Returns:
        null for non-OpenLCB connections; for OpenLCB the connection-associated the CanSystemConnectionMemo.