|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.siam.core.CommsLeaseListener
public class CommsLeaseListener
CommsLeaseListener responds to the Node's LeaseManager leasing events, and in response carries out several tasks to manage the relationship with the node's "parent" node. E.g. in the case of the primary surface node, CommsLeaseListener applies power to the radio that enables the communications link to its parent, which in this case is the shore portal. The class assumes there may be a device whose power is turned on/off by invoking scripts (specified in the node properties). CommsLeaseListener has delays built in to account for the time it takes to establish the communication link, and to allow the application protocol to get to the other side before tearing down the link. When it gets establishCallback() and power is not already on, it turns on RF power, delays for CommsManager.radioAcquireTime, and then notifies the parent via Node.notifyParentLinkConnected(). Conversely, when it gets terminateCallback() or expiredCallback() and the remaining connections == 0 and power is already on, it calls Node.notifyParentLinkDisconnecting(), delays for CommsManager.protocolWaitTime and then turns off RF power. 2/7/2006 k headley When a subnode is configured with a secondary wireless link to shore, it should only bring up the ppp link, and not notify its parent (or the portal) that the link is up. To that end, a new property (CommsManager.notifyParent) has been added to siamPort.cfg to indicate that the CommsLeaseListener should not contact its parent node as part of establishing and releasing communications. If CommsManager.notifyParent is set to false, the ppp link will be established at the specified interval, but no telemetry will take place.
| Field Summary | |
|---|---|
protected boolean |
_commsManagerEnabled
|
protected java.lang.String |
_commsOffCommand
|
protected java.lang.String |
_commsOnCommand
|
protected java.lang.String |
_commsStatusCommand
|
protected boolean |
_establishingLease
|
protected org.mbari.siam.core.CommsLeaseListener.CommsSleepRollCallListener |
_listener
|
protected java.lang.Object |
_lock
|
protected long |
_nextEstablishTime
|
protected NodeProperties |
_nodeProperties
|
protected NodeService |
_nodeService
|
protected SyncProcessRunner |
_processRunner
|
protected long |
_processWaitTime
|
protected long |
_protocolWaitTime
|
protected static int |
COMMS_CONNECTED
|
protected static int |
COMMS_DISCONNECTED
By convention, "connection status" command should return 0 if link IS connected, else return 1 if link is NOT connected. |
protected static java.lang.String |
DFLT_COMMS_STATUS_COMMAND
|
protected long |
onTime
|
protected static int |
PORT_IN_USE
By convention, connection and disconnection commands should return value of 0 if successful, and non-zero in case of error. |
protected static long |
PROTOCOL_WAIT_TIME
|
| Method Summary | |
|---|---|
boolean |
commLinkConnected()
Return true if comms link is connected. |
protected void |
disconnectingCallback(long nextConnectMsec)
Invoked before link is disconnected. |
void |
initialize()
This method must be called by creator (not constructor) to initialize parameters. |
void |
leaseEstablishCallback(int leaseID,
long leasePeriod,
long nextEstablishTime,
int numConnections)
Called when a lease is being established. |
void |
leaseExpiredCallback(int leaseID,
long nextEstablishTime,
int numConnections)
Called when lease expires. |
void |
leaseRenewalCallback(int leaseID,
long leasePeriod,
int numConnections)
Called when lease is being renewed. |
void |
leaseTerminatedCallback(int leaseID,
long nextEstablishTime,
int numConnections)
Called when lease is being terminated. |
void |
switchCommsOff()
Shut down comms link, turn off power. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final long PROTOCOL_WAIT_TIME
protected NodeProperties _nodeProperties
protected NodeService _nodeService
protected java.lang.Object _lock
protected org.mbari.siam.core.CommsLeaseListener.CommsSleepRollCallListener _listener
protected long _nextEstablishTime
protected boolean _commsManagerEnabled
protected long _protocolWaitTime
protected long _processWaitTime
protected java.lang.String _commsOnCommand
protected java.lang.String _commsOffCommand
protected java.lang.String _commsStatusCommand
protected SyncProcessRunner _processRunner
protected long onTime
protected static final int PORT_IN_USE
protected static final int COMMS_DISCONNECTED
protected static final int COMMS_CONNECTED
protected boolean _establishingLease
protected static final java.lang.String DFLT_COMMS_STATUS_COMMAND
| Method Detail |
|---|
public void initialize()
public void leaseEstablishCallback(int leaseID,
long leasePeriod,
long nextEstablishTime,
int numConnections)
throws LeaseRefused
leaseEstablishCallback in interface LeaseListenerleaseID - lease ID of session being establishedleasePeriod - lease period in millisecondsnextEstablishTime - next estimated lease establishment timenumConnections - Total number of connections on the comms
media, including this one.
LeaseRefused
public void leaseTerminatedCallback(int leaseID,
long nextEstablishTime,
int numConnections)
leaseTerminatedCallback in interface LeaseListenerleaseID - lease ID of session being terminatednextEstablishTime - next estimated lease establishment timenumConnections - Total number of connections on the comms
media, after this one has been terminated
public void leaseExpiredCallback(int leaseID,
long nextEstablishTime,
int numConnections)
leaseExpiredCallback in interface LeaseListenerleaseID - lease ID of session being establishednextEstablishTime - next estimated lease establishment timenumConnections - Total number of connections on the comms
media, after this one has expired
public void leaseRenewalCallback(int leaseID,
long leasePeriod,
int numConnections)
throws LeaseRefused
leaseRenewalCallback in interface LeaseListenerleaseID - lease ID of session being renewedleasePeriod - lease period in millisecondsnumConnections - Total number of connections on the comms
media, including this one.
LeaseRefused
protected void disconnectingCallback(long nextConnectMsec)
throws java.lang.Exception
java.lang.Exception
public void switchCommsOff()
throws java.lang.Exception
java.lang.Exceptionpublic boolean commLinkConnected()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||