blob: 8b295af0e907e30efa6c8b4fa8f48077f2a50de6 [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>
The Android Open Source Project51704be2008-12-17 18:05:50 -08006#include "qemu.h"
The Android Open Source Projectd6054a32008-10-21 07:00:00 -07007
8static const GpsInterface* sGpsInterface = NULL;
9
10static void
11gps_find_hardware( void )
12{
13#ifdef HAVE_QEMU_GPS_HARDWARE
The Android Open Source Project51704be2008-12-17 18:05:50 -080014 if (qemu_check()) {
The Android Open Source Projectd6054a32008-10-21 07:00:00 -070015 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
30const GpsInterface*
31gps_get_interface()
32{
33 if (sGpsInterface == NULL)
34 gps_find_hardware();
35
36 return sGpsInterface;
37}