/** * Receive the next packet. * * @return the packet if one is found. If there isn't one available, returns null. */ public Packet receivePacket() { return concentrator.getPacket(this, timeout); }
public void openSerialReadChannel() throws SocketException { concentrator.openSerialReadChannel(this); serialReadChannelOpen = true; }
/** * Send a packet on this connection. Calls the concentrator to actually send the packet. * * @param packet * @throws XBeeException */ public void sendPacket(Packet packet) throws XBeeException { concentrator.sendPacket(packet, this); }
/** Closes this connection. */ public void close() { concentrator.closeConnection(this); }
/** * Checks whether this connection is still open. Because the underlying protocol is * connection-less, this open/closed state has less to do with the state of the remote XBee device * and more to do with managing the concentrator's resources. * * @return */ public boolean isOpen() { XBeeIPConnection connection = concentrator.getExstingConnection(remoteAddress); return connection != null; }
/** * @param remoteAddress * @throws XBeeException if the connection object can't be created. See XBeeIPConcentrator for * other options. */ public XBeeIPConnection(InetAddress remoteAddress) throws XBeeException { this.remoteAddress = remoteAddress; // register with the concentrator concentrator = XBeeIPConcentrator.getInstance(); concentrator.registerConnection(this); }
public void closeSerialReadChannel() { serialReadChannelOpen = false; concentrator.closeSerialReadChannel(this); }