CategoryBody, CategoryEnvironment, CategoryLight, CategoryMotion, CategoryOrientation, CategoryOtherpublic class SensorBase extends Object
The basic attributes include the ID, name, manufacturer, version, maximum measurement range, resolution, flags, maximum number of hardware FIFO elements, maximum sampling interval, and minimum sampling interval of a sensor. This class also provides methods for obtaining the sensor attributes.
SystemCapability.Sensors#SENSOR| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
COMMAND_PARAMETER_FLUSH |
Indicates the parameter of the command to flush sensor data.
|
static int |
COMMAND_PARAMETER_SET_MODE |
Indicates the parameter of the command to set the sensor mode.
|
static int |
COMMAND_TYPE_FLUSH |
Indicates the type of the command to flush sensor data.
|
static int |
COMMAND_TYPE_SET_MODE |
Indicates the type of the command to set the sensor mode.
|
static int |
SENSOR_CATEGORY_MASK |
Indicates the mask of a sensor category.
|
static int |
SENSOR_CATEGORY_MASK_SHIFT |
Indicates the number of shift bits decoded from the sensor ID for the sensor category.
|
static int |
SENSOR_INDEX_MASK |
Indicates the mask of a sensor index.
|
static int |
SENSOR_INDEX_MASK_SHIFT |
Indicates the number of shift bits decoded from the sensor ID for the sensor index.
|
static int |
SENSOR_TYPE_MASK |
Indicates the mask of a sensor type.
|
static int |
SENSOR_TYPE_MASK_SHIFT |
Indicates the number of shift bits decoded from the sensor ID for the sensor type.
|
| 构造器 | 说明 |
|---|---|
SensorBase(int sensorId,
String name,
String vendor,
int version,
float upperRange,
float resolution,
int flags,
int cacheMaxCount,
long minInterval,
long maxInterval) |
Default constructor used to create a
SensorBase instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getCacheMaxCount() |
Obtains the maximum number of hardware FIFO elements supported by a sensor.
|
int |
getFlags() |
Obtains the flags of a sensor.
|
long |
getMaxInterval() |
Obtains the maximum sampling interval of a sensor.
|
long |
getMinInterval() |
Obtains the minimum sampling interval of a sensor.
|
String |
getName() |
Obtains the name of a sensor.
|
float |
getResolution() |
Obtains the resolution of a sensor.
|
int |
getSensorId() |
Obtains the ID of a sensor.
|
float |
getUpperRange() |
Obtains the maximum measurement range of a sensor.
|
String |
getVendor() |
Obtains the manufacturer of a sensor.
|
int |
getVersion() |
Obtains the version of a sensor.
|
public static final int COMMAND_PARAMETER_FLUSH
public static final int COMMAND_PARAMETER_SET_MODE
public static final int COMMAND_TYPE_FLUSH
public static final int COMMAND_TYPE_SET_MODE
public static final int SENSOR_CATEGORY_MASK
public static final int SENSOR_CATEGORY_MASK_SHIFT
public static final int SENSOR_INDEX_MASK
public static final int SENSOR_INDEX_MASK_SHIFT
public static final int SENSOR_TYPE_MASK
public static final int SENSOR_TYPE_MASK_SHIFT
public SensorBase(int sensorId,
String name,
String vendor,
int version,
float upperRange,
float resolution,
int flags,
int cacheMaxCount,
long minInterval,
long maxInterval)
SensorBase 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.public int getSensorId()
public String getName()
public String getVendor()
public int getVersion()
public float getUpperRange()
public float getResolution()
public int getFlags()
public int getCacheMaxCount()
public long getMinInterval()
public long getMaxInterval()