Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GPSGeofence.h
00001 /** 00002 ****************************************************************************** 00003 * @file GPSGeofence.h 00004 * @author AST/CL 00005 * @version V1.1.0 00006 * @date Jun, 2017 00007 * @brief . 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 #ifndef __GPS_GEOFENCE_H__ 00039 #define __GPS_GEOFENCE_H__ 00040 00041 class GPSProvider; 00042 00043 class GPSGeofence { 00044 public: 00045 enum { 00046 GEOFENCE_TRANSITION_DWELL = 1, 00047 GEOFENCE_TRANSITION_ENTER = 2, 00048 GEOFENCE_TRANSITION_EXIT = 4, 00049 }; 00050 00051 static const int NEVER_EXPIRE = -1; 00052 00053 static const int GEOFENCE_ID_MAX_SIZE = 32; 00054 00055 /** 00056 * Construct a GPSGeofence instance. 00057 */ 00058 GPSGeofence() : 00059 _expirationDuration(-1), 00060 _notificationResponsiveness(0), 00061 _transitionTypes(0) { 00062 00063 memset(_geofenceId, 0, GEOFENCE_ID_MAX_SIZE); 00064 } 00065 00066 virtual void setGeofenceRegion(GPSProvider::LocationType_t lat, 00067 GPSProvider::LocationType_t lon, 00068 GPSProvider::LocationType_t radius) { 00069 _lat = lat; 00070 _lon = lon; 00071 _radius = radius; 00072 } 00073 00074 virtual void setExpirationDuration (long durationMillis) = 0; 00075 00076 virtual void setNotificationResponsiveness (int notificationResponsivenessMs) { 00077 _notificationResponsiveness = notificationResponsivenessMs; 00078 } 00079 00080 virtual void setGeofenceId(const char *geofenceId) { 00081 if(strlen(geofenceId) > GEOFENCE_ID_MAX_SIZE) { 00082 return; 00083 } 00084 memcpy(_geofenceId, geofenceId, strlen(geofenceId)); 00085 } 00086 00087 virtual void setTransitionTypes(int transitionTypes) { 00088 _transitionTypes = transitionTypes; 00089 } 00090 00091 protected: 00092 char _geofenceId[GEOFENCE_ID_MAX_SIZE]; 00093 GPSProvider::LocationType_t _lat; 00094 GPSProvider::LocationType_t _lon; 00095 GPSProvider::LocationType_t _radius; 00096 long _expirationDuration; 00097 int _notificationResponsiveness; 00098 int _transitionTypes; 00099 00100 private: 00101 /* disallow copy constructor and assignment operators */ 00102 GPSGeofence(const GPSGeofence&); 00103 GPSGeofence & operator= (const GPSGeofence&); 00104 }; 00105 00106 #endif /* __GPS_GEOFENCE_H__ */
Generated on Fri Jul 15 2022 15:27:30 by
1.7.2