}
catch (final InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
USBPacket response = null;
for (;;) {
if (_stopped) {
_log.info(hashCode() + " stopped receiving messages");
return;
}
response = null;
if (!_paused)
response = _usb.getPacket();
if (response == null) {
try {
Thread.sleep(100);
}
catch (final InterruptedException e) {
_log.info(hashCode() + " interrupted");
}
continue;
}
final GarminUSBMessage gm =
new GarminUSBMessage(response.getPacketId(), response.getData());
_log.debug("recv: " + gm);
if (_listener != null)
_listener.messageReceived(gm);
}
}