summaryrefslogtreecommitdiffstats
path: root/ahl-binding
diff options
context:
space:
mode:
Diffstat (limited to 'ahl-binding')
-rw-r--r--ahl-binding/afb-binding-common.h33
-rw-r--r--ahl-binding/ahl-binding.cpp4
-rw-r--r--ahl-binding/ahl-binding.hpp9
-rw-r--r--ahl-binding/role.cpp2
-rw-r--r--ahl-binding/role.hpp3
5 files changed, 38 insertions, 13 deletions
diff --git a/ahl-binding/afb-binding-common.h b/ahl-binding/afb-binding-common.h
new file mode 100644
index 0000000..61118db
--- /dev/null
+++ b/ahl-binding/afb-binding-common.h
@@ -0,0 +1,33 @@
+#pragma once
+
+/*
+ * Copyright (C) 2018 "IoT.bzh"
+ * Author Loïc Collignon <loic.collignon@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AFB_BINDING_VERSION 0
+#define AFB_BINDING_WANT_DYNAPI
+#include <afb/afb-binding.h>
+#include <string.h>
+#include <ctl-config.h>
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/ahl-binding/ahl-binding.cpp b/ahl-binding/ahl-binding.cpp
index 37e6847..29be7a1 100644
--- a/ahl-binding/ahl-binding.cpp
+++ b/ahl-binding/ahl-binding.cpp
@@ -268,7 +268,7 @@ void ahl_binding_t::load_static_verbs()
ahl_api_get_roles,
nullptr,
nullptr,
- AFB_SESSION_NONE_V2))
+ AFB_SESSION_NONE_X2))
{
throw std::runtime_error("Failed to add 'get_role' verb to the API.");
}
@@ -360,7 +360,7 @@ int ahl_binding_t::create_api_verb(role_t* r)
ahl_api_role,
r,
nullptr,
- AFB_SESSION_NONE_V2))
+ AFB_SESSION_NONE_X2))
{
AFB_DYNAPI_ERROR(handle_, "Failed to add '%s' verb to the API.",
r->uid().c_str());
diff --git a/ahl-binding/ahl-binding.hpp b/ahl-binding/ahl-binding.hpp
index e76d7ef..aa4b104 100644
--- a/ahl-binding/ahl-binding.hpp
+++ b/ahl-binding/ahl-binding.hpp
@@ -32,14 +32,7 @@
#define HL_API_INFO "Audio high level API for AGL applications"
#define HAL_MGR_API "4a-hal-manager"
-extern "C" {
-
- #define AFB_BINDING_VERSION 0
- #define AFB_BINDING_WANT_DYNAPI
- #include <afb/afb-binding.h>
- #include <string.h>
- #include <ctl-config.h>
-};
+#include "afb-binding-common.h"
class ahl_binding_t
{
diff --git a/ahl-binding/role.cpp b/ahl-binding/role.cpp
index 2be3dc5..5215a60 100644
--- a/ahl-binding/role.cpp
+++ b/ahl-binding/role.cpp
@@ -261,7 +261,7 @@ void role_t::volume(afb_request* r, json_object* o)
json_object_object_add(a, "volume", value);
afb_dynapi_call(
- r->dynapi,
+ r->api,
hal_.c_str(),
stream_.c_str(),
a,
diff --git a/ahl-binding/role.hpp b/ahl-binding/role.hpp
index 1469b68..6831195 100644
--- a/ahl-binding/role.hpp
+++ b/ahl-binding/role.hpp
@@ -19,8 +19,7 @@
#include <vector>
#include "interrupt.hpp"
-
-struct afb_request;
+#include "afb-binding-common.h"
class role_t
{