org.mbari.siam.devices.ysi
Class Ysi

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.ysi.Ysi
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, DeviceServiceIF, Instrument

public class Ysi
extends StreamingInstrumentService
implements Instrument

See Also:
Serialized Form

Nested Class Summary
 class Ysi.Attributes
          Service attributes.
static class Ysi.ysiPacketParser
          Ysi packet parser
 
Field Summary
 Ysi.Attributes _attributes
           
protected  java.lang.String _defaultSampleInterval
           
protected  java.lang.String[] _disableAutoSleep
           
protected  java.lang.String[] _disableHeader
           
protected  boolean _isSampling
           
protected  java.lang.String[] _setDiscreetSampleInterval
           
protected  boolean _setSensors
           
protected  java.lang.String[] _startSampleCmd
           
 
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
Ysi()
          Constructor
 
Method Summary
protected  ScheduleSpecifier createDefaultSampleSchedule()
          Return default sampling schedule.
 void exitToPrompt()
          Ysi method to return to the "#" prompt no matter where you are.
 PacketParser getParser()
          Return Ysi Packet Parser.
protected  boolean[] getSensorState()
          Determine state of (Ysi 600) Sensors (Enabled / Disabled).
 SerialPortParameters getSerialPortParameters()
          Serial Port Params.
protected  PowerPolicy initCommunicationPowerPolicy()
          Set to NEVER for testing purposes.
protected  int initCurrentLimit()
          Return Instrument current limit.
protected  void initializeInstrument()
          Initialize Instrument
protected  PowerPolicy initInstrumentPowerPolicy()
          Set to NEVER for testing purposes.
protected  int initInstrumentStartDelay()
          Return instrument start delay.
protected  int initMaxSampleBytes()
          Return maximum number of bytes for instrument sample.
protected  byte[] initPromptString()
          Return instrument prompt string.
protected  byte[] initSampleTerminator()
          Return instrument sample terminator.
protected  boolean isStreaming()
          Return Ysi streaming state.
protected  SensorDataPacket processSample(byte[] sample, int nBytes)
          Write Ysi data to the Turbinator.
protected  void reportSetup()
          Parse the Report Setup menu (Ysi 600) and check against sensors enabled && attributes (or assume setSensors has already been called).
protected  void startStreaming()
          Bring instrument to discreet streaming mode and parse to reach sample.
protected  void stopStreaming()
          Stop Ysi streaming - call method exitToPrompt().
 int test()
          This doesn't really do anything...
protected  boolean writeSensorStates(boolean dep, boolean par, java.lang.String cmd)
          Use in getSensorStates().
 
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, getDevicePacketParser, getFileBytes, getInstrumentPowerPolicy, getInstrumentServiceBlock, getInstrumentStartDelay, getInstrumentStateMetadata, 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, readSample, removeAllSchedules, removeSchedule, resetPortDiagnostics, resumeSchedule, running, setClock, setClock, setCommunicationPowerPolicy, setCurrentLimit, setDefaultSampleScheduleName, setInstrumentPowerPolicy, setInstrumentServiceBlock, setInstrumentStartDelay, setMaxSampleBytes, setMaxSampleTries, setPromptString, setProperty, setRecordType, setSampleTerminator, setSampleTimeout, shutdownInstrument, 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, 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

_isSampling

protected boolean _isSampling

_setSensors

protected boolean _setSensors

_startSampleCmd

protected java.lang.String[] _startSampleCmd

_defaultSampleInterval

protected java.lang.String _defaultSampleInterval

_setDiscreetSampleInterval

protected java.lang.String[] _setDiscreetSampleInterval

_disableHeader

protected java.lang.String[] _disableHeader

_disableAutoSleep

protected java.lang.String[] _disableAutoSleep

_attributes

public Ysi.Attributes _attributes
Constructor Detail

Ysi

public Ysi()
    throws java.rmi.RemoteException
Constructor

Throws:
java.rmi.RemoteException
Method Detail

initializeInstrument

protected void initializeInstrument()
                             throws TimeoutException,
                                    InitializeException,
                                    java.lang.Exception
Initialize Instrument

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

startStreaming

protected void startStreaming()
                       throws java.lang.Exception
Bring instrument to discreet streaming mode and parse to reach sample.

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

stopStreaming

protected void stopStreaming()
                      throws java.lang.Exception
Stop Ysi streaming - call method exitToPrompt().

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

