// ----------------------------------------------------------------------------------------- // Request Methods // ----------------------------------------------------------------------------------------- public void handleSendDataRequest(byte[] data, boolean replication) { byte nodeId = SafeCast.nodeIdFromMsg(queue.getCurrentMsg()); if (data[2] != queue.getExpectedCallbackId()) { logs.add( String.format( "Unexpected callback id: received %d != %d", SafeCast.toInt(data[2]), SafeCast.toInt(queue.getExpectedCallbackId()))); } else { Node node = getNode(nodeId); if (node != null && queue.getCurrentMsg() != null) { if (data[3] != 0) { if (!handleErrorResponse( data[3], nodeId, replication ? "ZW_REPLICATION_END_DATA" : "ZW_SEND_DATA", !replication)) { if (queue.getCurrentMsg().isNoOperation() && (node.getQueryStage() == QueryStage.Probe1 || node.getQueryStage() == QueryStage.Probe2)) { node.queryStageRetry(node.getQueryStage(), (byte) 3); } } } else { if (queue.getCurrentMsg().isWakeUpNoMoreInformationCommand()) { WakeUp wu = (WakeUp) node.getCommandClassManager().getCommandClass(WakeUp.COMMAND_CLASS_ID); if (wu != null) { wu.setAwake(false); } } if (!node.isNodeAlive()) { node.setNodeAlive(true); } } } queue.setExpectedCallbackId((byte) 0); } }
// ----------------------------------------------------------------------------------------- // Request Variable // ----------------------------------------------------------------------------------------- // private boolean handleErrorResponse(byte error, byte nodeId, String // funcStr) { return handleErrorResponse(error, nodeId, funcStr, false); } public synchronized void checkCompletedNodeQueries() { if (!allNodesQueried) { boolean all = true; boolean sleepingOnly = true; boolean deadFound = false; for (int i = 0; i < nodes.size(); ++i) { Node node = getNode((byte) i); if (node != null && node.getQueryStage() != QueryStage.Complete) { if (!node.isNodeAlive()) { deadFound = true; } else { all = false; if (!node.isListeningDevice()) { sleepingOnly = false; } } } } if (all) { if (deadFound) { logs.add("All node complete - All Init Process Complete (With dead founded)"); } else { logs.add("All node complete - All Init Process Complete"); } awakeNodesQueried = true; allNodesQueried = true; } else { if (!awakeNodesQueried) { awakeNodesQueried = true; } } } if (listener != null) { listener.onNodeQueryStageCompleteListener(); } }