summaryrefslogtreecommitdiffstats
path: root/ahl-binding/role.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'ahl-binding/role.hpp')
-rw-r--r--ahl-binding/role.hpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/ahl-binding/role.hpp b/ahl-binding/role.hpp
index fa1bcd4..1469b68 100644
--- a/ahl-binding/role.hpp
+++ b/ahl-binding/role.hpp
@@ -20,17 +20,24 @@
#include <vector>
#include "interrupt.hpp"
+struct afb_request;
+
class role_t
{
private:
+ // Members filled by config
std::string uid_;
- std::string name_;
std::string description_;
+ std::string hal_;
std::string stream_;
- std::string device_uri_;
int priority_;
std::vector<interrupt_t> interrupts_;
+ std::string device_uri_;
+ bool opened_;
+
+ int apply_policy(afb_request* req);
+
public:
explicit role_t() = default;
explicit role_t(const role_t&) = default;
@@ -41,23 +48,32 @@ public:
role_t& operator=(const role_t&) = default;
role_t& operator=(role_t&&) = default;
- explicit role_t(std::string uid, std::string name, std::string description, std::string stream, int priority);
+ static role_t from_json(json_object* o);
+
explicit role_t(json_object* j);
role_t& operator<<(json_object* j);
std::string uid() const;
- std::string name() const;
std::string description() const;
+ std::string hal() const;
std::string stream() const;
int priority() const;
- std::string device_uri() const;
const std::vector<interrupt_t>& interrupts() const;
+ std::string device_uri() const;
+ bool opened() const;
void uid(std::string v);
- void name(std::string v);
void description(std::string v);
+ void hal(std::string v);
void stream(std::string v);
- void priority(int v);
void device_uri(std::string v);
+ void priority(int v);
+
+ void invoke(afb_request* r);
+
+ void open(afb_request* r, json_object* o);
+ void close(afb_request* r, json_object* o);
+ void volume(afb_request* r, json_object* o);
+ void interrupt(afb_request* r, json_object* o);
};