Example #1
0
 /** Processes next byte from the device. */
 private void processInput(byte b) throws IOException {
   try {
     Protocol protocol = Protocol.fromValue(b);
     processInput(protocol);
   } catch (IllegalArgumentException e) {
     logger.catching(e);
   }
 }
Example #2
0
 /** Processes input from the device based on the protocol type. */
 private void processInput(Protocol protocol) throws IOException {
   logger.debug(protocol);
   switch (protocol) {
     case TIME_POLL:
       sendStatus();
       break;
     case DATA_POLL:
       processInputData();
       break;
     default:
       logger.warn("Ignoring {}", protocol.name());
   }
 }