diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-09-07 18:59:02 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2018-10-08 15:57:27 +0200 |
commit | 13d8b36149570aa91b8659ae74cf14e11c621233 (patch) | |
tree | 1279653baa43684b91e0e75f2dd039f6a996a8ea /plugins/lib/bluetooth/hal-bt.c | |
parent | 57c1e0bf737735854b19d5d43adf5645e1b52913 (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/hal-bt.c')
-rw-r--r-- | plugins/lib/bluetooth/hal-bt.c | 12 |
1 files changed, 12 insertions, 0 deletions
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) |