|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.system.MagnetometerSensor.Channel
public static class MagnetometerSensor.Channel
Encapsulates an active connection to the magnetometer sensor. While the channel
remains open, the sensor is queried for samples. To preserve battery power,
invoke MagnetometerSensor.Channel.close() to close the channel and stop querying the sensor.
| Method Summary | ||
|---|---|---|
void |
addMagnetometerListener(MagnetometerListener l)
Register a magnetometer listener. |
|
void |
close()
Closes the channel and stops querying the sensor. |
|
MagnetometerChannelConfig |
getConfig()
Retrieves the magnetometer channel configuration. |
|
MagnetometerData |
getData()
Returns the last captured magnetometer data. |
|
boolean |
isActive()
Indicates whether the channel is currently active and collecting the requested data. |
|
boolean |
isCalibrating()
Returns the calibration application status. |
|
boolean |
isOpen()
Indicates whether the channel is open. |
|
void |
removeMagnetometerListener(MagnetometerListener l)
Deregisters a magnetometer listener. |
|
void |
startCalibration()
Starts the calibration process. |
|
void |
stopCalibration()
Stops the calibration process. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public MagnetometerChannelConfig getConfig()
public void addMagnetometerListener(MagnetometerListener l)
l - The magnetometer listener, must not be null
NullPointerException - if MagnetometerListener is null
IllegalStateException - if the application that owns this channel no longer existspublic void removeMagnetometerListener(MagnetometerListener l)
l - The magnetometer listenerpublic void close()
public MagnetometerData getData()
The MagnetometerData object returned from this method is reused by this channel.
You can synchronize on this object to ensure the data doesn't change while using it.
IllegalStateException - if the MagnetometerSensor.Channel is closed.public boolean isCalibrating()
true if the calibration application is running,
false otherwise.
public void startCalibration()
throws IllegalStateException,
MagnetometerCalibrationException
If this channel's MagnetometerChannelConfig is set such that
MagnetometerChannelConfig.isShowCalibration() returns false, calibration
will be enabled, but no calibration instructions will be shown. It is then up to this channel's
owner to invoke MagnetometerSensor.Channel.stopCalibration(). If MagnetometerChannelConfig.isShowCalibration()
returns true then calibration instructions are shown, and calibration is stopped
once it's either stopped programatically, or the instructions are dismissed by the user.
MagnetometerCalibrationException - if the channel is inactive or calibration is already in progress.
IllegalStateException - if the MagnetometerSensor.Channel is closed.
public void stopCalibration()
throws IllegalStateException,
MagnetometerCalibrationException
Calibration is stopped automatically when a channel becomes inactive or closed.
MagnetometerCalibrationException - if calibration fails to stop.
IllegalStateException - if the MagnetometerSensor.Channel is closed.public boolean isActive()
true if the channel is open and active, false otherwise.MagnetometerSensor.Channel.isOpen()public boolean isOpen()
true if the channel is open, false otherwise.MagnetometerSensor.Channel.isActive()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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