org.mbari.siam.devices.mclane
Class McLaneProfiler

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.PolledInstrumentService
                          extended by org.mbari.siam.devices.mclane.McLaneProfiler
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, ScheduleOwner, Device, DeviceServiceIF, Instrument

public class McLaneProfiler
extends PolledInstrumentService
implements Instrument

See Also:
Serialized Form

Field Summary
 
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
McLaneProfiler()
           
 
Method Summary
protected  ScheduleSpecifier createDefaultSampleSchedule()
          Return specifier for default sampling schedule.
 java.lang.String getFileListPath()
           
protected  byte[] getInstrumentStateMetadata()
          Get instrument 'metadata' from device itself.
 java.lang.String getLocalStorageDirectory()
           
 SerialPortParameters getSerialPortParameters()
          Subclass should return serial port parameters to use on port.
protected  PowerPolicy initCommunicationPowerPolicy()
          Return initial value of instrument communication power policy.
protected  int initCurrentLimit()
          Specify current limit in increments of 120 mA upto 11880 mA.
 java.lang.String initializeFileList()
          Initialize file list to persist an index of downloaded files Creates the file if it does not already exist.
 void initializeInstrument()
          Do instrument- and service-specific initialization.
 java.lang.String initializeLocalStorageDirectory()
          create mclane directory on local file system, as necessary
protected  PowerPolicy initInstrumentPowerPolicy()
          Return initial value of instrument power policy.
protected  int initInstrumentStartDelay()
          Specify startup delay (millisec)
protected  int initMaxSampleBytes()
          Return maximum number of bytes in a instrument data sample.
protected  byte[] initPromptString()
          Return instrument's "prompt" characters.
protected  byte[] initSampleTerminator()
          Return instrument's sample terminator characters.
protected  int readSample(byte[] sample)
          Read raw sample bytes from serial port into buffer, return number of bytes read.
protected  void requestSample()
          Request a data sample from instrument.
 void setClock(long epochMsecs)
          Set device's clock to specified time.
static java.lang.String[] split(java.lang.String stringToSplit, java.lang.String stringToSplitOn)
          how on earth did java make it to 1.3 without a split function? this one is probably pretty inneficient, but it should get the job done
 int test()
          Run device's self-test routine.
 java.io.File transferFile(java.lang.String fileName)
          This method will download the file specified by the given fileName from xmodem specified.
 
Methods inherited from class org.mbari.siam.core.PolledInstrumentService
acquire, doScheduledTask, setAttributes
 
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, getLastSample, getMaxSampleBytes, getMaxSampleTries, getMetadata, getMetadata, getMetadataPayload, getPackets, getPackets, getParent, getParser, 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, processSample, removeAllSchedules, removeSchedule, resetPortDiagnostics, resume, resumeSchedule, running, setClock, setCommunicationPowerPolicy, setCurrentLimit, setDefaultSampleScheduleName, setInstrumentPowerPolicy, setInstrumentServiceBlock, setInstrumentStartDelay, setMaxSampleBytes, setMaxSampleTries, setPromptString, setProperty, setRecordType, setSampleTerminator, setSampleTimeout, shutdown, shutdownInstrument, sleepingUntil, snooze, startDeviceAccess, summaryEnabled, suspend, 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, getParser, 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
 

Constructor Detail

McLaneProfiler

public McLaneProfiler()
               throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

initInstrumentPowerPolicy

protected PowerPolicy initInstrumentPowerPolicy()
Description copied from class: BaseInstrumentService
Return initial value of instrument power policy.

Specified by:
initInstrumentPowerPolicy in class BaseInstrumentService

initCommunicationPowerPolicy

protected PowerPolicy initCommunicationPowerPolicy()
Description copied from class: BaseInstrumentService
Return initial value of instrument communication power policy.

Specified by:
initCommunicationPowerPolicy in class BaseInstrumentService

initInstrumentStartDelay

protected int initInstrumentStartDelay()
Specify startup delay (millisec)

Specified by:
initInstrumentStartDelay in class BaseInstrumentService

initCurrentLimit

protected int initCurrentLimit()
Specify current limit in increments of 120 mA upto 11880 mA.

