blob: efd1181ad28a77a4fd122b98d38b53623eb5c914 [file] [log] [blame]
The Android Open Source Projectd6054a32008-10-21 07:00:00 -07001#include <hardware/gps.h>
2#include <cutils/properties.h>
3
4#define LOG_TAG "libhardware"
5#include <utils/Log.h>
6
7static const GpsInterface* sGpsInterface = NULL;
8
9static void
10gps_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
32const GpsInterface*
33gps_get_interface()
34{
35 if (sGpsInterface == NULL)
36 gps_find_hardware();
37
38 return sGpsInterface;
39}