com.gatespace.service.adc.impl
Class ChannelImpl

java.lang.Object
  |
  +--com.gatespace.service.adc.impl.ChannelImpl

public class ChannelImpl
extends java.lang.Object
implements Channel

Implementation of Channel, using ADCServiceImpl to poll data.


Method Summary
 void addChannelListener(ChannelListener l)
          Add a listener to this channel.
 int getChannelNo()
          Get channel number.
 int getJitter()
           
 int getMode()
          Get measurement mode of channel.
 double getNormalizedValue()
          Get last normalized value read from channel.
 int getRawValue()
          Get last raw value read from channel.
 int getResolution()
          Get resolution of channel.
 int getSampleCount()
          Get oversample count of channel.
 boolean isActive()
          Get activation status.
protected  void notifyListeners()
          Notify all listeners of new values.
 boolean read()
          Read a new value from channel.
 void removeChannelListener(ChannelListener l)
          Remove a listener to this channel.
 void setActive(boolean b)
          Set activation status.
 void setJitter(int jitter)
           
 void setMode(int mode)
          Set measurement mode of channel.
 void setResolution(int resolution)
          Set resolution of channel.
 void setSampleCount(int count)
          Set oversample count of channel.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getChannelNo

public int getChannelNo()
Description copied from interface: Channel
Get channel number. Note: channels are numbered from zero and upwards.
Specified by:
getChannelNo in interface Channel

isActive

public boolean isActive()
Description copied from interface: Channel
Get activation status.
Specified by:
isActive in interface Channel
Tags copied from interface: Channel
Returns:
true if channel is automatically polled, false otherwise

setActive

public void setActive(boolean b)
Description copied from interface: Channel
Set activation status.
Specified by:
setActive in interface Channel
Tags copied from interface: Channel
Parameters:
b - true if channel is to be automatically polled, false otherwise

getMode

public int getMode()
Description copied from interface: Channel
Get measurement mode of channel.
Specified by:
getMode in interface Channel

getJitter

public int getJitter()

getResolution

public int getResolution()
Description copied from interface: Channel
Get resolution of channel.
Specified by:
getResolution in interface Channel

setMode

public void setMode(int mode)
Description copied from interface: Channel
Set measurement mode of channel.
Specified by:
setMode in interface Channel

setJitter

public void setJitter(int jitter)

setResolution

public void setResolution(int resolution)
Description copied from interface: Channel
Set resolution of channel.
Specified by:
setResolution in interface Channel

read

public boolean read()
             throws java.io.IOException
Description copied from interface: Channel
Read a new value from channel.
Specified by:
read in interface Channel
Tags copied from interface: Channel
Returns:
true if a new value (compared to the last read()) is found.

getRawValue

public int getRawValue()
Description copied from interface: Channel
Get last raw value read from channel.
Specified by:
getRawValue in interface Channel

getNormalizedValue

public double getNormalizedValue()
Description copied from interface: Channel
Get last normalized value read from channel.
Specified by:
getNormalizedValue in interface Channel
Tags copied from interface: Channel
Returns:
value between 0 and 1

addChannelListener

public void addChannelListener(ChannelListener l)
Description copied from interface: Channel
Add a listener to this channel.
Specified by:
addChannelListener in interface Channel

removeChannelListener

public void removeChannelListener(ChannelListener l)
Description copied from interface: Channel
Remove a listener to this channel.
Specified by:
removeChannelListener in interface Channel

notifyListeners

protected void notifyListeners()
Notify all listeners of new values.

getSampleCount

public int getSampleCount()
Description copied from interface: Channel
Get oversample count of channel. Each channel may b e sampled more than one time for each read() to overcome problems with jittery input.
Specified by:
getSampleCount in interface Channel

setSampleCount

public void setSampleCount(int count)
Description copied from interface: Channel
Set oversample count of channel.
Specified by:
setSampleCount in interface Channel

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object