Specified by:
initCurrentLimit in class BaseInstrumentService

initSampleTerminator

protected byte[] initSampleTerminator()
Description copied from class: BaseInstrumentService
Return instrument's sample terminator characters.

Specified by:
initSampleTerminator in class BaseInstrumentService

initPromptString

protected byte[] initPromptString()
Description copied from class: BaseInstrumentService
Return instrument's "prompt" characters.

Specified by:
initPromptString in class BaseInstrumentService

initMaxSampleBytes

protected int initMaxSampleBytes()
Description copied from class: BaseInstrumentService
Return maximum number of bytes in a instrument data sample.

Specified by:
initMaxSampleBytes in class BaseInstrumentService

requestSample

protected void requestSample()
                      throws TimeoutException,
                             java.lang.Exception
Description copied from class: PolledInstrumentService
Request a data sample from instrument.

Specified by:
requestSample in class PolledInstrumentService
Throws:
TimeoutException
java.lang.Exception

readSample

protected int readSample(byte[] sample)
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.Exception
Description copied from class: BaseInstrumentService
Read raw sample bytes from serial port into buffer, return number of bytes read. Reads characters from serial port until sample terminator string is encountered.

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

getInstrumentStateMetadata

protected byte[] getInstrumentStateMetadata()
Description copied from class: BaseInstrumentService
Get instrument 'metadata' from device itself. By default, this method does nothing, and can be overridden. This method should return any available configuration information that is available from the instrument device. Note that this method should NOT power-manage the device, as that is the responsibility of the caller.

Overrides:
getInstrumentStateMetadata in class BaseInstrumentService

transferFile

public java.io.File transferFile(java.lang.String fileName)
                          throws java.lang.Exception,
                                 java.io.IOException
This method will download the file specified by the given fileName from xmodem specified. Because of the XModem implementation, the download will execute asynchronously. To allow for synchronous interaction with this method, a call to this.notifyAll is made when the download is complete. Therefore, you can make a call to wait() after calling transferFile and when the download is complete, the wait ing thread will be notified.

Parameters:
fileName -
Throws:
java.io.IOException
java.lang.Exception

split

public static java.lang.String[] split(java.lang.String stringToSplit,
                                       java.lang.String stringToSplitOn)
how on earth did java make it to 1.3 without a split function? this one is probably pretty inneficient, but it should get the job done

Parameters:
stringToSplit -
stringToSplitOn -
Returns:
resulting strings

createDefaultSampleSchedule

protected ScheduleSpecifier createDefaultSampleSchedule()
                                                 throws ScheduleParseException
Description copied from class: PolledInstrumentService
Return specifier for default sampling schedule. Subclasses MUST provide the default sample schedule.

Specified by:
createDefaultSampleSchedule in class PolledInstrumentService
Throws:
ScheduleParseException

setClock

public void setClock(long epochMsecs)
              throws NotSupportedException
Description copied from class: BaseInstrumentService
Set device's clock to specified time. DEPRECATED - use setClock() with no arguments.

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

getSerialPortParameters

public SerialPortParameters getSerialPortParameters()
Description copied from class: DeviceService
Subclass should return serial port parameters to use on port.

Overrides:
getSerialPortParameters in class DeviceService

initializeInstrument

public void initializeInstrument()
Description copied from class: BaseInstrumentService
Do instrument- and service-specific initialization. By default, this method does nothing, and may be overridden.

Overrides:
initializeInstrument in class BaseInstrumentService

test

public int test()
         throws java.rmi.RemoteException
Description copied from interface: Device
Run device's self-test routine.

Specified by:
test in interface Device
Throws:
java.rmi.RemoteException

initializeFileList

public java.lang.String initializeFileList()
Initialize file list to persist an index of downloaded files Creates the file if it does not already exist.


initializeLocalStorageDirectory

public java.lang.String initializeLocalStorageDirectory()
create mclane directory on local file system, as necessary


getLocalStorageDirectory

public java.lang.String getLocalStorageDirectory()
Returns:
Returns the localStorageDirectory.

getFileListPath

public java.lang.String getFileListPath()
Returns:
Returns the path to the fileList


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.