org.mbari.siam.devices.seabird.streamingSBE19
Class StreamingSBE19

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.core.DeviceService
                  extended by org.mbari.siam.core.BaseInstrumentService
                      extended by org.mbari.siam.core.StreamingInstrumentService
                          extended by org.mbari.siam.devices.seabird.streamingSBE19.StreamingSBE19
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, DeviceServiceIF, Instrument

public class StreamingSBE19
extends StreamingInstrumentService
implements Instrument

Instrument service for Seabird SBE19plus in profile mode (MP command)

See Also:
Serialized Form

Nested Class Summary
 class StreamingSBE19.SBE19Attributes
          Service attributes.
 class StreamingSBE19.SBE19DevicePacketParser
           
 
Nested classes/interfaces inherited from class org.mbari.siam.core.StreamingInstrumentService
StreamingInstrumentService.Attributes
 
Field Summary
protected  DevicePacketParser _devicePacketParser
           
protected  TurbidityEventDetector _eventDetector
           
protected  byte[] _getCalCmd
           
protected  byte[] _getPrompt
           
protected  byte[] _getStatusInfo
           
protected  int _maxCalBytes
           
protected  int _maxStatusBytes
           
protected  byte[] cmdbuf
          Scratch buffer for sending commands
protected  int[] FIELD_WIDTHS
          Widths of temperature, conductivity, pressure, volt1, volt2, volt3, and volt4 fields
protected static int MAX_SAMPLE_BYTES
           
protected  int N_FIELDS
          Number of fields in a SBE record (temperature, conductivity, pressure, volt1, volt2, volt3, volt4)
 
Fields inherited from class org.mbari.siam.core.StreamingInstrumentService
_shutdown, _subsampleInterval, _suspend
 
Fields inherited from class org.mbari.siam.core.BaseInstrumentService
_defaultSamplerTask, _defaultSampleScheduleName, _errorCache, _instrumentAttributes, _lastPacket, _lastSensorDataPacket, _maxSampleBytes, _messagePacket, _nPowerRequests, _nWakeRequests, _packetLog, _recordType, _running, _samplerWakeupTime, _scheduleKey, _schedules, _sensorDataPacket, _turbinator, MAX_BASE_RECORDTYPE, RECORDTYPE_DEFAULT, RECORDTYPE_METADATA, RECORDTYPE_UNDEFINED
 
Fields inherited from class org.mbari.siam.core.DeviceService
_fromDevice, _instrumentPort, _nodeProperties, _parentNode, _regEntry, _sandBox, _serviceCachePath, _serviceName, _servicePropertiesPath, _serviceXMLPath, _toDevice, CACHED_PROPERTIES_FILENAME, PROPERTIES_FILENAME, XML_FILENAME
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.mbari.siam.distributed.Device
ERROR, INITIAL, INSTRUMENT_STATE, MDATA_ALL, OK, SAFE, SAMPLING, SERVICE_ATTRIBUTES, SERVICE_CACHE, SERVICE_PROPERTIES, SERVICE_XML, SHUTDOWN, SLEEPING, SUSPEND, UNKNOWN
 
Constructor Summary
StreamingSBE19()
          Parser used to convert SensorDataPackets into SiamRecords that can be consumed by the SummaryBlock
 
Method Summary
protected  ScheduleSpecifier createDefaultSampleSchedule()
          Return specifier for default sampling schedule.
 DevicePacketParser getDevicePacketParser()
          Get instruments' DevicePacketParser, which returns JDDAC records.
protected  byte[] getInstrumentStateMetadata()
          Get device's notion of its state: a Seabird status packet.
 PacketParser getParser()
          Return CTD packet parser.
protected  void getPrompt()
          Try to get instrument prompt
protected  boolean getPrompt(int retries)
          Try to get prompt.
 SerialPortParameters getSerialPortParameters()
          Return parameters to use on serial port.
protected  float getTransmisChannel(java.lang.String sample)
           
protected  PowerPolicy initCommunicationPowerPolicy()
          Return initial value of instrument power policy.
protected  int initCurrentLimit()
          Return initial value of DPA current limit.
protected  void initializeInstrument()
          Initialize the Instrument This means to set all initial settings - This section for one time only instrument settings
protected  PowerPolicy initInstrumentPowerPolicy()
          Return initial value of instrument power policy.
protected  int initInstrumentStartDelay()
          Return initial value of instrument startup time in millisec.
