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> |
| 6 | |
| 7 | static const GpsInterface* sGpsInterface = NULL; |
| 8 | |
| 9 | static void |
| 10 | gps_find_hardware( void ) |
| 11 | { |
| 12 | #ifdef HAVE_QEMU_GPS_HARDWARE |
| 13 | char propBuf[PROPERTY_VALUE_MAX]; |
| 14 | |
| 15 | property_get("ro.kernel.qemu", propBuf, ""); |
| 16 | if (propBuf[0] == '1') { |
| 17 | sGpsInterface = gps_get_qemu_interface(); |
| 18 | if (sGpsInterface) { |
| 19 | LOGD("using QEMU GPS Hardware emulation\n"); |
| 20 | return; |
| 21 | } |
| 22 | } |
| 23 | #endif |
| 24 | |
| 25 | #ifdef HAVE_GPS_HARDWARE |
| 26 | sGpsInterface = gps_get_hardware_interface(); |
| 27 | #endif |
| 28 | if (!sGpsInterface) |
| 29 | LOGD("no GPS hardware on this device\n"); |
| 30 | } |
| 31 | |
| 32 | const GpsInterface* |
| 33 | gps_get_interface() |
| 34 | { |
| 35 | if (sGpsInterface == NULL) |
| 36 | gps_find_hardware(); |
| 37 | |
| 38 | return sGpsInterface; |
| 39 | } |