|
|
@ -9,6 +9,7 @@ import com.iflytop.handacid.hardware.type.CmdId; |
|
|
|
import com.iflytop.handacid.hardware.type.MId; |
|
|
|
import com.iflytop.handacid.hardware.type.ModuleStatus; |
|
|
|
import com.iflytop.handacid.hardware.type.appevent.A8kCanBusOnConnectEvent; |
|
|
|
import com.iflytop.handacid.hardware.type.appevent.A8kHardwareReport; |
|
|
|
import com.iflytop.handacid.hardware.type.error.A8kEcode; |
|
|
|
import com.iflytop.handacid.hardware.type.error.AEHardwareError; |
|
|
|
import com.iflytop.handacid.hardware.utils.OS; |
|
|
@ -122,21 +123,25 @@ public class A8kCanBusConnection extends WebSocketClient { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override public void onOpen(ServerHandshake serverHandshake) { |
|
|
|
@Override |
|
|
|
public void onOpen(ServerHandshake serverHandshake) { |
|
|
|
log.info("a8k canbus connect sucess"); |
|
|
|
eventBus.pushEvent(new A8kCanBusOnConnectEvent()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override public void onMessage(String s) { |
|
|
|
@Override |
|
|
|
public void onMessage(String s) { |
|
|
|
log.trace("RX-RAW: {}", s); |
|
|
|
processCanRxMessage(s); |
|
|
|
} |
|
|
|
|
|
|
|
@Override public void onClose(int i, String s, boolean b) { |
|
|
|
@Override |
|
|
|
public void onClose(int i, String s, boolean b) { |
|
|
|
log.warn("a8k canbus lost connection..."); |
|
|
|
} |
|
|
|
|
|
|
|
@Override public void onError(Exception e) { |
|
|
|
@Override |
|
|
|
public void onError(Exception e) { |
|
|
|
log.info("a8k can-websocket-channel on error"); |
|
|
|
} |
|
|
|
|
|
|
@ -321,11 +326,11 @@ public class A8kCanBusConnection extends WebSocketClient { |
|
|
|
|
|
|
|
|
|
|
|
if (packet.getPacketType() == A8kPacket.PACKET_TYPE_ACK || packet.getPacketType() == A8kPacket.PACKET_TYPE_ERROR_ACK) { |
|
|
|
log.trace("RX-ACK |RAW:{}| {}", s, packet); |
|
|
|
log.debug("RX-ACK |RAW:{}| {}", s, packet); |
|
|
|
context.pushReceipt(packet); |
|
|
|
} else if (packet.getPacketType() == A8kPacket.PACKET_TYPE_EVENT) { |
|
|
|
log.trace("RX-REPORT |RAW:{}| {}", s, packet); |
|
|
|
// eventBus.pushEvent(new A8kHardwareReport(packet)); |
|
|
|
log.debug("RX-REPORT |RAW:{}| {}", s, packet); |
|
|
|
eventBus.pushEvent(new A8kHardwareReport(packet)); |
|
|
|
} else { |
|
|
|
log.warn("RX-UNPROCESSABLE: |RAW:{}| {}", s, packet); |
|
|
|
} |
|
|
|