Package jmri.jmrix.openlcb.configurexml
Class ConnectionConfigXml
- java.lang.Object
-
- jmri.jmrix.openlcb.configurexml.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.
-
-
Constructor Summary
Constructors Constructor Description ConnectionConfigXml()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CanSystemConnectionMemo
isOpenLCBProtocol(PortAdapter adapter)
Tests whether a CAN adapter is set to openLCB protocol or not.static void
maybeLoadOlcbProfileSettings(org.jdom2.Element shared, org.jdom2.Element perNode, PortAdapter adapter)
Checks if we are loading an OpenLCB protocol adapter.static void
maybeSaveOlcbProfileSettings(org.jdom2.Element element, PortAdapter adapter)
Checks if we are saving an OpenLCB protocol connection.
-
-
-
Constructor Detail
-
ConnectionConfigXml
public ConnectionConfigXml()
-
-
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 nodeadapter
- 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.
-
-