/// <summary> /// Get an instance of the connector described by the MetaConnector. /// </summary> /// <param name="metaConnector">Object describing a connector.</param> /// <returns>(IConnector) A connector that will attempt to establish a connection with a Serial Port to which an ELM327 device is attached.</returns> public IConnector GetConnector(MetaConnector metaConnector, ConnectionSettings connectionSettings) { IConnector connector = null; // If this MetaConnector represents a particular port (as opposed to the AutoConnector) if (metaConnector.PortName.Length > 0) { connector = new PortConnector(metaConnector.PortName, connectionSettings); } else { log.Info("Returning AutoConnector"); connector = new AutoConnector(connectionSettings); } return connector; }
/// <summary> /// Get an instance of the connector described by the MetaConnector. /// </summary> /// <param name="metaConnector">Object describing a connector.</param> /// <returns>(IConnector) A connector that will attempt to establish a connection with a Serial Port to which an ELM327 device is attached.</returns> public IConnector GetConnector(MetaConnector metaConnector, ConnectionSettings connectionSettings) { IConnector connector = null; // If this MetaConnector represents a particular port (as opposed to the AutoConnector) if (metaConnector.PortName.Length > 0) { connector = new PortConnector(metaConnector.PortName, connectionSettings); } else { log.Info("Returning AutoConnector"); connector = new AutoConnector(connectionSettings); } return(connector); }