exitToPrompt

public void exitToPrompt()
                  throws java.lang.Exception
Ysi method to return to the "#" prompt no matter where you are.

Throws:
java.lang.Exception

getSensorState

protected boolean[] getSensorState()
                            throws java.lang.Exception
Determine state of (Ysi 600) Sensors (Enabled / Disabled). This method is called in reportSetup(). Example of Sensor Menu: ------------Sensors enabled------------ 1-(*)Time 5-(*)Pressure-Abs 2-(*)Temperature 6-( )ISE1 pH 3-(*)Conductivity 7-( )ISE2 Orp 4-( )Dissolved Oxy 8-(*)Battery Select option (0 for previous menu): Note that the Sensor # does not correspond to the _sensorStatesParsed[#]. See field comment. ALSO /** Compares the Ysi (600) parsed sensor states to the sensor state dependencies based on reported attributes and sets them accordingly. Case List:0=Time,1=Pressure-Abs,2=Temperature,3=ISE1 pH,4=Conductivity,5=ISE2 Orp,6=Dissolved Oxygen,7=Battery

Returns:
Boolean array of sensor states set.
Throws:
java.lang.Exception

writeSensorStates

protected boolean writeSensorStates(boolean dep,
                                    boolean par,
                                    java.lang.String cmd)
                             throws java.lang.Exception
Use in getSensorStates(). This will check the dependency vs. parsed and 'set' the sensor state.

Throws:
java.lang.Exception

reportSetup

protected void reportSetup()
                    throws java.lang.Exception
Parse the Report Setup menu (Ysi 600) and check against sensors enabled && attributes (or assume setSensors has already been called). Following menu is with all sensors enabled. -------------Report setup-------------- 1-(*)Date A-(*)DO mg/L 2-(*)Time hh:mm:ss B-( )DOchrg 3-(*)Temp C C-( )Press 4-(*)SpCond mS/cm D-(*)Depth meters 5-( )Cond E-( )pH 6-( )Resist F-( )pH mV 7-( )TDS G-( )Orp mV 8-(*)Sal ppt H-(*)Battery volts 9-(*)DOsat % Select option (0 for previous menu):

Throws:
java.lang.Exception

processSample

protected SensorDataPacket processSample(byte[] sample,
                                         int nBytes)
                                  throws java.lang.Exception
Write Ysi data to the Turbinator.

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

isStreaming

protected boolean isStreaming()
Return Ysi streaming state.

Specified by:
isStreaming in class StreamingInstrumentService

createDefaultSampleSchedule

protected ScheduleSpecifier createDefaultSampleSchedule()
                                                 throws ScheduleParseException
Description copied from class: BaseInstrumentService
Return default sampling schedule.

Specified by:
createDefaultSampleSchedule in class BaseInstrumentService
Throws:
ScheduleParseException

initMaxSampleBytes

protected int initMaxSampleBytes()
Return maximum number of bytes for instrument sample.

Specified by:
initMaxSampleBytes in class BaseInstrumentService

initPromptString

protected byte[] initPromptString()
Return instrument prompt string.

Specified by:
initPromptString in class BaseInstrumentService

initSampleTerminator

protected byte[] initSampleTerminator()
Return instrument sample terminator.

Specified by:
initSampleTerminator in class BaseInstrumentService

initCurrentLimit

protected int initCurrentLimit()
Return Instrument current limit.

Specified by:
initCurrentLimit in class BaseInstrumentService

initInstrumentStartDelay

protected int initInstrumentStartDelay()
Return instrument start delay.

Specified by:
initInstrumentStartDelay in class BaseInstrumentService

initInstrumentPowerPolicy

protected PowerPolicy initInstrumentPowerPolicy()
Set to NEVER for testing purposes.

Specified by:
initInstrumentPowerPolicy in class BaseInstrumentService

initCommunicationPowerPolicy

protected PowerPolicy initCommunicationPowerPolicy()
Set to NEVER for testing purposes.

Specified by:
initCommunicationPowerPolicy in class BaseInstrumentService

test

public int test()
This doesn't really do anything...

Specified by:
test in interface Device

getParser

public PacketParser getParser()
Return Ysi Packet Parser.

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

getSerialPortParameters

public SerialPortParameters getSerialPortParameters()
                                             throws gnu.io.UnsupportedCommOperationException
Serial Port Params.

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


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.