net.rim.device.api.system
Class AccelerometerChannelConfig

java.lang.Object
  |
  +--net.rim.device.api.system.AccelerometerChannelConfig

public class AccelerometerChannelConfig
extends Object

Accelerometer channel configuration. Contains data type, application running mode and raw samples count to keep in buffer.

Since:
JDE 4.7.0

Field Summary
static int TYPE_ORIENTATION
          Channel type for orientation values.
static int TYPE_RAW
          Channel type for raw acceleration values.
 
Constructor Summary
AccelerometerChannelConfig(int types)
          Creates channel configuration for given data types.
AccelerometerChannelConfig(int types, boolean foregroundMode, boolean backgroundMode, int samplesCount)
          Creates channel configuration based on data types, application running mode and raw samples count.
 
Method Summary
 int getSamplesCount()
          Returns number of raw samples to store in channel buffer
 int getTypes()
          Returns channel types
 boolean isBackgroundMode()
          Returns whether channel should be active for application in background mode
 boolean isForegroundMode()
          Returns whether channel should be active for application in foreground mode
 void setBackgroundMode(boolean backgroundMode)
          Sets whether channel should be active for application in background mode
 void setForegroundMode(boolean foregroundMode)
          Sets whether channel should be active for application in foreground mode
 void setSamplesCount(int samplesCount)
          Sets number of raw samples to keep in a buffer.
 void setTypes(int types)
          Sets channel types
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_ORIENTATION

public static final int TYPE_ORIENTATION
Channel type for orientation values.
Since:
JDE 4.7.0

TYPE_RAW

public static final int TYPE_RAW
Channel type for raw acceleration values. Each raw value is a vector of 3 components - X, Y and Z acceleration values, each for corresponding axis.
Since:
JDE 4.7.0
Constructor Detail

AccelerometerChannelConfig

public AccelerometerChannelConfig(int types)
Creates channel configuration for given data types. By default, this constructor instructs the application to only query the accelerometer sensor when in foreground mode, and set the number of raw samples to keep in the channel buffer to 1.
Parameters:
types - mask with type flags
Since:
JDE 4.7.0

AccelerometerChannelConfig

public AccelerometerChannelConfig(int types,
                                  boolean foregroundMode,
                                  boolean backgroundMode,
                                  int samplesCount)
                           throws IllegalArgumentException
Creates channel configuration based on data types, application running mode and raw samples count.

If application needs data only when running in the foreground then it should specify false for background mode as it will turn off accelerometer sensor query routine when unnecessary.

Parameters:
types - a mask of TYPE_ORIENTATION and TYPE_RAW values which specify required data type
foregroundMode - if true then the channel is active when application is in foreground mode, if false then the sensor is not queried to save power
backgroundMode - if true then the channel is active when application is in background mode, if false then the sensor is not queried to save power
samplesCount - number of raw samples to keep in buffer
Throws:
IllegalArgumentException - if types is not one of the TYPE_RAW and TYPE_ORIENTATION
Since:
JDE 4.7.0
Method Detail

getSamplesCount

public int getSamplesCount()
Returns number of raw samples to store in channel buffer
Returns:
number of raw samples to store in channel buffer
Since:
JDE 4.7.0

getTypes

public int getTypes()
Returns channel types
Returns:
channel types mask
Since:
JDE 4.7.0

isBackgroundMode

public boolean isBackgroundMode()
Returns whether channel should be active for application in background mode
Returns:
true if channel should be opened in background
Since:
JDE 4.7.0

isForegroundMode

public boolean isForegroundMode()
Returns whether channel should be active for application in foreground mode
Returns:
true if channel should be opened in foreground
Since:
JDE 4.7.0

setBackgroundMode

public void setBackgroundMode(boolean backgroundMode)
Sets whether channel should be active for application in background mode
Parameters:
backgroundMode - specifies new background mode
Since:
JDE 4.7.0

setForegroundMode

public void setForegroundMode(boolean foregroundMode)
Sets whether channel should be active for application in foreground mode
Parameters:
foregroundMode - specifies new foreground mode
Since:
JDE 4.7.0

setSamplesCount

public void setSamplesCount(int samplesCount)
Sets number of raw samples to keep in a buffer. If the count is greater than 1 then all samples will be buffered and application will have a chance to access older samples.
Parameters:
samplesCount - number of samples to keep in buffer
Since:
JDE 4.7.0

setTypes

public void setTypes(int types)
Sets channel types
Parameters:
types - as mask
Since:
JDE 4.7.0



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.