protected  int initMaxSampleBytes()
          Return initial value for maximum number of bytes in a instrument data sample.
protected  byte[] initPromptString()
          Return initial value for instrument's "prompt" character.
protected  byte[] initSampleTerminator()
          Return initial value for instrument's sample terminator
protected  boolean isStreaming()
          Return true if instrument is streaming.
protected  SensorDataPacket processSample(byte[] sample, int nBytes)
          Process latest acquired sample.
protected  int readSample(byte[] sample)
          Read an instrument sample
 void sendCommand(java.lang.String cmd)
          Method to send a command and wait for the prompt.
 void sendCommand(java.lang.String cmd, long timeout)
          Method to send a command and wait for the prompt.
 void sendCommandConfirm(java.lang.String cmd)
          Method to send a command for which the SBE-19 requires confirmation.
 void setClock()
          Set Seabird's clock.
protected  java.lang.String shutdownInstrument()
          Make sure to terminate measurement mode - it is "bad" to disconnect power while in measurement mode.
protected  void startStreaming()
          Put instrument into streaming mode
protected  void stopStreaming()
          Stop streaming
 int test()
          Self-test routine; This does nothing in the Aquadopp driver
protected  boolean validateRecord(byte[] dataPoint, int nBytes)
          Internal routine to determine whether an individual data point is valid.
 
Methods inherited from class org.mbari.siam.core.StreamingInstrumentService
acquire, acquireFromStream, doneAcquiring, doScheduledTask, resume, setAttributes, shutdown, suspend
 
Methods inherited from class org.mbari.siam.core.BaseInstrumentService
acquireSample, addDefaultPacketFilters, addSchedule, addSchedule, annotate, assertSamplingState, cacheProperties, callDataListeners, canSummarize, checkInputProperties, cleanupServiceState, clearDefaultPacketFilters, clearPropertiesCache, createPacketLog, createTask, createTurbinators, disableSummary, enableSummary, endDeviceAccess, getAllSchedules, getChildren, getCommunicationPowerPolicy, getCurrentLimit, getDefaultPacketFilters, getDefaultSampleSchedule, getDefaultSampleScheduleName, getFileBytes, getInstrumentPowerPolicy, getInstrumentServiceBlock, getInstrumentStartDelay, getLastSample, getMaxSampleBytes, getMaxSampleTries, getMetadata, getMetadata, getMetadataPayload, getPackets, getPackets, getParent, getPortDiagnostics, getPortDiagnosticsSummary, getPromptString, getProperties, getProperty, getSampleBuf, getSampleSchedule, getSampleTerminator, getSampleTimeout, getSchedule, getScheduleKey, getSchedules, getServicePropertiesBytes, initialize, initializeDriverDefaults, initializePooledResources, interruptDeviceAccess, logPacket, managePowerSleep, managePowerWake, nPowerRequests, postSample, powerOff, powerOffCallback, powerOn, powerOnCallback, prepareToRun, prepareToSample, printData, removeAllSchedules, removeSchedule, resetPortDiagnostics, resumeSchedule, running, setClock, setCommunicationPowerPolicy, setCurrentLimit, setDefaultSampleScheduleName, setInstrumentPowerPolicy, setInstrumentServiceBlock, setInstrumentStartDelay, setMaxSampleBytes, setMaxSampleTries, setPromptString, setProperty, setRecordType, setSampleTerminator, setSampleTimeout, sleepingUntil, snooze, startDeviceAccess, summaryEnabled, suspendSchedule, sync, syncSchedule, validateSample
 
Methods inherited from class org.mbari.siam.core.DeviceService
addDataListener, advertiseService, createRegistryEntry, getAttributes, getCommPortName, getFrameworkVersion, getId, getInstrumentPort, getLocation, getName, getRemoteSerialPort, getRemoteSerialPort, getSamplingCount, getSamplingErrorCount, getSamplingRetryCount, getStatus, host, incRetryCount, initializePropertyDefaults, registryEntry, registryName, removeDataListener, setInstrumentPort, setNodeProperties, setParent, setSerialPort, setStatusError, setStatusInitial, setStatusOk, setStatusSafe, setStatusSampling, setStatusShutdown, setStatusSuspend
 
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.Instrument
acquireSample, addDefaultPacketFilters, annotate, cacheProperties, clearDefaultPacketFilters, clearPropertiesCache, disableSummary, enableSummary, getDefaultPacketFilters, getLastSample, getPackets, getPackets, getPortDiagnostics, getPortDiagnosticsSummary, getProperties, getProperty, getSampleSchedule, getSchedules, resetPortDiagnostics, setClock, setProperty, summaryEnabled
 
