#include <hardware/bt_mesh.h>
+#define BT_HAL_MESH_DBUS_NAME "org.projectx.bt.mesh"
+
#define BT_HAL_UUID_LEN 16
#define BT_HAL_BLUEZ_MESH_NAME "org.bluez.mesh"
client = client_obj;
}
+static void __mesh_acquire_name_callback(struct l_dbus *dbus_obj, bool success,
+ bool queued, void *user_data)
+{
+ if (success == false)
+ ERR("Mesh: Fail to acquire dbus name\n");
+
+ if (!l_dbus_object_manager_enable(dbus_obj, "/"))
+ ERR("Mesh: Failed to register the ObjectManager\n");
+}
+
static void __mesh_ready_callback(void *user_data)
{
INFO("Mesh: Connected to D-Bus\n");
- if (!l_dbus_object_manager_enable(dbus, "/"))
- ERR("Mesh: Failed to register the ObjectManager\n");
+
+ if (!l_dbus_name_acquire(dbus, BT_HAL_MESH_DBUS_NAME, false, false, false,
+ __mesh_acquire_name_callback, NULL))
+ ERR("Mesh: Failed to own well-known name\n");
}
bool _bt_hal_mesh_stack_init(void)
<busconfig>
<policy user="root">
<allow own="org.projectx.bt"/>
+ <allow own="org.projectx.bt.mesh"/>
<allow send_destination="org.projectx.bt"/>
+ <allow send_destination="org.projectx.bt.mesh"/>
<allow own="org.bluez.obex"/>
<allow send_destination="org.bluez.obex"/>
</policy>
<policy group="network_fw">
<allow own="org.projectx.bt"/>
+ <allow own="org.projectx.bt.mesh"/>
<allow send_destination="org.projectx.bt"/>
+ <allow send_destination="org.projectx.bt.mesh"/>
<allow own="org.bluez.obex"/>
<allow send_destination="org.bluez.obex"/>
<allow own="org.projectx.bluetooth.share"/>