javax.microedition.sensor
Class NXTSensorConnection

java.lang.Object
  extended by javax.microedition.sensor.NXTSensorConnection
All Implemented Interfaces:
Connection, SensorConnection

public class NXTSensorConnection
extends Object
implements SensorConnection

Implementation of the SensorConnection interface for NXT sensors

Author:
Lawrie Griffiths

Field Summary
 
Fields inherited from interface javax.microedition.sensor.SensorConnection
STATE_CLOSED, STATE_LISTENING, STATE_OPENED
 
Constructor Summary
NXTSensorConnection(String url)
          Create a sensor connection
 
Method Summary
 void close()
           
 int getADChannelData(NXTChannelInfo channelInfo)
           
 Channel getChannel(ChannelInfo channelInfo)
           
 int getChannelData(NXTChannelInfo channelInfo)
           
 Data[] getData(int bufferSize)
           
 Data[] getData(int bufferSize, long bufferingPeriod, boolean isTimestampIncluded, boolean isUncertaintyIncluded, boolean isValidityIncluded)
           
 int getI2CChannelData(NXTChannelInfo channelInfo)
           
 SensorInfo getSensorInfo()
           
 int getState()
           
 void removeDataListener()
           
 void setDataListener(DataListener listener, int bufferSize)
           
 void setDataListener(DataListener listener, int bufferSize, long bufferingPeriod, boolean isTimestampIncluded, boolean isUncertaintyIncluded, boolean isValidityIncluded)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NXTSensorConnection

public NXTSensorConnection(String url)
                    throws IOException
Create a sensor connection

Parameters:
url - the sensor url
Throws:
IOException
Method Detail

getChannel

public Channel getChannel(ChannelInfo channelInfo)
Specified by:
getChannel in interface SensorConnection

getData

public Data[] getData(int bufferSize)
               throws IOException
Specified by:
getData in interface SensorConnection
Throws:
IOException

getChannelData

public int getChannelData(NXTChannelInfo channelInfo)

getADChannelData

public int getADChannelData(NXTChannelInfo channelInfo)

getI2CChannelData

public int getI2CChannelData(NXTChannelInfo channelInfo)

getData

public Data[] getData(int bufferSize,
                      long bufferingPeriod,
                      boolean isTimestampIncluded,
                      boolean isUncertaintyIncluded,
                      boolean isValidityIncluded)
               throws IOException
Specified by:
getData in interface SensorConnection
Throws:
IOException

getSensorInfo

public SensorInfo getSensorInfo()
Specified by:
getSensorInfo in interface SensorConnection

getState

public int getState()
Specified by:
getState in interface SensorConnection

removeDataListener

public void removeDataListener()
Specified by:
removeDataListener in interface SensorConnection

setDataListener

public void setDataListener(DataListener listener,
                            int bufferSize)
Specified by:
setDataListener in interface SensorConnection

setDataListener

public void setDataListener(DataListener listener,
                            int bufferSize,
                            long bufferingPeriod,
                            boolean isTimestampIncluded,
                            boolean isUncertaintyIncluded,
                            boolean isValidityIncluded)
Specified by:
setDataListener in interface SensorConnection

close

public void close()
           throws IOException
Specified by:
close in interface Connection
Throws:
IOException