kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/ble_mesh_device_with_wrong_name_on_ios' into 'master'
ble_mesh: fix ble mesh device with wrong name on iOS Closes BLEMESH-54 See merge request espressif/esp-idf!6516pull/4494/head
commit
e349f86d18
|
@ -1011,6 +1011,14 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bt_mesh_gatts_set_local_device_name(const char *name)
|
||||||
|
{
|
||||||
|
BLE_MESH_BTM_CHECK_STATUS(BTM_SetLocalDeviceName((char *)name));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
||||||
|
|
||||||
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
||||||
|
|
|
@ -34,6 +34,10 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BLE_MESH_GAP_ADV_MAX_LEN 31
|
||||||
|
|
||||||
|
#define BLE_MESH_GATT_DEF_MTU_SIZE 23
|
||||||
|
|
||||||
/* BD ADDR types */
|
/* BD ADDR types */
|
||||||
#define BLE_MESH_ADDR_PUBLIC 0x00
|
#define BLE_MESH_ADDR_PUBLIC 0x00
|
||||||
#define BLE_MESH_ADDR_RANDOM 0x01
|
#define BLE_MESH_ADDR_RANDOM 0x01
|
||||||
|
@ -681,6 +685,8 @@ u16_t bt_mesh_gatt_get_mtu(struct bt_mesh_conn *conn);
|
||||||
int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc);
|
int bt_mesh_gatts_service_stop(struct bt_mesh_gatt_service *svc);
|
||||||
int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc);
|
int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc);
|
||||||
|
|
||||||
|
int bt_mesh_gatts_set_local_device_name(const char *name);
|
||||||
|
|
||||||
void bt_mesh_gattc_conn_cb_register(struct bt_mesh_prov_conn_cb *cb);
|
void bt_mesh_gattc_conn_cb_register(struct bt_mesh_prov_conn_cb *cb);
|
||||||
|
|
||||||
u8_t bt_mesh_gattc_get_free_conn_count(void);
|
u8_t bt_mesh_gattc_get_free_conn_count(void);
|
||||||
|
|
|
@ -1199,6 +1199,11 @@ int bt_mesh_gatts_service_start(struct bt_mesh_gatt_service *svc)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bt_mesh_gatts_set_local_device_name(const char *name)
|
||||||
|
{
|
||||||
|
return ble_svc_gap_device_name_set(name);
|
||||||
|
}
|
||||||
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
#endif /* defined(CONFIG_BLE_MESH_NODE) && CONFIG_BLE_MESH_NODE */
|
||||||
|
|
||||||
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
||||||
|
|
|
@ -130,7 +130,7 @@ int bt_mesh_set_device_name(const char *name)
|
||||||
memset(device_name, 0x0, sizeof(device_name));
|
memset(device_name, 0x0, sizeof(device_name));
|
||||||
memcpy(device_name, name, strlen(name));
|
memcpy(device_name, name, strlen(name));
|
||||||
|
|
||||||
return 0;
|
return bt_mesh_gatts_set_local_device_name(device_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct bt_mesh_proxy_client *find_client(struct bt_mesh_conn *conn)
|
static struct bt_mesh_proxy_client *find_client(struct bt_mesh_conn *conn)
|
||||||
|
@ -1417,7 +1417,7 @@ int bt_mesh_proxy_init(void)
|
||||||
__ASSERT(prov && prov->uuid, "%s, Device UUID is not initialized", __func__);
|
__ASSERT(prov && prov->uuid, "%s, Device UUID is not initialized", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return bt_mesh_gatts_set_local_device_name(device_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_BLE_MESH_NODE */
|
#endif /* CONFIG_BLE_MESH_NODE */
|
||||||
|
|
|
@ -19,7 +19,21 @@
|
||||||
#define BLE_MESH_PROXY_CONFIG 0x02
|
#define BLE_MESH_PROXY_CONFIG 0x02
|
||||||
#define BLE_MESH_PROXY_PROV 0x03
|
#define BLE_MESH_PROXY_PROV 0x03
|
||||||
|
|
||||||
#define DEVICE_NAME_SIZE 29
|
#if CONFIG_BLE_MESH_PROXY
|
||||||
|
/**
|
||||||
|
* Device Name Characteristic:
|
||||||
|
* 1. For iOS, when it tries to get the value of Device Name Characteristic, the PDU
|
||||||
|
* "Read By Type Request" will be used, and the valid length of corresponding
|
||||||
|
* response is 19 (23 - 1 - 1 - 2).
|
||||||
|
* 2. For Android, when it tries to get the value of Device Name Characteristic, the
|
||||||
|
* PDU "Read Request" will be used, and the valid length of corresponding response
|
||||||
|
* is 22 (23 - 1).
|
||||||
|
*/
|
||||||
|
#define DEVICE_NAME_SIZE MIN((BLE_MESH_GATT_DEF_MTU_SIZE - 4), (BLE_MESH_GAP_ADV_MAX_LEN - 2))
|
||||||
|
#else
|
||||||
|
/* For Scan Response Data, the maximum length is 29 (31 - 1 - 1) currently. */
|
||||||
|
#define DEVICE_NAME_SIZE (BLE_MESH_GAP_ADV_MAX_LEN - 2)
|
||||||
|
#endif
|
||||||
|
|
||||||
int bt_mesh_set_device_name(const char *name);
|
int bt_mesh_set_device_name(const char *name);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue