zoukankan      html  css  js  c++  java
  • Sensor Hub 初探

    核心定义结构:hardware/libhardware/include/hardware/sensors.h

      sensor_type 类型定义:

        1、#define SENSOR_TYPE_ACCELEROMETER

        2、#define SENSOR_TYPE_GEOMAGNETIC_FIELD

        3、#define SENSOR_TYPE_ORIENTATION

      结构体:

        1、struct sensors_vec_t // sensor event data

        2、struct uncalibrated_event_t //无标定事件,uncalibrated gyroscope and magnetometer event data

        3、struct meta_data_event // meta data event data

        4、struct heart_rate_event_t   //心跳频率

        5、struct sensors_event_t  // union of the various types of sensor data that can be returned

        6、struct sensors_module_t //every hardware module must have a data structure named HAL_MODULE_INFO_SYM

        7、struct sensor_t  // the detail info of a sensor

        8、struct sensors_poll_device_t // it is used with SENSORS_DEVICE_API_VERSION_0_1

        9、struct sensors_poll_device_1  // it is compatible with sensors_poll_device_t. it is used in HAL versions >= SENSORS_DEVICE_API_VERSION_1_0

      函数:  (convenience API for opening and closing a device)

        1、sensors_open()  

        2、sensors_close()

        3、sensors_open_1()

        4、sensors_close_1()

    Android does not define how the different physical sensors are connected to the system on chip (SoC).

    Often, sensor chips are connected to the SoC through a sensor hub, allowing some low-power monitoring and processing of the data.

    Often, Inter-Integrated Circuit (I2C) or Serial Peripheral Interface (SPI) is used as the transport mechanism.

    Android sensors provide data as a series of sensor events.

    Each event contains:

    • a handle to the sensor that generated it
    • the timestamp at which the event was detected or measured
    • and some data

    Control flows from the applications down to the sensors, and data flows from the sensors up to the applications.

     Sensor Stack

      SDK:

        Applications access sensors through the Sensors SDK (Software Development Kit) API. The SDK contains functions to list available sensors and to register to a sensor.

        the application specifies its preferred sampling frequency and its latency requirements. //指定采样频率和延迟请求

      Framework:

        The framework is in charge of linking the several applications to the HAL.  //管理应用程序链接到HAL层

        When a first application registers to a sensor, the framework sends a request to the HAL to activate the sensor. //第一个注册或绑定该sensor

        When the last application registered to one sensor unregisters from it, the frameworks sends a request to the HAL to deactivate the sensor so power is not consumed unnecessarily.  //应用解绑时,deactivity,使之省电

      Impact of multiplexing: //复用的影响

        当多个application 对于同一个sensor,设置不同的sampling frequency时,sensor实际采样是以最快的为准。同时,设置比较慢的application也会收到 快速的rate。

        相对应的,latency也以最短的算。 //即 采样频率以最快的算,延迟时间以最短的算。

        There is no mechanism to send data down from the applications to the sensors or their drivers. This ensures one application cannot modify the behavior of the sensors, breaking other applications. //

      

      Sensor fusion

        

      JNI

        The framework uses a Java Native Interface (JNI) associated with android.hardware and located in the frameworks/base/core/jni/ directory. This code calls the lower level native code to obtain access to the sensor hardware.

      Native Framework:

        The native framework calls the Binder IPC proxies to obtain access to sensor-specific services.

       

    1、以专家为榜样,不必自己重新探索
    2、解构技能,找出实现80%效果的那20%
    3、不要一心二用
    4、练习练习再练习!然后获得即时反馈
    5、坚持,不要在低谷期放弃
  • 相关阅读:
    SQL Server数据库新建拥有部分查看操作权限的用户
    Asp.net导入Excel数据文件
    前台页面下载服务器端文件
    页面开机自启动,页面置顶显示,页面持续获得焦点,鼠标点击器源码
    asp.net DataGrid GridView 表格之分页显示与翻页功能及自定义翻页页码样式
    asp.net DataGrid GridView 表格之取消设计最初显示的绑定列
    asp.net DataGrid GridView 表格之选中行与获取选中行数据
    Winform 、asp.net TreeView 树形控件
    Torrent种子下载下来的文件,如何校验其完整性?
    在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误
  • 原文地址:https://www.cnblogs.com/zhongyuan/p/4349791.html
Copyright © 2011-2022 走看看