Package jmri.jmrix.openlcb.configurexml
Class ConnectionConfigXml
java.lang.Object
jmri.jmrix.openlcb.configurexml.ConnectionConfigXml
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic CanSystemConnectionMemoisOpenLCBProtocol(PortAdapter adapter) Tests whether a CAN adapter is set to openLCB protocol or not.static voidmaybeLoadOlcbProfileSettings(org.jdom2.Element shared, org.jdom2.Element perNode, PortAdapter adapter) Checks if we are loading an OpenLCB protocol adapter.static voidmaybeSaveOlcbProfileSettings(org.jdom2.Element element, PortAdapter adapter) Checks if we are saving an OpenLCB protocol connection.
-
Constructor Details
-
ConnectionConfigXml
public ConnectionConfigXml()
-
-
Method Details
-
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
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
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.
-