/** * Prepare the next receive message number in the communication with the communication partner. Every received * message should be incremented by 1 and on overflow start again with 1. * * @param message * the message * @return the next receive message number */ public int getNextReceiveMsgNum(BidibMessage message) { synchronized (nextReceiveMsgNumLock) { nextReceiveMsgNum++; if (nextReceiveMsgNum > 255) { nextReceiveMsgNum = 1; } if (message.getNum() == 0) { nextReceiveMsgNum = 0; } } return nextReceiveMsgNum; }
@Override public boolean equals(Object obj) { if (obj instanceof BidibMessage) { BidibMessage other = (BidibMessage) obj; if (other.getType() == getType() && other.getNum() == getNum() && Arrays.equals(other.getAddr(), getAddr()) && Arrays.equals(other.getData(), getData())) { return true; } } return super.equals(obj); }
&& (bidibNode.getNodeMagic() != null || message instanceof SysMagicResponse)) { int numExpected = bidibNode.getNextReceiveMsgNum(message); int numReceived = message.getNum(); LOGGER .trace("Compare the message numbers, expected: {}, received: {}", numExpected, numReceived); int numReceived = message.getNum(); LOGGER .warn(
case BidibLibrary.MSG_ACCESSORY_PARA: result = new AccessoryParaResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_ACCESSORY_STATE: result = new AccessoryStateResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_ACCESSORY_NOTIFY: result = new AccessoryNotifyResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_BM_ADDRESS: result = new FeedbackAddressResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_BM_CONFIDENCE: result = new FeedbackConfidenceResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_BM_CURRENT: result = new FeedbackCurrentResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break; case BidibLibrary.MSG_BM_FREE: result = new FeedbackFreeResponse(result.getAddr(), result.getNum(), result.getType(), result.getData()); break;