mesh: Add support for meshd to use RAW channel
[platform/upstream/bluez.git] / mesh / mesh-mgmt.c
index 2cf2eba..d0fabd8 100644 (file)
@@ -52,6 +52,47 @@ static void process_read_info_req(void *data, void *user_data)
        reg->cb(index, reg->user_data);
 }
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static void set_powered_complete(uint8_t status, uint16_t length,
+                                        const void *param, void *user_data)
+{
+       int index = L_PTR_TO_UINT(user_data);
+       uint32_t settings;
+
+       if (status != MGMT_STATUS_SUCCESS) {
+               l_error("Failed to set powered: %s (0x%02x)",
+                                               mgmt_errstr(status), status);
+               return;
+       }
+
+       settings = l_get_le32(param);
+
+       if (!(settings & MGMT_SETTING_POWERED)) {
+               l_error("Controller is not powered");
+                return;
+        }
+
+       l_debug("set powered success on index %d", index);
+       /** <TO-DO> update current settings of adapter */
+}
+
+bool set_powered(uint16_t mode, int index)
+{
+       struct mgmt_mode cp;
+
+       memset(&cp, 0, sizeof(cp));
+       cp.val = mode;
+
+       /** <TO-DO> check current settings of adapter */
+       if (mgmt_send(mgmt_mesh, MGMT_OP_SET_POWERED, index, sizeof(cp), &cp,
+                               set_powered_complete, L_UINT_TO_PTR(index), NULL) > 0)
+
+               return true;
+
+       return false;
+}
+#endif
+
 static void read_info_cb(uint8_t status, uint16_t length,
                                        const void *param, void *user_data)
 {
@@ -80,7 +121,9 @@ static void read_info_cb(uint8_t status, uint16_t length,
 
        if (current_settings & MGMT_SETTING_POWERED) {
                l_info("Controller hci %u is in use", index);
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
                return;
+#endif
        }
 
        if (!(supported_settings & MGMT_SETTING_LE)) {