• 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;
    }

  • 相关阅读:
    同一部电脑配两个git账号
    在span中,让里面的span垂直居中用这个
    三张图搞懂JavaScript的原型对象与原型链
    vue2.0 生命周期
    js中__proto__和prototype的区别和关系?
    【转】css 包含块
    【转】BFC(block formating context)块级格式化上下文
    javascript中函数的5个高级技巧
    toString() 和 valueOf()
    桌面图标列表排列小工具
  • 原文地址:https://www.cnblogs.com/lake-of-embedded-system/p/4130496.html
Copyright © 2020-2023  润新知