net.rim.device.api.system
Class AccelerometerChannelConfig

java.lang.Object
  extended by 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:
BlackBerry API 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_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.

See Also:
Constant Field Values
Since:
BlackBerry API 4.7.0

TYPE_ORIENTATION

public static final int TYPE_ORIENTATION
Channel type for orientation values.

See Also:
Constant Field Values
Since:
BlackBerry API 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:
BlackBerry API 4.7.0

AccelerometerChannelConfig

public AccelerometerChannelConfig(int types,
                                  boolean foregroundMode,
                                  boolean backgroundMode,
                                  int samplesCount)
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 AccelerometerChannelConfig.TYPE_ORIENTATION and AccelerometerChannelConfig.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
Since:
BlackBerry API 4.7.0


Method Detail

getTypes

public int getTypes()
Returns channel types

Returns:
channel types mask
Since:
BlackBerry API 4.7.0

setTypes

public void setTypes(int types)
Sets channel types

Parameters:
types - as mask
Since:
BlackBerry API 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:
BlackBerry API 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:
BlackBerry API 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:
BlackBerry API 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:
BlackBerry API 4.7.0

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:
BlackBerry API 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:
BlackBerry API 4.7.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal