com.gatespace.service.adc.impl
Class ADCServiceImpl
java.lang.Object
|
+--com.gatespace.service.adc.impl.ADCServiceImpl
- public class ADCServiceImpl
- extends java.lang.Object
- implements ADCService, java.lang.Runnable
Implementation of ADCService.
To init, construct with ADCServiceImpl(javax.comm.SerialPort)
then start with start()
.
This code uses a low-level implementation in an
ADCLowLevel to actually read data from the port.
Constructor Summary |
ADCServiceImpl(com.gatespace.service.adc.impl.SerialPort serialPort,
ADCLowLevel low)
Construct the service. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
serialPort
protected com.gatespace.service.adc.impl.SerialPort serialPort
runner
protected java.lang.Thread runner
readDelay
protected int readDelay
bInitialized
protected boolean bInitialized
low
protected ADCLowLevel low
ADCServiceImpl
public ADCServiceImpl(com.gatespace.service.adc.impl.SerialPort serialPort,
ADCLowLevel low)
- Construct the service.
getChannels
public Channel[] getChannels()
- Description copied from interface: ADCService
- Get all available A/D channels.
- Specified by:
- getChannels in interface ADCService
isStarted
public boolean isStarted()
- Description copied from interface: ADCService
- Get current status of service.
- Specified by:
- isStarted in interface ADCService
- Tags copied from interface: ADCService
- Returns:
- true if ADC is started, false if stopped.
getType
public int getType()
- Description copied from interface: ADCService
- Get ADC unit type.
This is '16' for the ADC16
- Specified by:
- getType in interface ADCService
getVersion
public int getVersion()
- Description copied from interface: ADCService
- Get ADC unit version.
- Specified by:
- getVersion in interface ADCService
start
protected void start()
- Set up ADC unit
stop
protected void stop()
- From ADCService interface.
Stop poll thread etc
run
public void run()
- Run thread.
Poll data each readDelay for all channels.
Notify listeners when values change.
- Specified by:
- run in interface java.lang.Runnable
readValue
protected int readValue(Channel ch)
throws java.io.IOException