Methods inherited from interface org.mbari.siam.distributed.Device
getChildren, getCommPortName, getFrameworkVersion, getId, getLocation, getMetadata, getName, getParent, getSamplingCount, getSamplingErrorCount, getSamplingRetryCount, getStatus, host, powerOff, powerOn, prepareToRun, resume, shutdown, suspend
 
Methods inherited from interface org.mbari.siam.distributed.DeviceServiceIF
getName
 
Methods inherited from interface org.mbari.siam.core.ScheduleOwner
addSchedule, getAllSchedules, getScheduleKey, removeAllSchedules, removeSchedule, resumeSchedule, sleepingUntil, suspendSchedule, syncSchedule
 

Field Detail

_eventDetector

protected TurbidityEventDetector _eventDetector

cmdbuf

protected byte[] cmdbuf
Scratch buffer for sending commands


_getPrompt

protected byte[] _getPrompt

_getStatusInfo

protected byte[] _getStatusInfo

_getCalCmd

protected byte[] _getCalCmd

_maxStatusBytes

protected int _maxStatusBytes

_maxCalBytes

protected int _maxCalBytes

MAX_SAMPLE_BYTES

protected static final int MAX_SAMPLE_BYTES
See Also:
Constant Field Values

_devicePacketParser

protected DevicePacketParser _devicePacketParser

N_FIELDS

protected final int N_FIELDS
Number of fields in a SBE record (temperature, conductivity, pressure, volt1, volt2, volt3, volt4)

See Also:
Constant Field Values

FIELD_WIDTHS

protected final int[] FIELD_WIDTHS
Widths of temperature, conductivity, pressure, volt1, volt2, volt3, and volt4 fields

Constructor Detail

StreamingSBE19

public StreamingSBE19()
               throws java.rmi.RemoteException
Parser used to convert SensorDataPackets into SiamRecords that can be consumed by the SummaryBlock

Throws:
java.rmi.RemoteException
Method Detail

initPromptString

protected byte[] initPromptString()
Return initial value for instrument's "prompt" character.

Specified by:
initPromptString in class BaseInstrumentService

initSampleTerminator

protected byte[] initSampleTerminator()
Return initial value for instrument's sample terminator

Specified by:
initSampleTerminator in class BaseInstrumentService

initCurrentLimit

protected int initCurrentLimit()
Return initial value of DPA current limit.

Specified by:
initCurrentLimit in class BaseInstrumentService

initInstrumentPowerPolicy

protected PowerPolicy initInstrumentPowerPolicy()
Return initial value of instrument power policy.

Specified by:
initInstrumentPowerPolicy in class BaseInstrumentService

initCommunicationPowerPolicy

protected PowerPolicy initCommunicationPowerPolicy()
Return initial value of instrument power policy.

Specified by:
initCommunicationPowerPolicy in class BaseInstrumentService

initInstrumentStartDelay

protected int initInstrumentStartDelay()
Return initial value of instrument startup time in millisec.

Specified by:
initInstrumentStartDelay in class BaseInstrumentService

initMaxSampleBytes

protected int initMaxSampleBytes()
Return initial value for maximum number of bytes in a instrument data sample.

Specified by:
initMaxSampleBytes in class BaseInstrumentService

initializeInstrument

protected void initializeInstrument()
                             throws InitializeException,
                                    java.lang.Exception
Initialize the Instrument This means to set all initial settings - This section for one time only instrument settings

Overrides:
initializeInstrument in class StreamingInstrumentService
Throws:
InitializeException
java.lang.Exception

getPrompt

protected void getPrompt()
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.NullPointerException,
                         java.lang.Exception
Try to get instrument prompt

Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getPrompt

protected boolean getPrompt(int retries)
Try to get prompt. Try retries times


sendCommand

public void sendCommand(java.lang.String cmd,
                        long timeout)
                 throws TimeoutException,
                        java.lang.NullPointerException,
                        java.io.IOException,
                        java.lang.Exception
Method to send a command and wait for the prompt. May throw exception if it doesn't find a prompt.

