net.rim.device.api.system
Class MagnetometerChannelConfig

java.lang.Object
  extended by net.rim.device.api.system.MagnetometerChannelConfig

public final class MagnetometerChannelConfig
extends Object

Provides functionality for configuring the magnetometer channel.

Since:
BlackBerry API 7.0.0

Constructor Summary
MagnetometerChannelConfig()
          Constructs the default configuration for the magnetometer sensor.
MagnetometerChannelConfig(int freq)
          Configures the magnetometer sensor with the specified options.
MagnetometerChannelConfig(int freq, boolean foregroundMode, boolean backgroundMode)
          Configures the magnetometer sensor with the specified options.
 
Method Summary
 int getFrequency()
          Retrieves the frequency.
 boolean isBackgroundMode()
          Indicates whether the channel should be active for the application that is in the background.
 boolean isForegroundMode()
          Indicates whether the channel should be active for the application that is in the foreground.
 boolean isShowCalibration()
          Indicates whether we should show a calibration ui when calibration is enabled.
 void setBackgroundMode(boolean backgroundMode)
          Specifies that the channel should be active for the application that is in the background.
 void setForegroundMode(boolean foregroundMode)
          Specifies that the channel should be active for the application that is in the foreground.
 void setShowCalibration(boolean showCalibration)
          Specifies that we should show a calibration ui when calibration is enabled.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

MagnetometerChannelConfig

public MagnetometerChannelConfig()
Constructs the default configuration for the magnetometer sensor.

This configuration is equivalent to MagnetometerChannelConfig( 10, true, false ). It sets the magnetometer sensor to receive updates at a frequency of 10 Hz (100ms), and the sensor is active only when the application opening the channel is in the foreground.

Since:
BlackBerry API 7.0.0

MagnetometerChannelConfig

public MagnetometerChannelConfig(int freq)
Configures the magnetometer sensor with the specified options.

Parameters:
freq - The sampling frequency (in Hz). If this value is smaller or larger than what is supported by the hardware, the minimum or maximum value is selected.

This configuration is equivalent to MagnetometerChannelConfig( freq, true, false ). It sets the magnetometer sensor to receive updates at the specified frequency, and the sensor is active only when the application opening the channel is in the foreground.

Since:
BlackBerry API 7.0.0

MagnetometerChannelConfig

public MagnetometerChannelConfig(int freq,
                                 boolean foregroundMode,
                                 boolean backgroundMode)
Configures the magnetometer sensor with the specified options.

Parameters:
freq - The sampling frequency (in Hz). If this value is smaller or larger than what is supported by the hardware, the minimum or maximum value is selected.
foregroundMode - If true the magnetometer is active when the owning application is in the foreground, if false the magnetometer is not active.
backgroundMode - If true the magnetometer is active when the owning application is in the background, if false the magnetometer is not active. The device battery lasts substantially longer if the magnetometer sensor is turned off while your application is in the background.
Since:
BlackBerry API 7.0.0


Method Detail

getFrequency

public int getFrequency()
Retrieves the frequency.

Returns:
frequency The frequency.
Since:
BlackBerry API 7.0.0

isShowCalibration

public boolean isShowCalibration()
Indicates whether we should show a calibration ui when calibration is enabled.

Returns:
true if calibration ui is shown, false otherwise.
See Also:
MagnetometerSensor#startCalibration
Since:
BlackBerry API 7.1.0

setShowCalibration

public void setShowCalibration(boolean showCalibration)
Specifies that we should show a calibration ui when calibration is enabled. By default this is set to true.

See Also:
MagnetometerSensor#startCalibration
Since:
BlackBerry API 7.1.0

isForegroundMode

public boolean isForegroundMode()
Indicates whether the channel should be active for the application that is in the foreground.

Returns:
true if the channel should be opened in the foreground, false otherwise.
Since:
BlackBerry API 7.0.0

setForegroundMode

public void setForegroundMode(boolean foregroundMode)
Specifies that the channel should be active for the application that is in the foreground.

Parameters:
foregroundMode - true to specify a new foreground mode, false otherwise.
Since:
BlackBerry API 7.0.0

isBackgroundMode

public boolean isBackgroundMode()
Indicates whether the channel should be active for the application that is in the background.

Returns:
true if the channel should be opened in the background, false otherwise.
Since:
BlackBerry API 7.0.0

setBackgroundMode

public void setBackgroundMode(boolean backgroundMode)
Specifies that the channel should be active for the application that is in the background.

Parameters:
backgroundMode - true to specify a new background mode, false otherwise.
Since:
BlackBerry API 7.0.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