The Android Open Source Project | d6054a3 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | #include <hardware/gps.h> |
| 2 | #include <cutils/properties.h> |
| 3 | |
| 4 | #define LOG_TAG "libhardware" |
| 5 | #include <utils/Log.h> |
The Android Open Source Project | 51704be | 2008-12-17 18:05:50 -0800 | [diff] [blame] | 6 | #include "qemu.h" |
The Android Open Source Project | d6054a3 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 7 | |
| 8 | static const GpsInterface* sGpsInterface = NULL; |
| 9 | |
| 10 | static void |
| 11 | gps_find_hardware( void ) |
| 12 | { |
| 13 | #ifdef HAVE_QEMU_GPS_HARDWARE |
The Android Open Source Project | 51704be | 2008-12-17 18:05:50 -0800 | [diff] [blame] | 14 | if (qemu_check()) { |
The Android Open Source Project | d6054a3 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 15 | sGpsInterface = gps_get_qemu_interface(); |
| 16 | if (sGpsInterface) { |
| 17 | LOGD("using QEMU GPS Hardware emulation\n"); |
| 18 | return; |
| 19 | } |
| 20 | } |
| 21 | #endif |
| 22 | |
| 23 | #ifdef HAVE_GPS_HARDWARE |
| 24 | sGpsInterface = gps_get_hardware_interface(); |
| 25 | #endif |
| 26 | if (!sGpsInterface) |
| 27 | LOGD("no GPS hardware on this device\n"); |
| 28 | } |
| 29 | |
| 30 | const GpsInterface* |
| 31 | gps_get_interface() |
| 32 | { |
| 33 | if (sGpsInterface == NULL) |
| 34 | gps_find_hardware(); |
| 35 | |
| 36 | return sGpsInterface; |
| 37 | } |