From 13d8b36149570aa91b8659ae74cf14e11c621233 Mon Sep 17 00:00:00 2001 From: Jonathan Aillet Date: Fri, 7 Sep 2018 18:59:02 +0200 Subject: 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 --- plugins/lib/bluetooth/hal-bt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/lib/bluetooth/hal-bt.c') 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) -- cgit 1.2.3-korg