@Test (expected = IllegalArgumentException.class) public void testNullConfiguration() throws Exception { RadioTelegramListener listener = new TestListener(); EnOceanConnectionManager mgr = new EnOceanConnectionManager(); EnOceanConnection conn1 = mgr.getConnection(null, listener); }
public synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener) throws ConfigurationException, ConnectionException { if(configuration == null) { throw new IllegalArgumentException("null configuration"); } if(connection != null) { return connection; } if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP2) { connection = createEsp2Connection(configuration, listener); } else if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP3) { connection = createEsp3Connection(configuration, listener); } else { throw new ConfigurationException( "Invalid EnOcean serial protocol configuration " + "(see enocean.serialProtocol config property)." ); } if(connection != null) { connection.connect(); } return connection; }
EnOceanConnectionManager { public synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener) throws ConfigurationException, ConnectionException { if(configuration == null) { throw new IllegalArgumentException("null configuration"); } if(connection != null) { return connection; } if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP2) { connection = createEsp2Connection(configuration, listener); } else if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP3) { connection = createEsp3Connection(configuration, listener); } else { throw new ConfigurationException( "Invalid EnOcean serial protocol configuration " + "(see enocean.serialProtocol config property)." ); } if(connection != null) { connection.connect(); } return connection; } }
EnOceanConnectionManager { public synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener) throws ConfigurationException, ConnectionException { if(configuration == null) { throw new IllegalArgumentException("null configuration"); } if(connection != null) { return connection; } if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP2) { connection = createEsp2Connection(configuration, listener); } else if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP3) { connection = createEsp3Connection(configuration, listener); } else { throw new ConfigurationException( "Invalid EnOcean serial protocol configuration " + "(see enocean.serialProtocol config property)." ); } if(connection != null) { connection.connect(); } return connection; } EnOceanConnectionManager(); }
EnOceanConnectionManager { public synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener) throws ConfigurationException, ConnectionException { if(configuration == null) { throw new IllegalArgumentException("null configuration"); } if(connection != null) { return connection; } if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP2) { connection = createEsp2Connection(configuration, listener); } else if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP3) { connection = createEsp3Connection(configuration, listener); } else { throw new ConfigurationException( "Invalid EnOcean serial protocol configuration " + "(see enocean.serialProtocol config property)." ); } if(connection != null) { connection.connect(); } return connection; } EnOceanConnectionManager(); synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener); synchronized void disconnect(); }
EnOceanConnectionManager { public synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener) throws ConfigurationException, ConnectionException { if(configuration == null) { throw new IllegalArgumentException("null configuration"); } if(connection != null) { return connection; } if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP2) { connection = createEsp2Connection(configuration, listener); } else if(configuration.getSerialProtocol() == EspPortConfiguration.SerialProtocol.ESP3) { connection = createEsp3Connection(configuration, listener); } else { throw new ConfigurationException( "Invalid EnOcean serial protocol configuration " + "(see enocean.serialProtocol config property)." ); } if(connection != null) { connection.connect(); } return connection; } EnOceanConnectionManager(); synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener); synchronized void disconnect();  }