- Android Sensor Programming By Example
- Varun Nagpal
- 279字
- 2021-07-16 11:08:10
The reporting modes of sensors
Sensors can generate events in different ways called reporting modes. Each sensor has a particular type of reporting mode. The reporting mode is an Integer constant of the Sensor
class, which can be obtained using the getReportingMode()
method of the Sensor object. Knowing the reporting mode of a sensor can help developers write an efficient logic. Reporting modes can be categorized into following four types:
- Continuous: In continuous reporting mode, the sensor events are generated at a constant rate defined by the sampling period. This sampling period is set at the time of registering the listener for the sensor. For example, the sensors using the continuous reporting mode are the accelerometer and gyroscope.
- On Change: In the on-change reporting mode, the sensor events are generated only if the measured values have changed from the last known values. For example, sensors using the on-change reporting mode are the step counter, proximity, and heart rate sensors.
- One Shot: The one shot reporting mode is based on the fire and forget concept. They are triggered only once in the entire duration of the event. The significant motion sensor uses the one shot reporting mode to notify the event. It is only fired once, when the sensor detects the start of significant motion because of walking, running, or driving.
- Special Trigger: The special trigger is fired on each occurrence of a particular event. Upon the detection of an event, the sensor values are generated and passed to the listener. The sampling period is ignored in this case. The step detector sensor is an example of the special trigger reporting mode, which is fired on every step taken.
推薦閱讀
- DB2 V9權(quán)威指南
- TypeScript Essentials
- Getting started with Google Guava
- Full-Stack Vue.js 2 and Laravel 5
- 零基礎(chǔ)學(xué)Java(第4版)
- 假如C語(yǔ)言是我發(fā)明的:講給孩子聽的大師編程課
- Ext JS 4 Web Application Development Cookbook
- TradeStation交易應(yīng)用實(shí)踐:量化方法構(gòu)建贏家策略(原書第2版)
- 深入淺出PostgreSQL
- ASP.NET Core 2 Fundamentals
- C/C++程序員面試指南
- 新一代SDN:VMware NSX 網(wǎng)絡(luò)原理與實(shí)踐
- IoT Projects with Bluetooth Low Energy
- 玩轉(zhuǎn).NET Micro Framework移植:基于STM32F10x處理器
- INSTANT Apache ServiceMix How-to