org.openuat.sensors.j2me
Class SymbianTCPAccelerometerReader

java.lang.Object
  extended by org.openuat.sensors.SamplesSource
      extended by org.openuat.sensors.j2me.SymbianTCPAccelerometerReader

public class SymbianTCPAccelerometerReader
extends SamplesSource

This class implements an accelerometer sensor reader that gets its data from a small Symbian/C++ wrapper around the Nokia sensor SDK. It opens a TCP socket to which the Symbian program will connect. In the future, this should be the other way around with the Symbian wrapper being a service.

Version:
1.1, changes to 1.0: Not using the Symbian wrapper any more but now the Python wrapper implementation.
Author:
Rene Mayrhofer

Field Summary
static int SAMPLERATE
          This is only approximate, we can't control the sample rate on the device.
static int VALUE_RANGE
           
 
Fields inherited from class org.openuat.sensors.SamplesSource
maxNumLines
 
Constructor Summary
SymbianTCPAccelerometerReader()
          Initializes the reader.
 
Method Summary
 TimeSeries_Int.Parameters getParameters_Int()
          Instead of to [-1;1], these integer parameters map to [-1024;1024], i.e.
 TimeSeries.Parameters getParameters()
          Provides appropriate parameters for interpreting the values to normalize to the [-1;1] range.
protected  boolean handleSample()
          Implementation of SamplesSource.handleSample.
 void start()
          This overrides the SamplesSource.start implementation, because we need to open the outgoing control connection to get the incoming data connection.
 void stop()
          This overrides the SamplesSource.stop implementation to also properly close all resources the may be in use (the sockets).
 
Methods inherited from class org.openuat.sensors.SamplesSource
addSink, addSink, addSink, dispose, emitSample, emitSample, getMaxNumLines, removeSink_Int, removeSink, removeSink, simulateSampling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAMPLERATE

public static final int SAMPLERATE
This is only approximate, we can't control the sample rate on the device.

See Also:
Constant Field Values

VALUE_RANGE

public static final int VALUE_RANGE
See Also:
Constant Field Values
Constructor Detail

SymbianTCPAccelerometerReader

public SymbianTCPAccelerometerReader()
Initializes the reader.

Method Detail

start

public void start()
This overrides the SamplesSource.start implementation, because we need to open the outgoing control connection to get the incoming data connection.

Overrides:
start in class SamplesSource

stop

public void stop()
This overrides the SamplesSource.stop implementation to also properly close all resources the may be in use (the sockets).

Overrides:
stop in class SamplesSource

handleSample

protected boolean handleSample()
Implementation of SamplesSource.handleSample. When the connection has not yet been established by the Symbian Sensor API wrapper, then this method will block until an incoming connection has been established. Then, and on all further calls, it will read the samples from sensorDataIn and call emitSample to send to listeners.

Specified by:
handleSample in class SamplesSource
Returns:
true if more samples are available, false otherwise.

getParameters

public TimeSeries.Parameters getParameters()
Provides appropriate parameters for interpreting the values to normalize to the [-1;1] range.

Specified by:
getParameters in class SamplesSource

getParameters_Int

public TimeSeries_Int.Parameters getParameters_Int()
Instead of to [-1;1], these integer parameters map to [-1024;1024], i.e. MAXIMUM_RANGE in TimeSeries_Int.

Specified by:
getParameters_Int in class SamplesSource


2005-2009, Rene Mayrhofer.