From 04e6ca93b92c37b3e58afc663bebe9428bbefbb9 Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Fri, 22 Apr 2016 14:19:33 -0700 Subject: [PATCH 1/3] Default apn ip type to ipv4 If a apn ip type is not found for a agps data connection, default to using ipv4 instead of invalid. CRs-fixed: 1007417 Change-Id: Icc71de1fab3fd5967901c39a5c11eaea17b7766c --- loc_api/libloc_api_50001/loc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 7411dc5a..5b6bebab 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -731,7 +731,7 @@ static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType) bearerType = AGPS_APN_BEARER_IPV4V6; break; default: - bearerType = AGPS_APN_BEARER_INVALID; + bearerType = AGPS_APN_BEARER_IPV4; break; } From edc2a648b3525006eded5d99091c248268425011 Mon Sep 17 00:00:00 2001 From: Madhanraj Chelladurai Date: Thu, 17 Mar 2016 11:58:51 +0530 Subject: [PATCH 2/3] gps: include support to check hardware type property automotive platform introduced a new android property called ro.hardware.type to detect automotive platform for the purpose of having automotive specific features. Added changes in loc_target to detect auto platform. Change-Id: Ib886b96b2e95dafc151bead041e5fc3d6740c468 CRs-Fixed: 992647 --- utils/loc_target.cpp | 20 +++++++++++++++++++- utils/loc_target.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp index 30c040c7..92bdca6d 100644 --- a/utils/loc_target.cpp +++ b/utils/loc_target.cpp @@ -174,6 +174,20 @@ void loc_get_platform_name(char *platform_name, int array_length) } } +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_auto_platform_name(char *platform_name, int array_length) +{ + if(platform_name && (array_length >= PROPERTY_VALUE_MAX)) { + property_get("ro.hardware.type", platform_name, ""); + LOC_LOGD("%s:%d]: Autoplatform name: %s\n", __func__, __LINE__, platform_name); + } + else { + LOC_LOGE("%s:%d]: Null parameter or array length less than PROPERTY_VALUE_MAX\n", + __func__, __LINE__); + } +} + unsigned int loc_get_target(void) { if (gTarget != (unsigned int)-1) @@ -190,6 +204,7 @@ unsigned int loc_get_target(void) char rd_id[LINE_LEN]; char rd_mdm[LINE_LEN]; char baseband[LINE_LEN]; + char rd_auto_platform[LINE_LEN]; if (is_qca1530()) { gTarget = TARGET_QCA1530; @@ -208,7 +223,10 @@ unsigned int loc_get_target(void) } else { read_a_line(id_dep, rd_id, LINE_LEN); } - if( !memcmp(baseband, STR_AUTO, LENGTH(STR_AUTO)) ) + + /*check automotive platform*/ + loc_get_auto_platform_name(rd_auto_platform, sizeof(rd_auto_platform)); + if( !memcmp(rd_auto_platform, STR_AUTO, LENGTH(STR_AUTO)) ) { gTarget = TARGET_AUTO; goto detected; diff --git a/utils/loc_target.h b/utils/loc_target.h index 3bb3b5e2..b76ed884 100644 --- a/utils/loc_target.h +++ b/utils/loc_target.h @@ -52,6 +52,10 @@ void loc_get_target_baseband(char *baseband, int array_length); /*The character array passed to this function should have length of atleast PROPERTY_VALUE_MAX*/ void loc_get_platform_name(char *platform_name, int array_length); +/*The character array passed to this function should have length + of atleast PROPERTY_VALUE_MAX*/ +void loc_get_auto_platform_name(char *platform_name, int array_length); + /*Reads the property ro.lean to identify if this is a lean target Returns: 0 if not a lean and mean target From 2d9840bcee4d4290df8bb0b3c518950e75d51108 Mon Sep 17 00:00:00 2001 From: Harikrishnan Hariharan Date: Thu, 28 Apr 2016 18:23:17 +0530 Subject: [PATCH 3/3] Use QMI_LOC_SET_NMEA_TYPES to set the NMEA sentences required. If NMEA_PROVIDER=1, HLOS needs to use the QMI type QMI_LOC_SET_NMEA_TYPES to set the type of NMEA sentences it needs. This will register for all possible NMEA sentences and instructs modem to send whatever it supports. Change-Id: I3a9e2219c1c9b4ca127a4b55f71b0a78a84cdd11 CRs-Fixed: 1005413 1006831 --- core/LocApiBase.cpp | 6 +++- core/LocApiBase.h | 4 ++- core/gps_extended_c.h | 30 +++++++++++++++++++- loc_api/libloc_api_50001/LocEngAdapter.h | 7 ++++- loc_api/libloc_api_50001/loc_eng.cpp | 36 ++++++++++++++++++++++-- 5 files changed, 77 insertions(+), 6 deletions(-) diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 45d16e90..7ef5e68b 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, 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 @@ -445,6 +445,10 @@ enum loc_api_adapter_err LocApiBase:: setSUPLVersion(uint32_t version) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) +enum loc_api_adapter_err LocApiBase:: + setNMEATypes (uint32_t typesMask) +DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) + enum loc_api_adapter_err LocApiBase:: setLPPConfig(uint32_t profile) DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 7b80f5f0..1b34e8e0 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, 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 @@ -171,6 +171,8 @@ public: informNiResponse(GpsUserResponseType userResponse, const void* passThroughData); virtual enum loc_api_adapter_err setSUPLVersion(uint32_t version); + virtual enum loc_api_adapter_err + setNMEATypes (uint32_t typesMask); virtual enum loc_api_adapter_err setLPPConfig(uint32_t profile); virtual enum loc_api_adapter_err diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h index 5bf11f30..1a24e13b 100644 --- a/core/gps_extended_c.h +++ b/core/gps_extended_c.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2016, 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 @@ -346,6 +346,34 @@ typedef uint32_t LocPosTechMask; #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040) #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080) +// Nmea sentence types mask +typedef uint32_t NmeaSentenceTypesMask; +#define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */ +#define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */ +#define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */ +#define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */ +#define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */ +#define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */ +#define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */ +#define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */ +#define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */ +#define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */ +#define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */ +#define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */ +#define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */ +#define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */ +#define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */ +#define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */ +#define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */ +#define LOC_NMEA_ALL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \ + LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \ + LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \ + LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \ + LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \ + LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 ) + + + typedef enum { LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0, LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM, diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 72b780d1..70468752 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2016, 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 @@ -185,6 +185,11 @@ public: { return mLocApi->setSUPLVersion(version); } + inline enum loc_api_adapter_err + setNMEATypes (uint32_t typesMask) + { + return mLocApi->setNMEATypes(typesMask); + } inline enum loc_api_adapter_err setLPPConfig(uint32_t profile) { diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 552e1d1c..93aacf6c 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2016, 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 @@ -497,6 +497,31 @@ struct LocEngSuplMode : public LocMsg { } }; +// case LOC_ENG_MSG_SET_NMEA_TYPE: +struct LocEngSetNmeaTypes : public LocMsg { + LocEngAdapter* mAdapter; + uint32_t nmeaTypesMask; + inline LocEngSetNmeaTypes(LocEngAdapter* adapter, + uint32_t typesMask) : + LocMsg(), mAdapter(adapter), nmeaTypesMask(typesMask) + { + locallog(); + } + inline virtual void proc() const { + // set the nmea types + mAdapter->setNMEATypes(nmeaTypesMask); + } + inline void locallog() const + { + LOC_LOGV("LocEngSetNmeaTypes %u\n",nmeaTypesMask); + } + inline virtual void log() const + { + locallog(); + } +}; + + // case LOC_ENG_MSG_LPP_CONFIG: struct LocEngLppConfig : public LocMsg { LocEngAdapter* mAdapter; @@ -1749,7 +1774,7 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, event = event ^ LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT; // unregister for modem NMEA report loc_eng_data.generateNmea = true; } - else + else if (gps_conf.NMEA_PROVIDER == NMEA_PROVIDER_MP) { loc_eng_data.generateNmea = false; } @@ -1779,6 +1804,13 @@ static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data) sap_conf.SENSOR_PROVIDER)); adapter->sendMsg(new LocEngAGlonassProtocol(adapter, gps_conf.A_GLONASS_POS_PROTOCOL_SELECT)); + if (!loc_eng_data.generateNmea) + { + NmeaSentenceTypesMask typesMask = LOC_NMEA_ALL_SUPPORTED_MASK; + LOC_LOGD("loc_eng_init setting nmea types, mask = %u\n",typesMask); + adapter->sendMsg(new LocEngSetNmeaTypes(adapter,typesMask)); + } + /* Make sure at least one of the sensor property is specified by the user in the gps.conf file. */ if( sap_conf.GYRO_BIAS_RANDOM_WALK_VALID || sap_conf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||