#include <time.h>
#include <sys/time.h>
#include <ell/ell.h>
+#include <actd/unit_control.h>
#include "bluetooth-api.h"
#include "bt-internal-types.h"
#include <oal-mesh.h>
+#define MESH_SYSTEMD_SERVICE_NAME "bluetooth-mesh.service"
+
/* Event handlers */
static void __bt_mesh_handle_pending_request_info(int result,
int service_function, void *param,
int _bt_mesh_init(void)
{
+ int ret = UNIT_CONTROL_OK;
oal_status_t status = OAL_STATUS_SUCCESS;
+ /* Launch bluetooth-meshd */
+ ret = actd_start_unit(UNIT_CONTROL_BUS_TYPE_SYSTEM,
+ MESH_SYSTEMD_SERVICE_NAME, 5000);
+
+ if (ret != UNIT_CONTROL_OK) {
+ BT_ERR("Failed to call systemact service: %d", ret);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
status = mesh_enable();
if (OAL_STATUS_SUCCESS != status) {
BT_ERR("Mesh: Failed to initialize Mesh profile, status: %d",
int _bt_mesh_deinit(void)
{
oal_status_t status = OAL_STATUS_SUCCESS;
+ int ret = UNIT_CONTROL_OK;
+
+ /* Terminate bluetooth-meshd */
+ ret = actd_stop_unit(UNIT_CONTROL_BUS_TYPE_SYSTEM,
+ MESH_SYSTEMD_SERVICE_NAME, 5000);
+
+ if (ret != UNIT_CONTROL_OK)
+ BT_ERR("Failed to call systemact service: %d", ret);
status = mesh_disable();
if (OAL_STATUS_SUCCESS != status) {