/** * Send the message via the node without wait for response. * * @param node * the node * @param message * the message to send * @throws ProtocolException */ public static void sendNoWait(final BidibNode node, final BidibCommand message) throws ProtocolException { node.sendNoWait(message); }
private void prepareAndSendMessage(BidibCommand message) { // encode the message (adds the message number) EncodedMessage encodedMessage = encodeMessage(message); sendMessage(encodedMessage, message); }
@Override public BidibNode findNode(byte[] nodeAddress) { return nodeRegistry.findNode(nodeAddress); }
private void notifyBulkSender(byte[] address, Integer answerType) { // notify the bulk sender BidibNode node = nodeRegistry.findNode(address); LOGGER.trace("Notify bulk answer to node: {}", node); if (node != null) { try { node.notifyBulkAnswer(answerType); } catch (Exception ex) { LOGGER.error("Notify bulk answer to node failed.", ex); } } }
protected void messageReceived(final BidibNode bidibNode, final BidibMessage message) { // put the message into the receiveQueue because somebody waits for it ... LOGGER.debug("Offer received message to node: {}, message: {}", bidibNode, message); try { bidibNode.addResponseToReceiveQueue(message); } catch (Exception ex) { LOGGER.error("Offer received message to node failed. Message was: " + message, ex); } }
/** * @param name * the name to set */ @Override public void setName(String name) { String oldValue = this.name; this.name = name; firePropertyChange(PROPERTY_NAME, oldValue, name); }
/** * Send a message without waiting for response. * * @param message * the message to send * @throws ProtocolException */ protected void sendNoWait(BidibCommand message) throws ProtocolException { send(message, null, false, (Integer) null); }
@Override public BoosterNode getBoosterNode(Node node) { return nodeRegistry.getBoosterNode(node); }
/** * Get the unique id from the node. * * @return the unique id * @throws ProtocolException */ public long getUniqueId() throws ProtocolException { return getUniqueId(false); }
/** * Send the system reset message to the node. * * @throws ProtocolException */ public void reset() throws ProtocolException { super.reset(); }
@Override public CommandStationNode getCommandStationNode(Node node) { return nodeRegistry.getCommandStationNode(node); }
@Override public BidibNode getNode(Node node) { return nodeRegistry.getNode(node); }
@Override public RootNode getRootNode() { return nodeRegistry.getRootNode(); }
public CommandStationState queryState() throws ProtocolException { return queryState(true); }
@Override public void run() { try { LOGGER.info("Process the pending send queue for bidibNode: {}", bidibNode); bidibNode.processPendingSendQueue(); } catch (ProtocolException ex) { LOGGER.warn("Process pending send queue failed for bidibNode: {}", bidibNode, ex); } } });
/** * Get the current 'quality' of the track sensoring. */ public void getConfidence() throws ProtocolException { sendNoWait(new FeedbackGetConfidenceMessage()); }
/** * @param value * the value to set */ @Override public void setValue(String value) { String oldValue = this.value; this.value = value; firePropertyChange(PROPERTY_VALUE, oldValue, value); }
/** * Send a message and wait for the unspecific result. * * @param message * the message to send * @return the received result * @throws ProtocolException */ protected BidibMessage send(BidibCommand message) throws ProtocolException { return send(message, null, true, (Integer) null); }
/** * Query the booster state. We don't wait for the response because the MessageReceiver fires the booster status * callback on receipt. * * @throws ProtocolException */ public void boosterQuery() throws ProtocolException { delegate.sendNoWait(new BoostQueryMessage()); }
/** * Send the system disable message to the node. * * @throws ProtocolException */ public void sysDisable() throws ProtocolException { sendNoWait(requestFactory.createSysDisable()); }