コード例 #1
0
 public void testBytesToString() {
   SerialMessage m = new SerialMessage();
   m.setOpCode(0x81);
   m.setElement(1, (byte) 0x02);
   m.setElement(2, (byte) 0xA2);
   m.setElement(3, (byte) 0x00);
   Assert.assertEquals("string compare ", "81 02 A2 00", m.toString());
 }
コード例 #2
0
 public void testSetParity4() {
   SerialMessage m = new SerialMessage();
   m.setElement(0, (byte) 226);
   m.setElement(1, (byte) 15);
   m.setElement(2, (byte) 226);
   m.setElement(3, (byte) 84);
   m.setParity();
   Assert.assertEquals("string compare ", "E2 0F E2 54", m.toString());
 }
コード例 #3
0
 public void testSetParity1() {
   SerialMessage m = new SerialMessage();
   m.setElement(0, (byte) 129);
   m.setElement(1, (byte) 90);
   m.setElement(2, (byte) 129);
   m.setElement(3, (byte) (31 & 0xF0));
   m.setParity();
   Assert.assertEquals("string compare ", "81 5A 81 1F", m.toString());
 }
コード例 #4
0
 public void testSetParity7() {
   // from doc page
   SerialMessage m = new SerialMessage();
   m.setElement(0, (byte) 129);
   m.setElement(1, (byte) 90);
   m.setElement(2, (byte) 129);
   m.setElement(3, (byte) 31);
   m.setParity();
   Assert.assertEquals("string compare ", "81 5A 81 1F", m.toString());
 }
コード例 #5
0
 public void testSetParity6() {
   // special req software version
   SerialMessage m = new SerialMessage();
   m.setElement(0, (byte) 0xE2);
   m.setElement(1, (byte) 119);
   m.setElement(2, (byte) 0xE2);
   m.setElement(3, (byte) 119);
   m.setParity();
   Assert.assertEquals("string compare ", "E2 77 E2 77", m.toString());
 }
コード例 #6
0
 public void testSetParity5() {
   // observed error message
   SerialMessage m = new SerialMessage();
   m.setElement(0, (byte) 0x80);
   m.setElement(1, (byte) 98);
   m.setElement(2, (byte) 0x80);
   m.setElement(3, (byte) 0x10);
   m.setParity();
   Assert.assertEquals("string compare ", "80 62 80 10", m.toString());
 }