Mobile Sensor API Version 1.2

javax.microedition.sensor.control
Interface SampleRateControl

All Superinterfaces:
Control

public interface SampleRateControl
extends Control

A SampleRateControl object is an example of a general control used to set the sample rate of the sensor. A controllable sensor that can offer the possibility to control the sample rate may provide a SampleRateControl via its getControl() and getControls() methods. If the sample rate control is provided, it MUST inherit this interface. For this control to be implementable, the sensor must provide multiple sample rates.

If this control is provided the implementation MUST also define the property SensorInfo.PROP_MAX_RATE. The execute() method is used to set the default sample rate.


Method Summary
 float getSampleRate()
          Returns the current sample rate.
 float[] getSampleRates()
          Returns the sample rates of the sensor.
 void setSampleRate(float sampleRate)
          Sets the sample rate of the sensor.
 
Methods inherited from interface javax.microedition.sensor.control.Control
execute, getName
 

Method Detail

getSampleRate

float getSampleRate()

Returns the current sample rate.

Returns:
the current sample rate in hertz

getSampleRates

float[] getSampleRates()

Returns the sample rates of the sensor.

  1. If possible sample rates have not been defined and they are chosen freely in range ]0, SensorInfo.PROP_MAX_RATE], a zero-length array is returned.
  2. In the case of certain, pre-defined sample rates the array length MUST be > 1.

Returns:
sample rates of the sensor in hertz.

setSampleRate

void setSampleRate(float sampleRate)

Sets the sample rate of the sensor. The maximum sample rate can be read from a SensorInfo object with the method sensorInfo.getProperty(SensorInfo.PROP_MAX_RATE). The PROP_MAX_RATE MUST be defined if this control is provided.

The value is not valid if:

Parameters:
sampleRate - the sample rate (Hz) to be set. Trailing zeros are ignored: 25.0 Hz and 25 Hz are the same rate. No roundings are performed: 25.01 Hz and 25 Hz are different rates.
Throws:
java.lang.IllegalArgumentException - if the sample rate is not a valid value. * @throws IllegalStateException if the sample rate cannot be set at the moment

Mobile Sensor API Version 1.2

Copyright © 2005-2008 Nokia Corporation. All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.