MicrochipPotentiometerDeviceController { public DeviceControllerTerminalConfiguration getTerminalConfiguration( final DeviceControllerChannel channel) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } int tcon = read(channel.getTerminalControllAddress()); boolean channelEnabled = (tcon & channel.getHardwareConfigControlBit()) > 0; boolean pinAEnabled = (tcon & channel.getTerminalAConnectControlBit()) > 0; boolean pinWEnabled = (tcon & channel.getWiperConnectControlBit()) > 0; boolean pinBEnabled = (tcon & channel.getTerminalBConnectControlBit()) > 0; return new DeviceControllerTerminalConfiguration(channel, channelEnabled, pinAEnabled, pinWEnabled, pinBEnabled); } MicrochipPotentiometerDeviceController(final I2CDevice i2cDevice); DeviceControllerDeviceStatus getDeviceStatus(); void increase(final DeviceControllerChannel channel, final int steps); void decrease(final DeviceControllerChannel channel, final int steps); int getValue(final DeviceControllerChannel channel, final boolean nonVolatile); void setValue(final DeviceControllerChannel channel, final int value,
			final boolean nonVolatile); DeviceControllerTerminalConfiguration getTerminalConfiguration(
			final DeviceControllerChannel channel); void setTerminalConfiguration(final DeviceControllerTerminalConfiguration config); void setWiperLock(final DeviceControllerChannel channel,
			final boolean locked); void setWriteProtection(final boolean enabled); @Override String toString(); @Override boolean equals(final Object obj); static final boolean VOLATILE_WIPER; static final boolean NONVOLATILE_WIPER; }
@Test public void testGetTerminalConfiguration() throws IOException { try { controller.getTerminalConfiguration(null); fail("Got no RuntimeException on calling 'getTerminalConfiguration(null)'!"); } catch (RuntimeException e) { } mockReadResult(i2cDevice, (byte) 0, (byte) 0b11000011, null); DeviceControllerTerminalConfiguration tconA = controller.getTerminalConfiguration( DeviceControllerChannel.A); testForWriteAndRead((byte) 0b1001100); assertNotNull("Calling 'getTerminalConfiguration(Channel.A)' did return null!", tconA); assertEquals("Result of 'getTerminalConfiguration(Channel.A)' did not return '" + "Channel.A' on calling 'getChannel()'!", DeviceControllerChannel.A, tconA.getChannel()); assertEquals("According to mocked read-result the channel should be disabled!", false, tconA.isChannelEnabled()); assertEquals("According to mocked read-result the pin A should be disabled!", false, tconA.isPinAEnabled()); assertEquals("According to mocked read-result the pin W should be enabled!", true, tconA.isPinWEnabled()); assertEquals("According to mocked read-result the pin B should be enabled!", true, tconA.isPinBEnabled()); DeviceControllerTerminalConfiguration tconB = controller.getTerminalConfiguration( DeviceControllerChannel.B); testForWriteAndRead((byte) 0b1001100, 2); assertNotNull("Calling 'getTerminalConfiguration(Channel.B)' did return null!", tconB); assertEquals("Result of 'getTerminalConfiguration(Channel.B)' did not return '" + "Channel.A' on calling 'getChannel()'!", DeviceControllerChannel.B, tconB.getChannel()); assertEquals("According to mocked read-result the channel should be enabled!", true, tconB.isChannelEnabled()); assertEquals("According to mocked read-result the pin A should be enabled!", true, tconB.isPinAEnabled()); assertEquals("According to mocked read-result the pin W should be disabled!", false, tconB.isPinWEnabled()); assertEquals("According to mocked read-result the pin B should be disabled!", false, tconB.isPinBEnabled()); }