8 #ifndef META_OCEAN_DEVICES_IOS_MOTION_MANAGER_H
9 #define META_OCEAN_DEVICES_IOS_MOTION_MANAGER_H
17 #include <CoreMotion/CoreMotion.h>
92 static constexpr
inline ListenerId invalidListenerId();
109 CMMotionManager* motionManager_ =
nullptr;
115 unsigned int nextListenerId_ = invalidListenerId();
This class implements a container for callback functions.
Definition: Callback.h:3456
This class implements a simple wrapper for the CMMotionManager object as an application must not crea...
Definition: MotionManager.h:35
DeviceMotionListenerMap deviceMotionListenerMap_
Map storing the set of registered listeners.
Definition: MotionManager.h:112
void start()
Internally starts the main DeviceMotion callback with CMMotionMap.
std::unordered_map< ListenerId, DeviceMotionCallback > DeviceMotionListenerMap
Type of an unordered map mapping listener ids to callback functions.
Definition: MotionManager.h:55
bool setObject(CMMotionManager *object)
Sets the instance of the CMMotionManager object explicitly as the application holds the instance alre...
CMMotionManager * object()
Returns the instance of the CMMotionManager object hold by this singleton.
Callback< void, CMDeviceMotion * > DeviceMotionCallback
Definition of a callback function to subscribe for new device motion samples.
Definition: MotionManager.h:48
static constexpr ListenerId invalidListenerId()
Returns an invalid listener id.
Definition: MotionManager.h:121
ListenerId addListener(const DeviceMotionCallback &callback)
Register a new listener.
MotionManager()=default
Protected default constructor.
Lock lock_
The manager's lock.
Definition: MotionManager.h:118
unsigned int ListenerId
Definition of a listener id for a registered callbacks.
Definition: MotionManager.h:43
void removeListener(const ListenerId listenerId)
Unregister a given listener.
This class implements a recursive lock object.
Definition: Lock.h:31
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15