Simple analysis of Android Qemu GPS module

Source: Internet
Author: User

Android GPS module is gps.default.so in the system/lib/hw/directory, general GPS-enabled mobile phones should implement this module and real GPS hardware interaction

the GPS in QEMU is to construct a gps.default.so, but this so does not deal with real hardware, just an analog interface, its code in in Sdk/emulator/gps/gps_qemu.c


The Qemu container implements a GPS device externally, but this device and Android interaction can only be piped, so Gps_qemu.c's function is to work with the pipeline and provide the Android required GPS functions, as follows:

static const Gpsinterface Qemugpsinterface = {

    sizeof (Gpsinterface),    qemu_gps_init,    Qemu_gps_start,    qemu_gps_stop,    qemu_gps_cleanup,    qemu _gps_inject_time,    qemu_gps_inject_location,    qemu_gps_delete_aiding_data,    qemu_gps_set_position_ mode,    qemu_gps_get_extension,};

QEMU external GPS sends data to the GPS module via the Qemu_channel_name pipeline, format NMEA, so the GPS module has several functions responsible for the parse of these data


The GPS module has a requirement that it must use its callback to create the thread (Gps_state_thread), while the position information callback is only approached (Gps_state_thread) on this line, because the framework Need a VM visible Java thread, Gps_state_thread will be attach to the VM, never callback Java layer function

"Gps_state_thread", Gps_state_thread, state);
So when Qemu_channel_nameGps_state_thread sent to Android framework
Gps.default.so call Epoll function to listen to the file FD, the implementation of the location information in the Gps_state_thread returned

Simple analysis of Android Qemu GPS module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.