org.ka2ddo.yaac.core
Class QueryResponder

java.lang.Object
  extended by org.ka2ddo.yaac.core.QueryResponder
All Implemented Interfaces:
AprsMessageListener

public class QueryResponder
extends java.lang.Object
implements AprsMessageListener

This class handles processing queries sent to this station.


Field Summary
static java.lang.String TACTICAL_AUTHORIZATION
          Key string for StationState attachment indicating the future authorization for incoming TACTICAL messages.
static java.lang.String TACTICAL_SOURCE
          Key string for StationState attachment indicating the remote source of a tactical callsign or symbol code.
 
Method Summary
 void aprsMessageReceived(Message msg)
          DO NOT CALL.
 double getDefaultRangeLimit()
          Get the maximum range in kilometers for responding to QRU queries.
static QueryResponder getInstance()
          Get a handle to the QueryResponder singleton object.
 java.util.Map<java.lang.String,AbstractQueryHandler> getRegisteredHandlerMap()
          Get a read-only reference to the map of registered handlers.
 boolean isEnableQruServer()
          Test if QRU server should be enabled.
static void processTactical(java.lang.String originatingCallsign, java.lang.String body)
          Process a message known to contain a tactical callsign directive (alias definitions) and approved to be processed by the user.
 void registerQueryHandler(java.lang.String prefix, AbstractQueryHandler handler)
          Register a query handler with the QueryResponder to handle processing a specific incoming query string.
 void reverifyMessages()
          Re-run the verification of any signed messages that couldn't be done earlier because the user hadn't finished entering the keystore password yet.
static void sendCurrentTacticalAliases(boolean sendAllAliases)
          Scan the current list of stations and objects and broadcast any tactical callsigns (aliases) currently in use.
 void setDefaultRangeLimit(double defaultRangeLimit)
          Specify the maximum range in kilometers for responding to QRU queries.
 void setEnableQruServer(boolean enableQruServer)
          Specify whether this program should function as a QRU server.
static void transmitBroadcast(java.lang.String addressee, java.lang.String answer)
          Transmit an APRS text Message to all recipients using the specified addressee and message body text, specifying only RF transmission of the text message.
static void transmitBroadcast(java.lang.String addressee, java.lang.String answer, long delay)
          Transmit an APRS text Message to all recipients using the specified addressee and message body text.
static void transmitPositionBeacon()
          Immediately transmit a position beacon message for this station.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TACTICAL_AUTHORIZATION

public static final java.lang.String TACTICAL_AUTHORIZATION
Key string for StationState attachment indicating the future authorization for incoming TACTICAL messages.

See Also:
Constant Field Values

TACTICAL_SOURCE

public static final java.lang.String TACTICAL_SOURCE
Key string for StationState attachment indicating the remote source of a tactical callsign or symbol code.

See Also:
Constant Field Values
Method Detail

getInstance

public static QueryResponder getInstance()
Get a handle to the QueryResponder singleton object.

Returns:
QueryResponder instance

registerQueryHandler

public void registerQueryHandler(java.lang.String prefix,
                                 AbstractQueryHandler handler)
Register a query handler with the QueryResponder to handle processing a specific incoming query string. Note that if a later plugin registers a handler with the same name as an earlier handler, the earlier handler is replaced. This allows plugins to augment the default handlers shipped with core YAAC.

Parameters:
prefix - the leading characters of the query that identifies which type of query it is
handler - AbstractQuery handler to call to handle this message
See Also:
AbstractQueryHandler

getRegisteredHandlerMap

public java.util.Map<java.lang.String,AbstractQueryHandler> getRegisteredHandlerMap()
Get a read-only reference to the map of registered handlers.

Returns:
Map of String prefixes to AbstractQueryHandler objects

isEnableQruServer

public boolean isEnableQruServer()
Test if QRU server should be enabled.

Returns:
boolean true if this program should function as a QRU server

setEnableQruServer

public void setEnableQruServer(boolean enableQruServer)
Specify whether this program should function as a QRU server.

Parameters:
enableQruServer - boolean true if this process should be a QRU server

getDefaultRangeLimit

public double getDefaultRangeLimit()
Get the maximum range in kilometers for responding to QRU queries.

Returns:
maximum response range in kilometers

setDefaultRangeLimit

public void setDefaultRangeLimit(double defaultRangeLimit)
Specify the maximum range in kilometers for responding to QRU queries.

Parameters:
defaultRangeLimit - maximum range in kilometers

aprsMessageReceived

public void aprsMessageReceived(Message msg)
DO NOT CALL. Callback to deliver the next message received by YAAC that is an APRS message.

Specified by:
aprsMessageReceived in interface AprsMessageListener
Parameters:
msg - some subclass of Message containing the message contents; the message should have an AX25Frame connected to it
See Also:
AX25Frame, AX25Message.ax25Frame, AX25Message.getAx25Frame()

processTactical

public static void processTactical(java.lang.String originatingCallsign,
                                   java.lang.String body)
Process a message known to contain a tactical callsign directive (alias definitions) and approved to be processed by the user.

Parameters:
originatingCallsign - String callsign of station sending the tactical callsign updates
body - String message text

reverifyMessages

public void reverifyMessages()
Re-run the verification of any signed messages that couldn't be done earlier because the user hadn't finished entering the keystore password yet.


sendCurrentTacticalAliases

public static void sendCurrentTacticalAliases(boolean sendAllAliases)
Scan the current list of stations and objects and broadcast any tactical callsigns (aliases) currently in use. Use an aggressive algorithm to maximally optimize the transmissions into the fewest possible number of APRS text message packets.

Parameters:
sendAllAliases - boolean true if all aliases should be sent, false if only locally defined ones should be sent

transmitPositionBeacon

public static void transmitPositionBeacon()
Immediately transmit a position beacon message for this station.


transmitBroadcast

public static void transmitBroadcast(java.lang.String addressee,
                                     java.lang.String answer)
Transmit an APRS text Message to all recipients using the specified addressee and message body text, specifying only RF transmission of the text message.

Parameters:
addressee - String addressee of text message
answer - text of the message

transmitBroadcast

public static void transmitBroadcast(java.lang.String addressee,
                                     java.lang.String answer,
                                     long delay)
Transmit an APRS text Message to all recipients using the specified addressee and message body text.

Parameters:
addressee - String addressee of text message
answer - text of the message
delay - number of milliseconds to delay this transmission