#include <eventsystem.h>
#include <stdio.h>
#include <actd/unit_control.h>
+#include <hal-bluetooth.h>
#include "bt-core-main.h"
#include "bt-core-adapter.h"
return -1;
}
+ /* Precondition to start bluetooth hal */
+ ret = hal_bluetooth_get_backend();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_get_backend() failed. ret: %d", ret);
+ return -1;
+ }
+
+ /* Start bluetooth hal */
+ ret = hal_bluetooth_start();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_start() failed. ret: %d", ret);
+ return -1;
+ }
+ BT_ERR("Started successfully bluetooth hal");
+
/* activate Bluez */
ret = __bt_call_systemact_service(BT_SYSTEMACT_BLUEZ_START);
if (ret < 0) {
if (__bt_call_systemact_service(BT_SYSTEMACT_STACK_DOWN_WITH_RADIO) < 0)
BT_ERR("running script failed");
} else {
- if (__bt_call_systemact_service(BT_SYSTEMACT_STACK_DOWN) < 0)
- BT_ERR("running script failed");
+ int ret;
+
+ /* Precondition to stop bluetooth hal */
+ ret = hal_bluetooth_get_backend();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_get_backend() failed. ret: %d", ret);
+ return -1;
+ }
+
+ /* Stop bluetooth hal */
+ ret = hal_bluetooth_stop();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_stop() failed. ret: %d", ret);
+ return -1;
+ }
+ BT_ERR("Stopped successfully bluetooth hal");
}
}
_bt_core_terminate();
return -1;
}
} else {
- if (__bt_call_systemact_service(BT_SYSTEMACT_STACK_DOWN) < 0) {
- BT_ERR("running script failed");
- __bt_core_set_status(BT_ACTIVATED);
+ int ret;
+
+ /* Precondition to stop bluetooth hal */
+ ret = hal_bluetooth_get_backend();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_get_backend() failed. ret: %d", ret);
+ return -1;
+ }
+
+ /* Stop bluetooth hal */
+ ret = hal_bluetooth_stop();
+ if (ret < 0) {
+ BT_ERR("hal_bluetooth_stop() failed. ret: %d", ret);
return -1;
}
+ BT_ERR("Stopped successfully bluetooth hal");
}
}