libcamera: message: Add user message types

Reserve identifiers for user-defined message types and add an operation
to the Message class to register the type identifiers.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi
2019-07-15 07:59:35 +02:00
committed by Laurent Pinchart
parent 3e29a2d520
commit fae053307d
3 changed files with 54 additions and 0 deletions
+7
View File
@@ -7,6 +7,8 @@
#ifndef __LIBCAMERA_MESSAGE_H__
#define __LIBCAMERA_MESSAGE_H__
#include <atomic>
namespace libcamera {
class Object;
@@ -19,6 +21,7 @@ public:
enum Type {
None = 0,
SignalMessage = 1,
UserMessage = 1000,
};
Message(Type type);
@@ -27,11 +30,15 @@ public:
Type type() const { return type_; }
Object *receiver() const { return receiver_; }
static Type registerMessageType();
private:
friend class Thread;
Type type_;
Object *receiver_;
static std::atomic_uint nextUserType_;
};
class SignalMessage : public Message