summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryingjiew <quic_yingjiew@quicinc.com>2022-03-15 18:05:39 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2022-04-10 22:40:21 -0700
commit3a8b9deb82e7068f0c21c6cde3aa1329bbf88c1b (patch)
tree699af1fdb9c46cfa9f817648784c39ad1df1d4cd
parent0f362f16f7e5a2fa51d86b8f8ab509c2316cda66 (diff)
Inject DwellTypeMask and Confidence for Geofence
When adding geofence from location SDK API, DwellTypeMask is dropped and confidence is hardcoded as HIGH regardless of input. Change-Id: I4dd0f5f684bab6b52991b2b77b41aaa7d5e7afea CRs-Fixed: 3150859
-rwxr-xr-xandroid/2.1/location_api/GeofenceAPIClient.cpp36
-rw-r--r--geofence/GeofenceAdapter.cpp40
-rw-r--r--geofence/GeofenceAdapter.h36
-rw-r--r--location/LocationDataTypes.h42
-rw-r--r--utils/loc_gps.h42
5 files changed, 195 insertions, 1 deletions
diff --git a/android/2.1/location_api/GeofenceAPIClient.cpp b/android/2.1/location_api/GeofenceAPIClient.cpp
index 9bc8626..23d15a6 100755
--- a/android/2.1/location_api/GeofenceAPIClient.cpp
+++ b/android/2.1/location_api/GeofenceAPIClient.cpp
@@ -26,6 +26,41 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_GeofenceApiClient"
@@ -100,6 +135,7 @@ void GeofenceAPIClient::geofenceAdd(uint32_t geofence_id, double latitude, doubl
if (monitor_transitions & IGnssGeofenceCallback::GeofenceTransition::EXITED)
options.breachTypeMask |= GEOFENCE_BREACH_EXIT_BIT;
options.responsiveness = notification_responsiveness_ms;
+ options.confidence = GEOFENCE_CONFIDENCE_HIGH;
GeofenceInfo data;
data.size = sizeof(GeofenceInfo);
diff --git a/geofence/GeofenceAdapter.cpp b/geofence/GeofenceAdapter.cpp
index f372cac..ed5fd0d 100644
--- a/geofence/GeofenceAdapter.cpp
+++ b/geofence/GeofenceAdapter.cpp
@@ -26,6 +26,41 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#define LOG_TAG "LocSvc_GeofenceAdapter"
#include <GeofenceAdapter.h>
@@ -160,7 +195,8 @@ GeofenceAdapter::restartGeofences()
GeofenceOption options = {sizeof(GeofenceOption),
object.breachMask,
object.responsiveness,
- object.dwellTime};
+ object.dwellTime,
+ object.confidence};
GeofenceInfo info = {sizeof(GeofenceInfo),
object.latitude,
object.longitude,
@@ -657,6 +693,7 @@ GeofenceAdapter::saveGeofenceItem(LocationAPI* client, uint32_t clientId, uint32
options.breachTypeMask,
options.responsiveness,
options.dwellTime,
+ options.confidence,
info.latitude,
info.longitude,
info.radius,
@@ -723,6 +760,7 @@ GeofenceAdapter::modifyGeofenceItem(uint32_t hwId, const GeofenceOption& options
it->second.breachMask = options.breachTypeMask;
it->second.responsiveness = options.responsiveness;
it->second.dwellTime = options.dwellTime;
+ it->second.confidence = options.confidence;
dump();
} else {
LOC_LOGE("%s]: geofence item to modify not found. hwId %u", __func__, hwId);
diff --git a/geofence/GeofenceAdapter.h b/geofence/GeofenceAdapter.h
index 773e611..729a4e4 100644
--- a/geofence/GeofenceAdapter.h
+++ b/geofence/GeofenceAdapter.h
@@ -26,6 +26,41 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#ifndef GEOFENCE_ADAPTER_H
#define GEOFENCE_ADAPTER_H
@@ -66,6 +101,7 @@ typedef struct {
GeofenceBreachTypeMask breachMask;
uint32_t responsiveness;
uint32_t dwellTime;
+ GeofenceConfidence confidence;
double latitude;
double longitude;
double radius;
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index 06dcb85..34a7500 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -26,6 +26,41 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#ifndef LOCATIONDATATYPES_H
#define LOCATIONDATATYPES_H
@@ -239,6 +274,12 @@ typedef enum {
GEOFENCE_STATUS_AVAILABILE_YES,
} GeofenceStatusAvailable;
+typedef enum {
+ GEOFENCE_CONFIDENCE_LOW = 1,
+ GEOFENCE_CONFIDENCE_MEDIUM,
+ GEOFENCE_CONFIDENCE_HIGH,
+} GeofenceConfidence;
+
// Set of masks for Modem and QWES capabilities.
typedef uint64_t LocationCapabilitiesMask;
typedef enum {
@@ -1084,6 +1125,7 @@ typedef struct {
GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits
uint32_t responsiveness; // in milliseconds
uint32_t dwellTime; // in seconds
+ GeofenceConfidence confidence; // confidence of breach event
} GeofenceOption;
typedef struct {
diff --git a/utils/loc_gps.h b/utils/loc_gps.h
index 0c122fb..2625b82 100644
--- a/utils/loc_gps.h
+++ b/utils/loc_gps.h
@@ -13,6 +13,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+/*
+Changes from Qualcomm Innovation Center are provided under the following license:
+
+Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted (subject to the limitations in the
+disclaimer below) provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
#ifndef LOC_GPS_H
#define LOC_GPS_H
@@ -1283,6 +1318,13 @@ typedef struct {
#define LOC_GPS_GEOFENCE_EXITED (1<<1L)
#define LOC_GPS_GEOFENCE_UNCERTAIN (1<<2L)
+#define LOC_GPS_GEOFENCE_DWELL_INSIDE (1<<0L)
+#define LOC_GPS_GEOFENCE_DWELL_OUTSIDE (1<<1L)
+
+#define LOC_GPS_GEOFENCE_CONFIDENCE_LOW 1
+#define LOC_GPS_GEOFENCE_CONFIDENCE_MEDIUM 2
+#define LOC_GPS_GEOFENCE_CONFIDENCE_HIGH 3
+
#define LOC_GPS_GEOFENCE_UNAVAILABLE (1<<0L)
#define LOC_GPS_GEOFENCE_AVAILABLE (1<<1L)