1 /* 2 * Copyright © 2016 Greg Chabala 3 * 4 * This file is part of brick-control-lab. 5 * 6 * brick-control-lab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * brick-control-lab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with brick-control-lab. If not, see http://www.gnu.org/licenses/. 18 */ 19 package org.chabala.brick.controllab; 20 21 /** 22 * Constants relating to the control lab communication protocol. 23 */ 24 final class Protocol { 25 static final String HANDSHAKE_CHALLENGE = "p\0###Do you byte, when I knock?$$$"; 26 static final String HANDSHAKE_RESPONSE = "###Just a bit off the block!$$$"; 27 28 static final byte DISCONNECT = (byte) 0b01110000; 29 30 static final byte OUTPUT_OFF = (byte) 0b10010000; 31 static final byte OUTPUT_ON = (byte) 0b10010001; 32 33 static final byte STOP_DEPRESSED = (byte) 0x10; 34 static final byte STOP_RELEASED = (byte) 0x00; 35 36 static final int FRAME_SIZE = 19; 37 38 private Protocol() { 39 throw new UnsupportedOperationException(); 40 } 41 }