Commit ad6f716a authored by Nicolas Gilmard's avatar Nicolas Gilmard
Browse files

Add precondition for baud rate in xbeeAdapter

parent 100b9d11
......@@ -16,6 +16,8 @@ package lu.list.itis.dkd.tui.network.adapter;
import lu.tudor.ssi.kiss.dbc.annotation.NonNullByDefault;
import com.google.common.base.Preconditions;
import gnu.io.CommPortIdentifier;
import gnu.io.PortInUseException;
import gnu.io.SerialPort;
......@@ -63,6 +65,7 @@ public class XbeeAdapter extends ClientAdapter {
* == 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 or 230400
*/
public XbeeAdapter(String port, int baudRate) {
Preconditions.checkState(baudRate == 1200 || baudRate == 2400 || baudRate == 4800 || baudRate == 9600 || baudRate == 19200 || baudRate == 38400 || baudRate == 57600 || baudRate == 115200 || baudRate == 230400, "The baud rate must be equals to 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200 or 230400"); //$NON-NLS-1$
this.port = port;
this.baudRate = baudRate;
portId = null;
......
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2015-05-11T15:11:19</date>
<millis>1431349879911</millis>
<sequence>0</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplication</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>Cannot instantiate adapter. You try to instantiate an abstract class or an interface!</message>
</record>
<record>
<date>2015-05-11T15:11:19</date>
<millis>1431349879939</millis>
<sequence>1</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplication</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>The class lu.list.itis.dkd.tui.adapter.TuAdapter was not found. Check the spelling !</message>
</record>
<record>
<date>2015-05-11T15:11:20</date>
<millis>1431349880041</millis>
<sequence>2</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationNoSuchMethod</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>The called method was not found</message>
</record>
<record>
<date>2015-05-11T15:11:20</date>
<millis>1431349880091</millis>
<sequence>3</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationIllegalArgument</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>A wrong argument has been passed to the adapter.</message>
</record>
<record>
<date>2015-05-11T15:11:20</date>
<millis>1431349880121</millis>
<sequence>4</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationInvocationTargetException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>An exception has been thrown in the constructor of the adapter</message>
</record>
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992725</millis>
<sequence>1</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplication</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>The class lu.list.itis.dkd.tui.adapter.TuAdapter was not found. Check the spelling !</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992786</millis>
<sequence>2</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationNoSuchMethod</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>The called method was not found</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992825</millis>
<sequence>3</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationIllegalArgument</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>A wrong argument has been passed to the adapter.</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992867</millis>
<sequence>4</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationInvocationTargetException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>An exception has been thrown in the constructor of the adapter</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997336</millis>
<sequence>5</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997437</millis>
<sequence>6</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992786</millis>
<sequence>2</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationNoSuchMethod</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>The called method was not found</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992825</millis>
<sequence>3</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationIllegalArgument</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>A wrong argument has been passed to the adapter.</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992867</millis>
<sequence>4</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationInvocationTargetException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>An exception has been thrown in the constructor of the adapter</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997336</millis>
<sequence>5</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997437</millis>
<sequence>6</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992825</millis>
<sequence>3</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationIllegalArgument</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>A wrong argument has been passed to the adapter.</message>
</record>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992867</millis>
<sequence>4</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationInvocationTargetException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>An exception has been thrown in the constructor of the adapter</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997336</millis>
<sequence>5</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997437</millis>
<sequence>6</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<?xml version="1.0" encoding="windows-1252" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
<date>2015-05-11T15:13:12</date>
<millis>1431349992867</millis>
<sequence>4</sequence>
<logger>TangibleApplication</logger>
<level>SEVERE</level>
<class>lu.list.itis.dkd.tui.TangibleApplicationTest2$TestTangibleApplicationInvocationTargetException</class>
<method>&lt;init&gt;</method>
<thread>1</thread>
<message>An exception has been thrown in the constructor of the adapter</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997336</millis>
<sequence>5</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
<record>
<date>2015-05-11T15:13:17</date>
<millis>1431349997437</millis>
<sequence>6</sequence>
<logger>TangibleApplication</logger>
<level>CONFIG</level>
<class>lu.list.itis.dkd.tui.TangibleInterfaceManager$TUIKeyAdapter</class>
<method>keyPressed</method>
<thread>15</thread>
<message>The keypress could not be associated to a case!</message>
</record>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment