summaryrefslogtreecommitdiffstats
path: root/ahl-binding/interrupt.cpp
diff options
context:
space:
mode:
authorLoïc Collignon <loic.collignon@iot.bzh>2018-12-14 14:42:45 +0100
committerLoïc Collignon <loic.collignon@iot.bzh>2018-12-17 16:54:31 +0100
commit87be9daee783c15219f960afb092fecb755ab5fc (patch)
tree4c1088d749fa748316982c56a2b3a351349ebff3 /ahl-binding/interrupt.cpp
parent22c3fc2ae2ba2125bc3af55ab8e6de4bc4102ac6 (diff)
WIP: adding a master volumesandbox/ctxnop/mastervolume
Create a master volume that binds to the master volume of the real hardware, as set up in the corresponding HAL. Change-Id: I18b02327bb42177c21ed8d9db9f7a7b8adbd87d0 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
Diffstat (limited to 'ahl-binding/interrupt.cpp')
-rw-r--r--ahl-binding/interrupt.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/ahl-binding/interrupt.cpp b/ahl-binding/interrupt.cpp
index 5bf0b79..7893d99 100644
--- a/ahl-binding/interrupt.cpp
+++ b/ahl-binding/interrupt.cpp
@@ -65,9 +65,9 @@ int interrupt_t::apply(afb_req_t req, const role_t& role)
AFB_API_DEBUG(ahl_binding_t::instance().handle(),
"Call '%s'/'%s' '%s'",
- r.hal().c_str(), r.stream().c_str(), json_object_to_json_string(arg));
+ r.hal().c_str(), r.resource().c_str(), json_object_to_json_string(arg));
- if(afb_api_call_sync(ahl_binding_t::instance().handle(), r.hal().c_str(), r.stream().c_str(), arg, &result, nullptr, nullptr))
+ if(afb_api_call_sync(ahl_binding_t::instance().handle(), r.hal().c_str(), r.resource().c_str(), arg, &result, nullptr, nullptr))
{
afb_req_fail(req, "Failed to call 'ramp' action on stream", nullptr);
return -1;
@@ -78,7 +78,7 @@ int interrupt_t::apply(afb_req_t req, const role_t& role)
applied_on_.push_back(std::make_tuple<std::string, int>(r.uid(), json_object_get_int(jvolold)));
AFB_API_DEBUG(ahl_binding_t::instance().handle(),
"POLICY: Applying a ramp to '%s' stream because '%s' is opened and have higher priority!",
- r.stream().c_str(), role.stream().c_str());
+ r.resource().c_str(), role.resource().c_str());
}
}
}
@@ -117,13 +117,6 @@ void interrupt_t::clear()
// Create an fake-interrupt, with the old volume
json_object* interrupt = json_tokener_parse(json_object_to_json_string(args_));
json_object_object_add(interrupt, "volume", json_object_new_int(vol)); // Replace the volume
- /*
- json_object* volume = nullptr;
- if (json_object_object_get_ex(interrupt, "volume", &volume))
- {
- json_object_set_int(volume, vol);
- }
- */
json_object* arg = json_object_new_object();
json_object_object_add(arg, "ramp", interrupt);
@@ -131,9 +124,9 @@ void interrupt_t::clear()
AFB_API_DEBUG(ahl_binding_t::instance().handle(),
"Call '%s'/'%s' '%s",
- r.hal().c_str(), r.stream().c_str(), json_object_to_json_string(arg));
+ r.hal().c_str(), r.resource().c_str(), json_object_to_json_string(arg));
- if(afb_api_call_sync(ahl_binding_t::instance().handle(), r.hal().c_str(), r.stream().c_str(), arg, &result, nullptr, nullptr))
+ if(afb_api_call_sync(ahl_binding_t::instance().handle(), r.hal().c_str(), r.resource().c_str(), arg, &result, nullptr, nullptr))
{
AFB_API_ERROR(ahl_binding_t::instance().handle(),
"Failed to call 'ramp' action on '%s'", role.c_str());