class P1::CameraSdk::Notifications
Overview
#include <P1CameraNotifications.hpp> class Notifications { public: // methods static uint32_t RegisterListener(); static void DeregisterListener(const uint32_t listenerId); static void Enable( const uint32_t listenerId, const Camera& camera, const int propertyId ); static void Enable( const uint32_t listenerId, const Camera& cameraId, const CameraEventId eventId ); static void Disable( const uint32_t listenerId, const Camera& camera, const int propertyId ); static void Disable( const uint32_t listenerId, const Camera& cameraId, const CameraEventId eventId ); static void DisableAll(const uint32_t listenerId); static void WakeUpWaitingThreads(const uint32_t listenerId); static NotificationEvent WaitForNotification( const uint32_t listenerId, uint32_t timeoutMs = 0 ); static bool WaitForNotification( const uint32_t listenerId, NotificationEvent& event, uint32_t timeoutMs = 0 ); };
Detailed Documentation
Methods
static uint32_t RegisterListener()
Register as listener for receiving events.
The returned token shall be used to identify the listener in all succeeding function calls.
static void DeregisterListener(const uint32_t listenerId)
Cleans up everything for the given listener, and render the id useless.
static void Enable( const uint32_t listenerId, const Camera& camera, const int propertyId )
Begin listening for a camera property change.
Before any notification will arrive, you must register yourself as a listener. A listener is local to the current thread. This means you must use the same thread to call this function and WaitForNotification.
Parameters:
userHandle |
A registered listener-id. |
camera |
The camera on which to listen for the property change |
propertyId |
The property to listen for changes on |
static void WakeUpWaitingThreads(const uint32_t listenerId)
Wake up all pending threads “caught” in the WaitForNotification() function.
This function will force all pending thread to exit from WaitForNotification as if a timeout has arrived. Even if no timeout was configured!
You should use this function to terminate your threads gracefully, when your app exits.
static NotificationEvent WaitForNotification( const uint32_t listenerId, uint32_t timeoutMs = 0 )
Wait for the next arriving vent (property change or camera event)
This call will block until the notification arrives, or until a defined timeout is reached.
If timeout is reached this call throws the NotificationTimeoutExc exception.
Parameters:
timeoutMs |
A millisecond timeout for when to give up waiting, or zero to wait forever. |
Returns:
The event that has occurred (if note timed out).
static bool WaitForNotification( const uint32_t listenerId, NotificationEvent& event, uint32_t timeoutMs = 0 )
Wait for the next arriving vent (property change or camera event)
This call will block until the notification arrives, or until a defined timeout is reached.
Parameters:
event |
The event that has occurred (if note timed out) |
timeoutMs |
A millisecond timeout for when to give up waiting, or zero to wait forever. |
Returns:
true is a notification arrived, false if timeout was reached