An extension of original API for working with GPS devices.
GPSGeofence.h
- Committer:
- apalmieri
- Date:
- 2017-06-13
- Revision:
- 8:47fa213225c3
- Child:
- 9:708266cd594b
File content as of revision 8:47fa213225c3:
/* mbed Microcontroller Library * Copyright (c) 2006-2014 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __GPS_GEOFENCE_H__ #define __GPS_GEOFENCE_H__ class GPSProvider; class GPSGeofence { public: enum { GEOFENCE_TRANSITION_DWELL = 1, GEOFENCE_TRANSITION_ENTER = 2, GEOFENCE_TRANSITION_EXIT = 4, }; static const int NEVER_EXPIRE = -1; static const int GEOFENCE_ID_MAX_SIZE = 32; /** * Construct a GPSGeofence instance. */ GPSGeofence() : _expirationDuration(-1), _notificationResponsiveness(0), _transitionTypes(0) { memset(_geofenceId, 0, GEOFENCE_ID_MAX_SIZE); } virtual void setGeofenceRegion(GPSProvider::LocationType_t lat, GPSProvider::LocationType_t lon, GPSProvider::LocationType_t radius) { _lat = lat; _lon = lon; _radius = radius; } virtual void setExpirationDuration (long durationMillis) = 0; virtual void setNotificationResponsiveness (int notificationResponsivenessMs) { _notificationResponsiveness = notificationResponsivenessMs; } virtual void setGeofenceId(const char *geofenceId) { if(strlen(geofenceId) > GEOFENCE_ID_MAX_SIZE) { return; } memcpy(_geofenceId, geofenceId, strlen(geofenceId)); } virtual void setTransitionTypes(int transitionTypes) { _transitionTypes = transitionTypes; } protected: char _geofenceId[GEOFENCE_ID_MAX_SIZE]; GPSProvider::LocationType_t _lat; GPSProvider::LocationType_t _lon; GPSProvider::LocationType_t _radius; long _expirationDuration; int _notificationResponsiveness; int _transitionTypes; private: /* disallow copy constructor and assignment operators */ GPSGeofence(const GPSGeofence&); GPSGeofence & operator= (const GPSGeofence&); }; #endif /* __GPS_GEOFENCE_H__ */