|
|
@ -83,7 +83,6 @@ public class DiConWebsocket implements DiDeviceConnection { |
|
|
|
|
|
|
|
synchronized ( request ) { |
|
|
|
try { |
|
|
|
LOG.info("wait for response : mid = {}; hash={}", request.id, request.hashCode()); |
|
|
|
request.wait(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
@ -137,8 +136,6 @@ public class DiConWebsocket implements DiDeviceConnection { |
|
|
|
|
|
|
|
// handle on data |
|
|
|
public void handleOnText(String text) { |
|
|
|
LOG.info("HandleOnText : {}", text); |
|
|
|
|
|
|
|
ByteBuffer message = DiByteBuffer.fromHex(text); |
|
|
|
message.order(ByteOrder.LITTLE_ENDIAN); |
|
|
|
byte messageType = message.get(5); |
|
|
@ -153,7 +150,6 @@ public class DiConWebsocket implements DiDeviceConnection { |
|
|
|
|
|
|
|
// handle on data timeout for binary mode ack message |
|
|
|
private void handleOnTextAckMessage(ByteBuffer message) { |
|
|
|
LOG.info("HandleOnTextAckMessage : start ..."); |
|
|
|
short messageId = message.getShort(0); |
|
|
|
DiCommandRequest request = null; |
|
|
|
for ( DiCommandRequest requestItem : this.requests ) { |
|
|
@ -163,7 +159,6 @@ public class DiConWebsocket implements DiDeviceConnection { |
|
|
|
} |
|
|
|
} |
|
|
|
if ( null == request ) { |
|
|
|
LOG.info("HandleOnTextAckMessage : request not found. messageId={}", messageId); |
|
|
|
return ; // 可能是超时了, 已经被处理掉了 ~~~ |
|
|
|
} |
|
|
|
request.response = message; |
|
|
@ -173,9 +168,7 @@ public class DiConWebsocket implements DiDeviceConnection { |
|
|
|
request.timeoutTimer = null; |
|
|
|
} |
|
|
|
synchronized ( request ) { |
|
|
|
LOG.info("notify response : mid = {}; hash={}", request.id, request.hashCode()); |
|
|
|
request.notify(); |
|
|
|
} |
|
|
|
LOG.info("HandleOnTextAckMessage : End"); |
|
|
|
} |
|
|
|
} |