org.mbari.siam.devices.nalModem
Class NALMessagingService

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.mbari.siam.utils.ShoreMessagingService
                  extended by org.mbari.siam.devices.nalModem.NALMessagingService
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, RemoteService, ShoreMessaging
Direct Known Subclasses:
A3LAMessagingService, NAL9601MessagingService

public abstract class NALMessagingService
extends ShoreMessagingService
implements ShoreMessaging

Implements ShoreMessaging with NAL Research Iridium modem.

See Also:
Serialized Form

Nested Class Summary
protected  class NALMessagingService.ConnectionTimer
          ConnectionTimer keeps track of time elapsed since connection started
 
Nested classes/interfaces inherited from class org.mbari.siam.utils.ShoreMessagingService
ShoreMessagingService.ShutdownTask
 
Field Summary
protected  byte[] _aggregateMsg
          Aggregate message buffer
protected  boolean _checkForUplinks
           
protected  NALMessagingService.ConnectionTimer _connectionTimer
           
protected static org.apache.log4j.Logger _log4j
           
protected  int _nPendingUplinks
          Number of uplinks pending on shore; may be StoreAndFwdIF::Unknown
protected  java.lang.String _serialPortName
           
protected  ShoreMessagingHelper.Message _uplinkMsg
           
protected static int MAX_CONSEC_DOWNLINK_FAILED
          Maximum consecutive downlink failures; give up, try later, if exceeded
protected static int MAX_CONSEC_UPLINK_FAILED
          Maximum consecutive uplink failures; give up, try later, if exceeded
protected static int MAX_UPLINKS_PER_SESSION
          Maximum uplinks per session
static int PROFILE_NUMBER
           
protected static int READ_TIMEOUT_MSEC
           
 
Fields inherited from class org.mbari.siam.utils.ShoreMessagingService
_downlinkMsgQ
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
NALMessagingService(java.lang.String serialPortName)
           
 
Method Summary
protected  void configureModem(java.io.InputStream input, java.io.OutputStream output)
          Configure modem for use by this driver
 void connect(int timeoutSec)
          Connect modem, exchange messages with shore
protected  void downlinkMsg(gnu.io.SerialPort serialPort, byte[] msg, int nMsgBytes, java.io.InputStream inStream, java.io.DataOutputStream outStream)
          Downlink a message
protected  int getUplinkMsgs(gnu.io.SerialPort serialPort, java.io.InputStream inStream, java.io.OutputStream outStream)
          Get uplinked message(s) through modem and add to uplink queue
protected  int nPendingUplinks()
          Return number of uplinks pending on shore; may return StoreAndFwdIF::Unknown
protected  gnu.io.SerialPort openSerialPort(int baud)
          Initialize serial port
protected  int receivedSignalStrength(gnu.io.SerialPort serialPort, java.io.InputStream inStream, java.io.OutputStream outStream)
          Return modem signal quality (0-5), -1 on error
protected  void restoreModem(java.io.OutputStream output)
          Restore modem to "default" configuration, for use by other applications - assumes profile #0 is default
protected  void retrieveAndQueueUplink(int nUplinkBytes)
          Retrieve uplink message from modem and queue it for clients
protected  void sleep(int sleepSec)
          Sleep for specified number of seconds
 
Methods inherited from class org.mbari.siam.utils.ShoreMessagingService
nQueuedDownlinkMsgs, ping, queueDownlinkMessage, shutdown
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mbari.siam.distributed.ShoreMessaging
maxDownlinkMsgBytes, nQueuedDownlinkMsgs, queueDownlinkMessage, shutdown
 
Methods inherited from interface org.mbari.siam.distributed.RemoteService
ping
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j

PROFILE_NUMBER

public static final int PROFILE_NUMBER
See Also:
Constant Field Values

READ_TIMEOUT_MSEC

protected static final int READ_TIMEOUT_MSEC
See Also:
Constant Field Values

_serialPortName

protected java.lang.String _serialPortName

_uplinkMsg

protected ShoreMessagingHelper.Message _uplinkMsg

_checkForUplinks

protected boolean _checkForUplinks

MAX_UPLINKS_PER_SESSION

protected static final int MAX_UPLINKS_PER_SESSION
Maximum uplinks per session

See Also:
Constant Field Values

MAX_CONSEC_UPLINK_FAILED

protected static final int MAX_CONSEC_UPLINK_FAILED
Maximum consecutive uplink failures; give up, try later, if exceeded

See Also:
Constant Field Values

MAX_CONSEC_DOWNLINK_FAILED

protected static final int MAX_CONSEC_DOWNLINK_FAILED
Maximum consecutive downlink failures; give up, try later, if exceeded

See Also:
Constant Field Values

_aggregateMsg

protected byte[] _aggregateMsg
Aggregate message buffer


_nPendingUplinks

protected int _nPendingUplinks
Number of uplinks pending on shore; may be StoreAndFwdIF::Unknown


_connectionTimer

protected NALMessagingService.ConnectionTimer _connectionTimer
Constructor Detail

NALMessagingService

public NALMessagingService(java.lang.String serialPortName)
                    throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

receivedSignalStrength

protected int receivedSignalStrength(gnu.io.SerialPort serialPort,
                                     java.io.InputStream inStream,
                                     java.io.OutputStream outStream)
                              throws java.lang.Exception
Return modem signal quality (0-5), -1 on error

Throws:
java.lang.Exception

configureModem

protected void configureModem(java.io.InputStream input,
                              java.io.OutputStream output)
                       throws java.lang.Exception
Configure modem for use by this driver

Throws:
java.lang.Exception

restoreModem

protected void restoreModem(java.io.OutputStream output)
                     throws java.lang.Exception
Restore modem to "default" configuration, for use by other applications - assumes profile #0 is default

Throws:
java.lang.Exception

nPendingUplinks

protected int nPendingUplinks()
Return number of uplinks pending on shore; may return StoreAndFwdIF::Unknown


connect

public void connect(int timeoutSec)
             throws ShoreMessagingHelper.ConnectFailed
Connect modem, exchange messages with shore

Specified by:
connect in interface ShoreMessaging
Throws:
ShoreMessagingHelper.ConnectFailed

downlinkMsg

protected void downlinkMsg(gnu.io.SerialPort serialPort,
                           byte[] msg,
                           int nMsgBytes,
                           java.io.InputStream inStream,
                           java.io.DataOutputStream outStream)
                    throws java.lang.Exception
Downlink a message

Throws:
java.lang.Exception

getUplinkMsgs

protected int getUplinkMsgs(gnu.io.SerialPort serialPort,
                            java.io.InputStream inStream,
                            java.io.OutputStream outStream)
                     throws java.lang.Exception
Get uplinked message(s) through modem and add to uplink queue

Throws:
java.lang.Exception

retrieveAndQueueUplink

protected void retrieveAndQueueUplink(int nUplinkBytes)
                               throws java.lang.Exception
Retrieve uplink message from modem and queue it for clients

Throws:
java.lang.Exception

openSerialPort

protected gnu.io.SerialPort openSerialPort(int baud)
                                    throws gnu.io.PortInUseException,
                                           gnu.io.UnsupportedCommOperationException,
                                           java.lang.Exception
Initialize serial port

Throws:
gnu.io.PortInUseException
gnu.io.UnsupportedCommOperationException
java.lang.Exception

sleep

protected void sleep(int sleepSec)
Sleep for specified number of seconds



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.