From 46f999155d24dbb1ed860b5509d794c123163846 Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Mon, 4 Jan 2016 16:17:34 -0800 Subject: [PATCH] Reduce TBF limit in GPS HAL Currently Location HAL forces TBF of 1 second or larger even though ALM permits lower values. GPS HAL shall have smaller limits as Modem code actually controls minimum TBF value Change-Id: I4a2bbd51da34e441f148275ec3c2c4fa9ece7599 CRs-Fixed: 951152 --- core/gps_extended.h | 14 ++++++++++---- core/gps_extended_c.h | 34 ++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/core/gps_extended.h b/core/gps_extended.h index 9eec3f92..b6d7a41b 100644 --- a/core/gps_extended.h +++ b/core/gps_extended.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,11 +29,16 @@ #ifndef GPS_EXTENDED_H #define GPS_EXTENDED_H +#include +/** + * @file + * @brief C++ declarations for GPS types + */ + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include #if defined(USE_GLIB) || defined(OFF_TARGET) #include #endif @@ -51,7 +56,8 @@ struct LocPosMode uint32_t gap, uint32_t accu, uint32_t time, const char* cred, const char* prov) : mode(m), recurrence(recr), - min_interval(gap < MIN_POSSIBLE_FIX_INTERVAL ? MIN_POSSIBLE_FIX_INTERVAL : gap), + min_interval(gap < GPS_MIN_POSSIBLE_FIX_INTERVAL_MS ? + GPS_MIN_POSSIBLE_FIX_INTERVAL_MS : gap), preferred_accuracy(accu), preferred_time(time) { memset(credentials, 0, sizeof(credentials)); memset(provider, 0, sizeof(provider)); @@ -66,7 +72,7 @@ struct LocPosMode inline LocPosMode() : mode(LOC_POSITION_MODE_MS_BASED), recurrence(GPS_POSITION_RECURRENCE_PERIODIC), - min_interval(MIN_POSSIBLE_FIX_INTERVAL), + min_interval(GPS_DEFAULT_FIX_INTERVAL_MS), preferred_accuracy(50), preferred_time(120000) { memset(credentials, 0, sizeof(credentials)); memset(provider, 0, sizeof(provider)); diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 55c158e3..f8e540fb 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,14 +29,19 @@ #ifndef GPS_EXTENDED_C_H #define GPS_EXTENDED_C_H -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - #include #include #include +/** + * @file + * @brief C++ declarations for GPS types + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + /** Location has valid source information. */ #define LOCATION_HAS_SOURCE_INFO 0x0020 /** GpsLocation has valid "is indoor?" flag */ @@ -177,7 +182,24 @@ typedef enum loc_position_mode_type { } LocPositionMode; -#define MIN_POSSIBLE_FIX_INTERVAL 1000 /* msec */ +/** + * @brief Minimum allowed value for fix interval. + * + * This value is a sanity limit in GPS framework. The hardware has own internal + * limits that may not match this value + * + * @sa GPS_DEFAULT_FIX_INTERVAL_MS + */ + +#define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100 +/** + * @brief Default value for fix interval. + * + * This value is used by default whenever appropriate. + * + * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS + */ +#define GPS_DEFAULT_FIX_INTERVAL_MS 1000 /** GpsLocationExtended has valid latitude and longitude. */ #define GPS_LOCATION_EXTENDED_HAS_LAT_LONG (1U<<0)