Ocean
IOSGPSTracker.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_DEVICES_IOS_IOS_GPS_TRACKER_H
9 #define META_OCEAN_DEVICES_IOS_IOS_GPS_TRACKER_H
10 
11 #include "ocean/devices/ios/IOS.h"
13 
15 
16 #include <CoreLocation/CoreLocation.h>
17 
19 @end
20 
21 namespace Ocean
22 {
23 
24 namespace Devices
25 {
26 
27 namespace IOS
28 {
29 
30 /**
31  * This class implements a GPS tracker for iOS platforms.
32  * @ingroup devicesios
33  */
34 class OCEAN_DEVICES_IOS_EXPORT IOSGPSTracker :
35  virtual public IOSDevice,
36  virtual public GPSTracker
37 {
38  friend class IOSFactory;
39 
40  public:
41 
42  /**
43  * Starts the device.
44  * @see Device::start().
45  */
46  bool start() override;
47 
48  /**
49  * Pauses the device.
50  * @see Device::pause().
51  */
52  bool pause() override;
53 
54  /**
55  * Stops the device.
56  * @see Device::stop().
57  */
58  bool stop() override;
59 
60  /**
61  * Sets a new GPS location for this tracker.
62  * @param latitude The position's latitude, in degree, always valid, with range [-90, 90]
63  * @param longitude The position's longitude, in degree, must be valid, with range [-180, 180]
64  * @param altitude The position's altitude, in meter, NumericF::minValue() if unknown
65  * @param direction The travel direction of the device, relative to north, in degree, north is 0 degree, east is 90 degree, with range [0, 360], -1 if unknown
66  * @param speed The device's speed, in meter per second, with range [0, infinity), -1 if unknown
67  * @param accuracy The horizontal accuracy as radius, in meter, with range [0, infinity), -1 if unknown
68  * @param altitudeAccuracy The vertical accuracy in meter, with range [0, infinity), -1 if unknown
69  * @param directionAccuracy The direction accuracy, in degree, with range [0, 180], -1 if unknown
70  * @param speedAccuracy The speed accuracy, in meter per second, with range [0, infinity), -1 if unknown
71  * @param timestamp The timestamp of the GPS location, must be valid
72  */
73  void newGPSLocation(const double latitude, const double longitude, const float altitude, const float direction, const float speed, const float accuracy, const float altitudeAccuracy, const float directionAccuracy, const float speedAccuracy, const Timestamp& timestamp);
74 
75  /**
76  * Returns the name of this tracker.
77  * @return The tracker's name
78  */
79  static inline std::string deviceNameIOSGPSTracker();
80 
81  /**
82  * Returns the device type of this tracker.
83  * @return The tracker's device type
84  */
85  static inline DeviceType deviceTypeIOSGPSTracker();
86 
87  protected:
88 
89  /**
90  * Creates a new GPS tracker device.
91  */
93 
94  /**
95  * Destructs a GPS tracker device.
96  */
97  ~IOSGPSTracker() override;
98 
99  protected:
100 
101  /// The delegate of the IOS GPS Tracker.
102  IOSGPSTrackerDelegate* iosGPSTrackerDelegate_ = nullptr;
103 
104  /// The timestamp of the last GPS signal;
106 
107  /// The unique id for the world object.
108  ObjectId gpsObjectId_ = invalidObjectId();
109 };
110 
111 inline std::string IOSGPSTracker::deviceNameIOSGPSTracker()
112 {
113  return std::string("IOS GPS Tracker");
114 }
115 
116 inline IOSGPSTracker::DeviceType IOSGPSTracker::deviceTypeIOSGPSTracker()
117 {
118  return deviceTypeGPSTracker();
119 }
120 
121 }
122 
123 }
124 
125 }
126 
127 #endif // META_OCEAN_DEVICES_IOS_IOS_GPS_TRACKER_H
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
This class is the base class for all gps tracker objects.
Definition: GPSTracker.h:37
This class implements a device for the IOS library.
Definition: IOSDevice.h:29
This class implements a device factory for the IOS feature based tracking system.
Definition: IOSFactory.h:29
This class implements a GPS tracker for iOS platforms.
Definition: IOSGPSTracker.h:37
Timestamp lastTimestamp_
The timestamp of the last GPS signal;.
Definition: IOSGPSTracker.h:105
~IOSGPSTracker() override
Destructs a GPS tracker device.
IOSGPSTracker()
Creates a new GPS tracker device.
bool stop() override
Stops the device.
bool pause() override
Pauses the device.
void newGPSLocation(const double latitude, const double longitude, const float altitude, const float direction, const float speed, const float accuracy, const float altitudeAccuracy, const float directionAccuracy, const float speedAccuracy, const Timestamp &timestamp)
Sets a new GPS location for this tracker.
bool start() override
Starts the device.
unsigned int ObjectId
Definition of an object id.
Definition: Measurement.h:46
This class implements a timestamp.
Definition: Timestamp.h:36
const ObjectId invalidObjectId
Definition of an invalid object id.
Definition: rendering/Rendering.h:65
Definition: IOSGPSTracker.h:18
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15