.. DISCOTools Usage ===== :doc:`index` is based on the :doc:`I/O core module`, which contains all the necessary tools for connection and session handling. Connect to APRS-IS ------------------ .. code-block:: java // Create protocol AprsIsProtocol protocol = new AprsIsProtocol(); // Identify as "known" with passcode "1234" protocol.setParams(new AprsIsParams("known", "1234")); // Create connection SocketConnection connection = new SocketConnection(""); // Open a connection to at port 14590 connection.open(protocol, "", 14590); Listen for stations ------------------- .. code-block:: java // Create protocol AprsIsProtocol protocol = ...; // Add cache listener protocol.addListener(new IAprsCacheListener() { @Override public void onAprsCacheChange(AprsEvent e) { // Get station AprsStation s = e.getStation(); // TODO: Implement handler here... } }); Listen for packets ------------------ .. code-block:: java // Create protocol AprsIsProtocol protocol = ...; // Add packet listener protocol.addListener(new PacketAdapter() { @Override public void onReceive(PacketEvent e) { // Get packet IPacket p = e.getPacket(); // TODO: Implement handler here... } }); Listen for protocol events -------------------------- .. code-block:: java // Create protocol AprsIsProtocol protocol = ...; // Add finite state machine listener protocol.addListener(new IFsmListener() { @Override public void onChanged(FsmEvent e) throws FsmException { // TODO: Implement handler here... } });