Throws:
TimeoutException
java.lang.NullPointerException
java.io.IOException
java.lang.Exception

sendCommand

public void sendCommand(java.lang.String cmd)
                 throws TimeoutException,
                        java.lang.NullPointerException,
                        java.io.IOException,
                        java.lang.Exception
Method to send a command and wait for the prompt. Default timeout of 5 seconds. May throw exception if it doesn't find a prompt.

Throws:
TimeoutException
java.lang.NullPointerException
java.io.IOException
java.lang.Exception

sendCommandConfirm

public void sendCommandConfirm(java.lang.String cmd)
                        throws TimeoutException,
                               java.lang.NullPointerException,
                               java.io.IOException,
                               java.lang.Exception
Method to send a command for which the SBE-19 requires confirmation. Unfortunately, there appears to be two different modes of confirmation, depending on the firmware in the SBE-19. You either need to send the command a second time, or you need to confirm with a 'Y'. This method tries to parse the prompt and do the right thing.

Throws:
TimeoutException
java.lang.NullPointerException
java.io.IOException
java.lang.Exception

getSerialPortParameters

public SerialPortParameters getSerialPortParameters()
                                             throws gnu.io.UnsupportedCommOperationException
Return parameters to use on serial port.

Overrides:
getSerialPortParameters in class DeviceService
Throws:
gnu.io.UnsupportedCommOperationException

stopStreaming

protected void stopStreaming()
                      throws java.lang.Exception
Stop streaming

Specified by:
stopStreaming in class StreamingInstrumentService
Throws:
java.lang.Exception

isStreaming

protected boolean isStreaming()
Return true if instrument is streaming.

Specified by:
isStreaming in class StreamingInstrumentService

startStreaming

protected void startStreaming()
                       throws java.lang.Exception
Put instrument into streaming mode

Specified by:
startStreaming in class StreamingInstrumentService
Throws:
java.lang.Exception

setClock

public void setClock()
Set Seabird's clock. Note: may stop, but does not resume logging or quit session

Specified by:
setClock in interface Instrument
Overrides:
setClock in class BaseInstrumentService

createDefaultSampleSchedule

protected ScheduleSpecifier createDefaultSampleSchedule()
                                                 throws ScheduleParseException
Return specifier for default sampling schedule.

Specified by:
createDefaultSampleSchedule in class BaseInstrumentService
Throws:
ScheduleParseException

getInstrumentStateMetadata

protected byte[] getInstrumentStateMetadata()
Get device's notion of its state: a Seabird status packet.

Overrides:
getInstrumentStateMetadata in class BaseInstrumentService

getParser

public PacketParser getParser()
Return CTD packet parser.

Specified by:
getParser in interface Instrument
Overrides:
getParser in class BaseInstrumentService

getDevicePacketParser

public DevicePacketParser getDevicePacketParser()
                                         throws NotSupportedException
Description copied from class: BaseInstrumentService
Get instruments' DevicePacketParser, which returns JDDAC records. Not supported by default

Overrides:
getDevicePacketParser in class BaseInstrumentService
Throws:
NotSupportedException

test

public int test()
Self-test routine; This does nothing in the Aquadopp driver

Specified by:
test in interface Device

validateRecord

protected boolean validateRecord(byte[] dataPoint,
                                 int nBytes)
Internal routine to determine whether an individual data point is valid. Note this differs from validateSample(), in that it validates a single data point within a sample, and not the entire sample.


readSample

protected int readSample(byte[] sample)
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.Exception
Read an instrument sample

Overrides:
readSample in class BaseInstrumentService
Parameters:
sample - output buffer
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

getTransmisChannel

protected float getTransmisChannel(java.lang.String sample)
                            throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException

processSample

protected SensorDataPacket processSample(byte[] sample,
                                         int nBytes)
                                  throws java.lang.Exception
Process latest acquired sample. Note that sample includes multiple SBE records (specified by samplesPerPacket attribute)

Overrides:
processSample in class BaseInstrumentService
Parameters:
sample - raw sample
nBytes - number of bytes in raw sample
Throws:
java.lang.Exception

shutdownInstrument

protected java.lang.String shutdownInstrument()
                                       throws java.lang.Exception
Make sure to terminate measurement mode - it is "bad" to disconnect power while in measurement mode.

Overrides:
shutdownInstrument in class BaseInstrumentService
Throws:
java.lang.Exception


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.