mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Add support for parsing the short local name in the tracker (#3854)
This commit is contained in:
parent
8095db6715
commit
106de3530d
@ -637,11 +637,17 @@ void ESPBTDevice::parse_adv_(const esp_ble_gap_cb_param_t::ble_scan_result_evt_p
|
|||||||
// (called CSS here)
|
// (called CSS here)
|
||||||
|
|
||||||
switch (record_type) {
|
switch (record_type) {
|
||||||
|
case ESP_BLE_AD_TYPE_NAME_SHORT:
|
||||||
case ESP_BLE_AD_TYPE_NAME_CMPL: {
|
case ESP_BLE_AD_TYPE_NAME_CMPL: {
|
||||||
// CSS 1.2 LOCAL NAME
|
// CSS 1.2 LOCAL NAME
|
||||||
// "The Local Name data type shall be the same as, or a shortened version of, the local name assigned to the
|
// "The Local Name data type shall be the same as, or a shortened version of, the local name assigned to the
|
||||||
// device." CSS 1: Optional in this context; shall not appear more than once in a block.
|
// device." CSS 1: Optional in this context; shall not appear more than once in a block.
|
||||||
this->name_ = std::string(reinterpret_cast<const char *>(record), record_length);
|
// SHORTENED LOCAL NAME
|
||||||
|
// "The Shortened Local Name data type defines a shortened version of the Local Name data type. The Shortened
|
||||||
|
// Local Name data type shall not be used to advertise a name that is longer than the Local Name data type."
|
||||||
|
if (record_length > this->name_.length()) {
|
||||||
|
this->name_ = std::string(reinterpret_cast<const char *>(record), record_length);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESP_BLE_AD_TYPE_TX_PWR: {
|
case ESP_BLE_AD_TYPE_TX_PWR: {
|
||||||
|
Loading…
Reference in New Issue
Block a user