public class Client extends Object
Only a single thread should manipulate an instance of this class. Only a single stream of data records should be in use at any time since advancing to the next record involves updating the record index register on the instrument before reading the record data registers. This lazy retrieval allows you to skip needless I/O if you decide you don't want all the stored records.
| Constructor and Description |
|---|
Client(Hardware hw)
Stores a reference to a Hardware object used to communicate with the instrument and
reads the device model and the register map version.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
alarmIsEnabled(DataChannel chan)
Gets the alarm enable status for a particle channel.
|
void |
clearAllRecords()
Delete all records currently stored in the instrument.
|
long |
getAlarmThreshold(DataChannel chan)
Gets the current alarm threshold for a particle channel.
|
java.time.Instant |
getClock()
Gets the device's time-of-day clock.
|
String |
getModel()
Gets the model of Lighthouse counter hardware (read by constructor).
|
java.util.stream.Stream<DataRecord> |
getRecentRecords(java.time.Instant threshold)
Gets the data records more recent than a given time.
|
java.util.stream.Stream<DataRecord> |
getRecordsByIndex(int start,
int limit)
Gets the data records specified by
start and limit. |
int |
getRegisterMapVersion()
Gets the version of the Modbus register map used by the hardware (read by constructor).
|
void |
setAlarmEnable(DataChannel chan,
boolean on)
Enables or disables the alarm for a particle channel.
|
void |
setAlarmThreshold(DataChannel chan,
long threshold)
Sets the particle count alarm threshold for a particle channel but doesn't
change the alarm enable status.
|
void |
setClock(java.time.Duration tolerance)
Sets the device's time-of-day clock to the current system time.
|
void |
startRecording()
Starts automatic data collection.
|
void |
stopRecording()
Stops data collection.
|
public Client(Hardware hw) throws org.lsst.ccs.drivers.commons.DriverException
hw - The communications object.org.lsst.ccs.drivers.commons.DriverException - if communication problems arise.public String getModel()
public int getRegisterMapVersion()
public void stopRecording()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException - if communication problems arise.public void startRecording()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException - if communication problems arise.public java.util.stream.Stream<DataRecord> getRecordsByIndex(int start, int limit) throws org.lsst.ccs.drivers.commons.DriverException
start and limit.start - Specifies the index of the earliest record to fetch.
A non-negative value means index while a negative value
means index N + start, where N is the total number of records
available.limit - The number of records to fetch, with zero meaning all after the starting
point.org.lsst.ccs.drivers.commons.DriverException - if communication problems arise or if data collection
hasn't been stopped.public java.util.stream.Stream<DataRecord> getRecentRecords(java.time.Instant threshold) throws org.lsst.ccs.drivers.commons.DriverException
threshold - All records returned will be more recent than this.org.lsst.ccs.drivers.commons.DriverException - if communication problems arise or if data collection
hasn't been stopped.public void clearAllRecords()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException - if communication problems arise or if data collection
hasn't been stopped.public void setAlarmThreshold(DataChannel chan, long threshold) throws org.lsst.ccs.drivers.commons.DriverException
chan - The channel to be affected.threshold - The limiting particle count.org.lsst.ccs.drivers.commons.DriverException - for I/O errors.IllegalArgumentException - if the channel is analog or if the threshold
is not in the interval [0, 2^32-1].public long getAlarmThreshold(DataChannel chan) throws org.lsst.ccs.drivers.commons.DriverException
chan - The channel to query.org.lsst.ccs.drivers.commons.DriverException - for I/O errors.IllegalArgumentException - if the channel is analog.public void setAlarmEnable(DataChannel chan, boolean on) throws org.lsst.ccs.drivers.commons.DriverException
chan - The channel to affect.on - true to enable alarms, false to disable.org.lsst.ccs.drivers.commons.DriverException - for I/O errors.IllegalArgumentException - if the channel is analog.public boolean alarmIsEnabled(DataChannel chan) throws org.lsst.ccs.drivers.commons.DriverException
chan - The channel to query.org.lsst.ccs.drivers.commons.DriverException - for I/O errors.IllegalArgumentException - if the channel is analog.public void setClock(java.time.Duration tolerance)
throws org.lsst.ccs.drivers.commons.DriverException
tolerance - When read back the device clock must be no further than
this from the current system time just after the read.org.lsst.ccs.drivers.commons.DriverException - for I/O errors or if the clock value read back is bad.public java.time.Instant getClock()
throws org.lsst.ccs.drivers.commons.DriverException
org.lsst.ccs.drivers.commons.DriverException - for I/O errors.Copyright © 2016 LSST. All rights reserved.