summaryrefslogtreecommitdiffstats
path: root/plugins/lib/bluetooth
diff options
context:
space:
mode:
authorJonathan Aillet <jonathan.aillet@iot.bzh>2018-09-07 18:59:02 +0200
committerJonathan Aillet <jonathan.aillet@iot.bzh>2018-10-08 15:57:27 +0200
commit13d8b36149570aa91b8659ae74cf14e11c621233 (patch)
tree1279653baa43684b91e0e75f2dd039f6a996a8ea /plugins/lib/bluetooth
parent57c1e0bf737735854b19d5d43adf5645e1b52913 (diff)
Get hal data in hal-bt plugin
Get hal data in hal-bt plugin. It will be used, for example, to get softmixer call information. Change-Id: I3cb2fd8d2f3f656fb4a796e13c1f62e751675861 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'plugins/lib/bluetooth')
-rw-r--r--plugins/lib/bluetooth/CMakeLists.txt1
-rw-r--r--plugins/lib/bluetooth/hal-bt-data.h4
-rw-r--r--plugins/lib/bluetooth/hal-bt.c12
3 files changed, 17 insertions, 0 deletions
diff --git a/plugins/lib/bluetooth/CMakeLists.txt b/plugins/lib/bluetooth/CMakeLists.txt
index fa28ae1..5969755 100644
--- a/plugins/lib/bluetooth/CMakeLists.txt
+++ b/plugins/lib/bluetooth/CMakeLists.txt
@@ -42,4 +42,5 @@ PROJECT_TARGET_ADD(hal-bt)
target_include_directories(${TARGET_NAME}
PRIVATE "${CMAKE_SOURCE_DIR}/app-controller/ctl-lib"
+ PRIVATE "${CMAKE_SOURCE_DIR}/4a-hal/4a-hal-utilities"
)
diff --git a/plugins/lib/bluetooth/hal-bt-data.h b/plugins/lib/bluetooth/hal-bt-data.h
index ea3fe99..eb5eb26 100644
--- a/plugins/lib/bluetooth/hal-bt-data.h
+++ b/plugins/lib/bluetooth/hal-bt-data.h
@@ -24,6 +24,8 @@
#include <json-c/json.h>
+#include <4a-hal-utilities-data.h>
+
// Structure to store bluetooth device data
struct HalBtDeviceData {
char *uid;
@@ -41,6 +43,8 @@ struct HalBtDeviceData {
struct HalBtPluginData {
unsigned int btStreamEnabled;
+ struct SpecificHalData *currentHalData;
+
struct HalBtDeviceData *selectedBtDevice;
struct HalBtDeviceData *first;
};
diff --git a/plugins/lib/bluetooth/hal-bt.c b/plugins/lib/bluetooth/hal-bt.c
index 36b5ba6..bc89fe1 100644
--- a/plugins/lib/bluetooth/hal-bt.c
+++ b/plugins/lib/bluetooth/hal-bt.c
@@ -37,6 +37,8 @@ CTLP_CAPI_REGISTER(HAL_BT_PLUGIN_NAME)
// Call at initialisation time
CTLP_ONLOAD(plugin, callbacks)
{
+ CtlConfigT *ctrlConfig;
+
AFB_ApiNotice(plugin->api, "Hal-Bt Plugin Registered: uid='%s' 'info='%s'", plugin->uid, plugin->info);
memset(&localHalBtPluginData, '\0', sizeof(localHalBtPluginData));
@@ -46,6 +48,16 @@ CTLP_ONLOAD(plugin, callbacks)
return -1;
}
+ if(! (ctrlConfig = (CtlConfigT *) afb_dynapi_get_userdata(plugin->api))) {
+ AFB_ApiError(plugin->api, "Can't get current hal controller config");
+ return -2;
+ }
+
+ if(! (localHalBtPluginData.currentHalData = (struct SpecificHalData *) ctrlConfig->external)) {
+ AFB_ApiError(plugin->api, "%s: Can't get current hal controller data", __func__);
+ return -3;
+ }
+
/* TDB JAI :
- Register 'init' plugin function (HAL_BT_PLUGIN_NAME#init) as onload action here (to avoid adding it in json)
- Register 'event' plugin function (HAL_BT_PLUGIN_NAME#event) as action for BT_MANAGER_API#BT_MANAGER_DEVICE_UPDATE_EVENT event here (to avoid adding it in json)