Hi, My Lord. When I run the example, I use short-name(BLE_ADVDATA_SHORT_NAME) advertising always "Fatal error",It's no use reducing payload.
On the other hand, how to add custom private AD type data like this ???

Hi, My Lord. When I run the example, I use short-name(BLE_ADVDATA_SHORT_NAME) advertising always "Fatal error",It's no use reducing payload.
On the other hand, how to add custom private AD type data like this ???

Hi,
When I run the example, I use short-name(BLE_ADVDATA_SHORT_NAME) advertising always "Fatal error",It's no use reducing payload.
Have you tried to build with "DEBUG" defined? With the debug build you will see the file name, line number and error code printed in the log, and this will usually give a good indication about the problem.
On the other hand, how to add custom private AD type data like this ???
I don't know how you build the advertising packet, but typically it is built by populating a ble_advdata_t instance that is provided to ble_advdata_encode(). Type 0x88 and 0x89 are non standard, so I assume those are what you refer to? If so and you use adv_data_encode, then it probably makes most sense to adapt adv_data_encode to add support for these private types.
How to add support inadv_data_encode?
You can for instance do it as shown in this diff:
diff --git a/components/ble/common/ble_advdata.c b/components/ble/common/ble_advdata.c
index 86236e0..56200b3 100644
--- a/components/ble/common/ble_advdata.c
+++ b/components/ble/common/ble_advdata.c
@@ -605,6 +605,18 @@ ret_code_t ble_advdata_encode(ble_advdata_t const * const p_advdata,
VERIFY_SUCCESS(err_code);
}
+ if (p_advdata->p_custom_data_88 != NULL)
+ {
+ memcpy(&p_encoded_data[*p_len], p_advdata->p_custom_data_88->p_data, p_advdata->p_custom_data_88->size);
+ *p_len += p_advdata->p_custom_data_88->size;
+ }
+
+ if (p_advdata->p_custom_data_89 != NULL)
+ {
+ memcpy(&p_encoded_data[*p_len], p_advdata->p_custom_data_89->p_data, p_advdata->p_custom_data_89->size);
+ *p_len += p_advdata->p_custom_data_89->size;
+ }
+
// Encode name. WARNING: it is encoded last on purpose since too long device name is truncated.
if (p_advdata->name_type != BLE_ADVDATA_NO_NAME)
{
diff --git a/components/ble/common/ble_advdata.h b/components/ble/common/ble_advdata.h
index 88b645c..50a48cc 100644
--- a/components/ble/common/ble_advdata.h
+++ b/components/ble/common/ble_advdata.h
@@ -162,6 +162,8 @@ typedef struct
ble_advdata_tk_value_t * p_tk_value; /**< Security Manager TK value field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/
uint8_t * p_sec_mgr_oob_flags; /**< Security Manager Out Of Band Flags field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/
ble_gap_lesc_oob_data_t * p_lesc_data; /**< LE Secure Connections OOB data. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/
+ uint8_array_t * p_custom_data_88; /**< Raw data for custom type 0x88 */
+ uint8_array_t * p_custom_data_89; /**< Raw data for custom type 0x89 */
} ble_advdata_t;
/**@brief Function for encoding data in the Advertising and Scan Response data format (AD structures).
This demonstrates how it can be done, and I expect it will work, but I have not tested it.