I/O APRS Module is based on the I/O core module, which contains all the necessary tools for connection and session handling.
// Create protocol
AprsIsProtocol protocol = new AprsIsProtocol();
// Identify as "known" with passcode "1234"
protocol.setParams(new AprsIsParams("known", "1234"));
// Create connection
SocketConnection connection = new SocketConnection("<name>");
// Open a connection to <host> at port 14590
connection.open(protocol, "<host>", 14590);
// 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...
}
});
// 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...
}
});
// 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...
}
});