diff --git a/cores/nRF5/common_func.h b/cores/nRF5/common_func.h index 058bfa28..258759f6 100644 --- a/cores/nRF5/common_func.h +++ b/cores/nRF5/common_func.h @@ -142,10 +142,10 @@ const char* dbg_err_str(uint32_t err_id); // TODO move to other place #if CFG_DEBUG #define PRINT_LOCATION() cprintf("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__) -#define PRINT_MESS(x) cprintf("%s: %d: %s \n" , __PRETTY_FUNCTION__, __LINE__, (char*)(x)) -#define PRTNT_HEAP() if (CFG_DEBUG == 3) cprintf("\n%s: %d: Heap free: %d\n", __PRETTY_FUNCTION__, __LINE__, util_heap_get_free_size()) -#define PRINT_STR(x) cprintf("%s: %d: " #x " = %s\n" , __PRETTY_FUNCTION__, __LINE__, (char*)(x) ) -#define PRINT_INT(x) cprintf("%s: %d: " #x " = %ld\n" , __PRETTY_FUNCTION__, __LINE__, (uint32_t) (x) ) +#define PRINT_MESS(x) cprintf("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x)) +#define PRTNT_HEAP() if (CFG_DEBUG == 3) cprintf("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size()) +#define PRINT_STR(x) cprintf("%s: %d: " #x " = %s\n" , __FUNCTION__, __LINE__, (char*)(x) ) +#define PRINT_INT(x) cprintf("%s: %d: " #x " = %ld\n" , __FUNCTION__, __LINE__, (uint32_t) (x) ) #define PRINT_HEX(x) \ do {\ diff --git a/libraries/BLEHomekit/src/BLEHomekit.cpp b/libraries/BLEHomekit/src/BLEHomekit.cpp index 04b55d34..3ac5e36a 100644 --- a/libraries/BLEHomekit/src/BLEHomekit.cpp +++ b/libraries/BLEHomekit/src/BLEHomekit.cpp @@ -37,8 +37,6 @@ #include #include "BLEHomekit.h" -#define HOMEKIT_PROTOCOL_VERION 2 - uint16_t BLEHomekit::_gInstanceID = 1; BLEHomekit::BLEHomekit() @@ -106,7 +104,7 @@ bool BLEHomekit::setAdv(BLEAdvertisingData& adv_ref) .category = HAP_CAT_LIGHTBULB, .gsn = 1, .config_num = 1, - .compatible_verion = HOMEKIT_PROTOCOL_VERION + .compatible_verion = 2 // protocol version }; Bluefruit.Gap.getAddr(data.dev_id); @@ -114,6 +112,14 @@ bool BLEHomekit::setAdv(BLEAdvertisingData& adv_ref) VERIFY_STATIC( sizeof(data) == 17); adv.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE); - return adv.addManufacturerData(&data, sizeof(data)); + adv.addManufacturerData(&data, sizeof(data)); + + // Full name is not added, added full name to scan response + if ( !adv.addName() ) + { + Bluefruit.ScanResponse.addName(); + } + + return true; } diff --git a/libraries/Bluefruit52Lib/src/BLEAdvertising.cpp b/libraries/Bluefruit52Lib/src/BLEAdvertising.cpp index ce73db9c..0297b7ba 100644 --- a/libraries/Bluefruit52Lib/src/BLEAdvertising.cpp +++ b/libraries/Bluefruit52Lib/src/BLEAdvertising.cpp @@ -173,7 +173,7 @@ bool BLEAdvertisingData::addService(BLEClientService& service) /** * Add Name to Adv packet, use setName() to set - * @return true if success + * @return true if full name is added, false if shorten name or not enough data to add name */ bool BLEAdvertisingData::addName(void) { @@ -189,7 +189,9 @@ bool BLEAdvertisingData::addName(void) len = BLE_GAP_ADV_MAX_SIZE - (_count+2); } - return addData(type, name, len); + VERIFY( addData(type, name, len) ); + + return type == BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME; } // tx power is set by setTxPower