public final class CategoryMotion extends SensorBase
SensorBase and describes motion sensors on hardware devices.
This class describes the sensor types in the motion category, such as the acceleration,
gravity, and gyroscope sensors. It also provides the method for constructing a
CategoryMotion instance.
SensorBaseSystemCapability.Sensors#SENSOR| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
SENSOR_TYPE_ACCELEROMETER |
An integer representing the linear acceleration sensor type.
|
static int |
SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED |
An integer representing the linear acceleration sensor type.
|
static int |
SENSOR_TYPE_DROP_DETECTION |
An integer representing the drop detection sensor type.
|
static int |
SENSOR_TYPE_GRAVITY |
An integer representing the gravity sensor type.
|
static int |
SENSOR_TYPE_GYROSCOPE |
An integer representing the gyroscope sensor type.
|
static int |
SENSOR_TYPE_LINEAR_ACCELERATION |
An integer representing the linear acceleration sensor type.
|
static int |
SENSOR_TYPE_PEDOMETER |
An integer representing the pedometer sensor type.
|
static int |
SENSOR_TYPE_PEDOMETER_DETECTION |
An integer representing the pedometer detection sensor type.
|
static int |
SENSOR_TYPE_SIGNIFICANT_MOTION |
An integer representing the significant motion sensor type.
|
static String |
STRING_SENSOR_TYPE_ACCELEROMETER |
A string of characters describing the acceleration sensor type.
|
static String |
STRING_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED |
A string of characters describing the uncalibrated acceleration sensor type.
|
static String |
STRING_SENSOR_TYPE_DROP_DETECTION |
A string of characters describing the drop detection sensor type.
|
static String |
STRING_SENSOR_TYPE_GRAVITY |
A string of characters describing the gravity sensor type.
|
static String |
STRING_SENSOR_TYPE_GYROSCOPE |
A string of characters describing the gyroscope sensor type.
|
static String |
STRING_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED |
A string of characters describing the uncalibrated gyroscope sensor type.
|
static String |
STRING_SENSOR_TYPE_LINEAR_ACCELERATION |
A string of characters describing the linear acceleration sensor type.
|
static String |
STRING_SENSOR_TYPE_SIGNIFICANT_MOTION |
A string of characters describing the significant motion sensor type.
|
static int |
TYPE_SENSOR_GYROSCOPE_UNCALIBRATED |
An integer representing the uncalibrated gyroscope sensor type.
|
| 构造器 | 说明 |
|---|---|
CategoryMotion(int sensorId,
String name,
String vendor,
int version,
float upperRange,
float resolution,
int flags,
int cacheMaxCount,
long minInterval,
long maxInterval) |
A constructor used to create a
CategoryMotion instance. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCacheMaxCount, getFlags, getMaxInterval, getMinInterval, getName, getResolution, getSensorId, getUpperRange, getVendor, getVersionpublic static final int SENSOR_TYPE_ACCELEROMETER
Before subscribing to this sensor, the application needs to request the
ohos.permission.ACCELEROMETER permission.
public static final int SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
Before subscribing to this sensor, the application needs to request the
ohos.permission.ACCELEROMETER permission.
public static final int SENSOR_TYPE_DROP_DETECTION
public static final int SENSOR_TYPE_GRAVITY
public static final int SENSOR_TYPE_GYROSCOPE
Before subscribing to this sensor, the application needs to request the
ohos.permission.GYROSCOPE permission.
public static final int SENSOR_TYPE_LINEAR_ACCELERATION
Before subscribing to this sensor, the application needs to request the
ohos.permission.ACCELEROMETER permission.
public static final int SENSOR_TYPE_PEDOMETER
Pedometer sensors are generally used by health applications to record the number of
steps a user has walked. If the system is restarted, the step count is reset to 0. When
the system is started, the pedometer sensor starts working and logging the user's steps.
Before subscribing to such a sensor, the application needs to request the
ohos.permission.ACTIVITY_MOTION permission. Upon subscription, the application
will obtain the latest step count. If the application unsubscribes from the sensor,
the step count data on the application will not be refreshed.
public static final int SENSOR_TYPE_PEDOMETER_DETECTION
The pedometer detection sensor is used to detect whether a user is in motion. Its value
is 1 if the user is in motion and is 0 otherwise. Before subscribing to
this sensor, the application needs to request the
ohos.permission.ACTIVITY_MOTION permission.
public static final int SENSOR_TYPE_SIGNIFICANT_MOTION
public static final String STRING_SENSOR_TYPE_ACCELEROMETER
public static final String STRING_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
public static final String STRING_SENSOR_TYPE_DROP_DETECTION
public static final String STRING_SENSOR_TYPE_GRAVITY
public static final String STRING_SENSOR_TYPE_GYROSCOPE
public static final String STRING_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
public static final String STRING_SENSOR_TYPE_LINEAR_ACCELERATION
public static final String STRING_SENSOR_TYPE_SIGNIFICANT_MOTION
public static final int TYPE_SENSOR_GYROSCOPE_UNCALIBRATED
Before subscribing to this sensor, the application needs to request the
ohos.permission.GYROSCOPE permission.
public CategoryMotion(int sensorId,
String name,
String vendor,
int version,
float upperRange,
float resolution,
int flags,
int cacheMaxCount,
long minInterval,
long maxInterval)
CategoryMotion instance.sensorId - Indicates the ID of the sensor.name - Indicates the name of the sensor.vendor - Indicates the manufacturer of the sensor.version - Indicates the version of the sensor.upperRange - Indicates the maximum measurement range of the sensor.resolution - Indicates the resolution of the sensor.flags - Indicates the flags of the sensor.cacheMaxCount - Indicates the maximum number of hardware FIFO elements supported by
the sensor.minInterval - Indicates the minimum sampling interval of the sensor, in nanoseconds.maxInterval - Indicates the maximum sampling interval of the sensor, in nanoseconds.