From 2d9840bcee4d4290df8bb0b3c518950e75d51108 Mon Sep 17 00:00:00 2001 From: Harikrishnan Hariharan Date: Thu, 28 Apr 2016 18:23:17 +0530 Subject: [PATCH] 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 ||