summaryrefslogtreecommitdiffstats
path: root/ahl-binding/role.hpp
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-06-12 11:00:25 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-06-12 14:40:08 +0000
commit22c2633ac833ae78ff84beafce19cec0f05758a2 (patch)
treedca31bcfc6bf27aaca93e6f9f676361c6f6ed1e1 /ahl-binding/role.hpp
parent9a631c30c9c8792865ce2aa0ec06a1bb5fd16751 (diff)
Update to last softmixer and hal, plus some fixes
Use the last 4a-softmixer and 4a-hal-generic versions. Fix some potential crash and performance bottleneck. Now support sessions to disallow multiple opening or closing by not owner. Change-Id: I95b020a3fab03b1e1058812adae1d8d5986f282b Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
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);
};