|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.mbari.siam.core.DeviceService
org.mbari.siam.core.BaseInstrumentService
org.mbari.siam.core.PolledInstrumentService
org.mbari.siam.devices.sunburst.SAMI
public class SAMI
This SAMI class is the InstrumentServices driver
for sampling the Sunburst SAMI CO2 sensor. This driver has limited ability
to change the SAMI sampling parameters. At initialization, or when the
system changes its sampling schedule or blank attribute, it
will stop the SAMI and restart it with the new schedule and/or blank
interval. In order to do so, it must wait until the next sample time
(as defined by the default sampleSchedule), at which time it will issue
^C to stop it and then reprogram it. Note that this process can take up to
one entire sampleSchedule interval, which can be up to 6 hours.
In all other cases, this SAMI driver simply listens passively for an instrument
sample every sampleSchedule
seconds. The instrument must be set up externally prior to deployment.
BaseInstrumentService,
PolledInstrumentService,
Instrument,
Serialized Form| Nested Class Summary | |
|---|---|
class |
SAMI.SAMIAttributes
Configurable SAMI attributes |
| Field Summary | |
|---|---|
SAMI.SAMIAttributes |
_attributes
|
protected java.util.Calendar |
_calendar
|
protected byte[] |
_colon
|
protected byte[] |
_comma
|
protected boolean |
_firstInit
TRUE if just finished initializing instrument |
protected boolean |
_inBlank
indicates we're currently running a blank sample |
protected byte[] |
_lineBuffer
Line buffer for operations |
protected byte[] |
_newline
|
protected long |
_nextInterval
Seconds to next sample |
protected byte[] |
_pound
|
protected boolean |
_reinit
boolean to reinitialize the device |
protected int |
_sampleIntervalSec
Sample interval seconds derived from default sample schedule |
protected java.text.DateFormat |
_timeFormatter
|
| 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 | |
|---|---|
SAMI()
Allocates a new SAMI |
|
| Method Summary | |
|---|---|
int |
addSchedule(java.lang.String name,
java.lang.String schedule,
boolean overwrite)
We override addschedule so we know when to reinitialize the device for the new schedule. |
protected ScheduleSpecifier |
createDefaultSampleSchedule()
Return specifier for initial sampling schedule. |
protected void |
enterCommandMode()
Sends a ^C to the SAMI and wait for a prompt |
PacketParser |
getParser()
Return a PacketParser. |
SerialPortParameters |
getSerialPortParameters()
Return parameters to use on serial port. |
protected int |
getSetSampleInterval()
Get sample interval closest to that supported by device. |
protected PowerPolicy |
initCommunicationPowerPolicy()
Return initial value of communication power policy. |
protected int |
initCurrentLimit()
Specify current limit in increments of 120 mA upto 11880 mA. |
protected void |
initializeInstrument()
Called by the framework to initialize the instrument prior to sampling. |
protected PowerPolicy |
initInstrumentPowerPolicy()
Return initial value of instrument power policy. |
protected int |
initInstrumentStartDelay()
Specify startup delay (millisec) |
protected int |
initMaxSampleBytes()
Specify maximum bytes in raw sample. |
protected byte[] |
initPromptString()
Specify prompt string. |
protected byte[] |
initSampleTerminator()
Specify sample terminator. |
protected SensorDataPacket |
processSample(byte[] sample,
int nBytes)
Process raw sample bytes, return TimeStampedData object. |
protected int |
readSample(byte[] sample)
Read raw sample bytes from serial port into buffer, return number of bytes read. |
protected int |
readUntilDelayOrNewline(java.io.InputStream instream,
byte[] buffer,
long timeout)
Internal method to read one line from instrument |
protected void |
reinitializeInstrument()
Called from within requestSample() whenever the system has updated a schedule or attribute that causes the need to reinitialize the instrument |
protected void |
requestSample()
This method should be called guardSec seconds before the expected receipt of the sample. |
protected java.lang.String |
shutdownInstrument()
Shutdown instrument sampling. |
int |
test()
Run device's self-test routine. |
protected boolean |
waitForSample(long waitSeconds)
Local protected method to wait for first character of sample |
protected void |
writeDebug(int val,
java.lang.String field,
java.lang.String prompt)
|
protected void |
writeDeviceInteger(int val)
Convert integer to ASCII, send it to instrument followed by carriage return. |
| Methods inherited from class org.mbari.siam.core.PolledInstrumentService |
|---|
acquire, doScheduledTask, setAttributes |
| 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 |
|---|
getAllSchedules, getScheduleKey, removeAllSchedules, removeSchedule, resumeSchedule, sleepingUntil, suspendSchedule, syncSchedule |
| Field Detail |
|---|
public SAMI.SAMIAttributes _attributes
protected int _sampleIntervalSec
protected boolean _reinit
protected boolean _firstInit
protected boolean _inBlank
protected long _nextInterval
protected byte[] _lineBuffer
protected byte[] _comma
protected byte[] _pound
protected byte[] _colon
protected byte[] _newline
protected java.text.DateFormat _timeFormatter
protected java.util.Calendar _calendar
| Constructor Detail |
|---|
public SAMI()
throws java.rmi.RemoteException
SAMI
java.rmi.RemoteException - .| Method Detail |
|---|
protected int initInstrumentStartDelay()
initInstrumentStartDelay in class BaseInstrumentServiceprotected byte[] initPromptString()
initPromptString in class BaseInstrumentServiceprotected byte[] initSampleTerminator()
initSampleTerminator in class BaseInstrumentServiceprotected int initMaxSampleBytes()
initMaxSampleBytes in class BaseInstrumentServiceprotected int initCurrentLimit()
initCurrentLimit in class BaseInstrumentServiceprotected PowerPolicy initInstrumentPowerPolicy()
initInstrumentPowerPolicy in class BaseInstrumentServiceprotected PowerPolicy initCommunicationPowerPolicy()
initCommunicationPowerPolicy in class BaseInstrumentService
protected ScheduleSpecifier createDefaultSampleSchedule()
throws ScheduleParseException
createDefaultSampleSchedule in class PolledInstrumentServiceScheduleParseException
public SerialPortParameters getSerialPortParameters()
throws gnu.io.UnsupportedCommOperationException
getSerialPortParameters in class DeviceServicegnu.io.UnsupportedCommOperationException
protected void initializeInstrument()
throws InitializeException,
java.lang.Exception
initializeInstrument in class BaseInstrumentServiceInitializeException
java.lang.Exception
protected void requestSample()
throws java.io.IOException,
TimeoutException,
java.lang.InterruptedException,
InvalidDataException,
InitializeException
requestSample in class PolledInstrumentServicejava.io.IOException
TimeoutException
java.lang.InterruptedException
InvalidDataException
InitializeException
protected int readSample(byte[] sample)
throws TimeoutException,
java.io.IOException,
java.lang.Exception
readSample in class BaseInstrumentServicesample - output buffer
TimeoutException
java.io.IOException
java.lang.Exception
protected SensorDataPacket processSample(byte[] sample,
int nBytes)
throws java.lang.Exception
processSample in class BaseInstrumentServicesample - raw samplenBytes - number of bytes in raw sample
java.lang.Exception
protected java.lang.String shutdownInstrument()
throws java.lang.Exception
shutdownInstrument in class BaseInstrumentServicejava.lang.Exception
public int addSchedule(java.lang.String name,
java.lang.String schedule,
boolean overwrite)
addSchedule in interface ScheduleOwneraddSchedule in class BaseInstrumentServicename - Schedule nameschedule - Representation of scheduleoverwrite - If true, replace existing schedule
public PacketParser getParser()
throws NotSupportedException
getParser in interface InstrumentgetParser in class BaseInstrumentServiceNotSupportedException
protected boolean waitForSample(long waitSeconds)
throws java.io.IOException,
java.lang.InterruptedException
java.lang.InterruptedException - if Device status changes from Device.SAMPLING
java.io.IOException
protected void enterCommandMode()
throws java.io.IOException,
TimeoutException
java.io.IOException
TimeoutException
protected int getSetSampleInterval()
throws InitializeException
InitializeException
protected int readUntilDelayOrNewline(java.io.InputStream instream,
byte[] buffer,
long timeout)
throws java.io.IOException,
TimeoutException
java.io.IOException
TimeoutException
protected void writeDeviceInteger(int val)
throws java.io.IOException
java.io.IOException
protected void writeDebug(int val,
java.lang.String field,
java.lang.String prompt)
protected void reinitializeInstrument()
throws java.io.IOException,
InitializeException,
TimeoutException,
java.lang.InterruptedException
java.io.IOException
InitializeException
TimeoutException
java.lang.InterruptedExceptionpublic int test()
Device
test in interface Device
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||