diff options
author | Mike Lockwood <lockwood@android.com> | 2010-07-01 06:39:52 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-07-01 06:39:52 -0700 |
commit | 7cc17d5435eae10b87d56e8b58665c976c81751b (patch) | |
tree | e37e93814a9ccb47d1bde4fd029f98c3daf7d659 | |
parent | 44c99ec7cf4c78731d129d5657560dc555b24d50 (diff) | |
parent | 0df071ad05d1c1dae6b6aaa6122146fa679c7a12 (diff) | |
download | hardware_libhardware_legacy-7cc17d5435eae10b87d56e8b58665c976c81751b.zip hardware_libhardware_legacy-7cc17d5435eae10b87d56e8b58665c976c81751b.tar.gz hardware_libhardware_legacy-7cc17d5435eae10b87d56e8b58665c976c81751b.tar.bz2 |
am 0df071ad: Remove obsolete gpstest app.
Merge commit '0df071ad05d1c1dae6b6aaa6122146fa679c7a12' into gingerbread-plus-aosp
* commit '0df071ad05d1c1dae6b6aaa6122146fa679c7a12':
Remove obsolete gpstest app.
-rw-r--r-- | tests/gpstest/Android.mk | 34 | ||||
-rw-r--r-- | tests/gpstest/gpstest.cpp | 129 |
2 files changed, 0 insertions, 163 deletions
diff --git a/tests/gpstest/Android.mk b/tests/gpstest/Android.mk deleted file mode 100644 index 977e322..0000000 --- a/tests/gpstest/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2008 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - - -LOCAL_SRC_FILES:= gpstest.cpp - -LOCAL_CFLAGS:= -fno-short-enums - -LOCAL_SHARED_LIBRARIES:= libhardware_legacy - -LOCAL_C_INCLUDES:= \ - include/hardware_legacy - -LOCAL_MODULE:= gpstest - -LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) - -LOCAL_MODULE_TAGS:= tests - -include $(BUILD_EXECUTABLE) diff --git a/tests/gpstest/gpstest.cpp b/tests/gpstest/gpstest.cpp deleted file mode 100644 index 27cbd17..0000000 --- a/tests/gpstest/gpstest.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> - -extern "C" size_t dlmalloc_footprint(); - -#include "hardware_legacy/gps.h" - -static const GpsInterface* sGpsInterface = NULL; - -static bool sDone = false; -static int sFixes = 0; -static int sMaxFixes = 0; -static int sStatus = GPS_STATUS_ENGINE_OFF; - -static void location_callback(GpsLocation* location) -{ - printf("Got Fix: latitude: %lf longitude: %lf altitude: %.1lf\n", - location->latitude, location->longitude, location->altitude); - sFixes++; - if (sMaxFixes > 0 && sFixes >= sMaxFixes) { - sDone = true; - } -} - -static void status_callback(GpsStatus* status) -{ - switch (status->status) { - case GPS_STATUS_NONE: - printf("status: GPS_STATUS_NONE\n"); - break; - case GPS_STATUS_SESSION_BEGIN: - printf("status: GPS_STATUS_SESSION_BEGIN\n"); - break; - case GPS_STATUS_SESSION_END: - printf("status: GPS_STATUS_SESSION_END\n"); - break; - case GPS_STATUS_ENGINE_ON: - printf("status: GPS_STATUS_ENGINE_ON\n"); - break; - case GPS_STATUS_ENGINE_OFF: - printf("status: GPS_STATUS_ENGINE_OFF\n"); - break; - default: - printf("unknown status: %d\n", status->status); - break; - } - - sStatus = status->status; -} - -static void sv_status_callback(GpsSvStatus* sv_status) -{ - if (sv_status->num_svs > 0) { - for (int i = 0; i < sv_status->num_svs; i++) { - printf("SV: %2d SNR: %.1f Elev: %.1f Azim: %.1f %s %s\n", sv_status->sv_list[i].prn, - sv_status->sv_list[i].snr, sv_status->sv_list[i].elevation, - sv_status->sv_list[i].azimuth, - ((sv_status->ephemeris_mask & (1 << (sv_status->sv_list[i].prn - 1))) ? "E" : " "), - ((sv_status->almanac_mask & (1 << (sv_status->sv_list[i].prn - 1))) ? "A" : " ") - ); - } - printf("\n"); - } -} - -GpsCallbacks sCallbacks = { - location_callback, - status_callback, - sv_status_callback, -}; - -int main(int argc, char *argv[]) -{ - size_t initial = dlmalloc_footprint(); - - if (argc >= 2) { - sMaxFixes = atoi(argv[1]); - printf("max fixes: %d\n", sMaxFixes); - } - - sGpsInterface = gps_get_interface(); - if (!sGpsInterface) { - fprintf(stderr, "could not get gps interface\n"); - return -1; - } - - int err = sGpsInterface->init(&sCallbacks); - if (err) { - fprintf(stderr, "gps_init failed %d\n", err); - return err; - } - - sGpsInterface->start(); - - while (!sDone) { - sleep(1); - } - - sGpsInterface->stop(); - - printf("waiting for GPS to shut down\n"); - while (sStatus != GPS_STATUS_ENGINE_OFF) { - sleep(1); - } - - sGpsInterface->cleanup(); - - size_t final = dlmalloc_footprint(); - fprintf(stderr, "KO: initial == %d, final == %d\n", initial, final ); - - return 0; -} |