zoukankan      html  css  js  c++  java
  • Get into Android HAL Architecture With Exampls

    AGPS_INTERFACE : AGPS  -> Aiding / Assisted GPS (A-GPS) (in ublox gps module)

     frameworksaseservicesjavacomandroidserverlocationGpsLocationProvider.java

    |

    +

    frameworksaseservicesjnicom_android_server_location_GpsLocationProvider.cpp

                          err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);

                          err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device);

    +

    hardwareimxlibgpsgps.c

    const GpsInterface* gps__get_gps_interface(struct gps_device_t* dev)
    {
    return gps_get_hardware_interface();

    }

    static int open_gps(const struct hw_module_t* module, char const* name, struct hw_device_t** device)
    {
    struct gps_device_t *dev = malloc(sizeof(struct gps_device_t));
    memset(dev, 0, sizeof(*dev));

    dev->common.tag = HARDWARE_DEVICE_TAG;
    dev->common.version = 0;
    dev->common.module = (struct hw_module_t*)module;
    dev->get_gps_interface = gps__get_gps_interface;

    *device = (struct hw_device_t*)dev;
    return 0;
    }

    static struct hw_module_methods_t gps_module_methods = {
    .open = open_gps
    };

    struct hw_module_t HAL_MODULE_INFO_SYM = {
    .tag = HARDWARE_MODULE_TAG,
    .version_major = 1,
    .version_minor = 0,
    .id = GPS_HARDWARE_MODULE_ID,
    .name = "Atheros GPS Module",
    .author = "FSL MAD, Inc.",
    .methods = &gps_module_methods,
    };

    +

    hardwareimxlibgpsathr_gps.c

    static const GpsInterface athrGpsInterface = {
    .size =sizeof(GpsInterface),
    .init = athr_gps_init,
    .start = athr_gps_start,
    .stop = athr_gps_stop,
    .cleanup = athr_gps_cleanup,
    .inject_time = athr_gps_inject_time,
    .inject_location = athr_gps_inject_location,
    .delete_aiding_data = athr_gps_delete_aiding_data,
    .set_position_mode = athr_gps_set_position_mode,
    .get_extension = athr_gps_get_extension,
    };

    const GpsInterface* gps_get_hardware_interface()
    {
    return &athrGpsInterface;
    }

  • 相关阅读:
    如何关闭浏览器的自动完成功能
    <<设计模式C#>>学习笔记一:面向对象编程准备知识
    小心你成“鼠标手”
    中科院公布白领工资标准,香港月入18500才算白领
    在PB中调用IE
    在SqlServer2005里运行exe
    PBCS项目总结
    一条SQL删除所有表中数据
    SQL Server压缩Log文件的方法总结
    最近打算学习的一些东西
  • 原文地址:https://www.cnblogs.com/lake-of-embedded-system/p/4130496.html
Copyright © 2011-2022 走看看