Tool/software:
Hello my friends,
I am trying to update the advertisement data in the run time.
I am using the simple peripheral example, and my sdk version is 8.30.01.01
I have made the following function based on what I have found on the online resources like there.
int peripheral_update_adv_data(void) { int ret = GapAdv_disable(advHandleLegacy); if (ret != 0) { return -10; } uint8_t new_advData[] = { // Flags: General Discoverable, BR/EDR not supported 0x02, GAP_ADTYPE_FLAGS, GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED | GAP_ADTYPE_FLAGS_GENERAL, // Custom 128-bit UUID (0x07) 0x11, GAP_ADTYPE_128BIT_COMPLETE, 0xF0, 0xDE, 0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12, // Appearance (0x19) 0x03, GAP_ADTYPE_APPEARANCE, 0x52, 0x05, // TX Power Level (0x0A) 0x02, GAP_ADTYPE_POWER_LEVEL, 0, // Manufacturer-specific data (0xFF) 0x02, GAP_ADTYPE_MANUFACTURER_SPECIFIC, 0x42}; // Load advertising data for set #1 that is statically allocated ret = GapAdv_prepareLoadByHandle(advHandleLegacy, GAP_ADV_FREE_OPTION_DONT_FREE); if (ret != 0) { return -9; } ret = GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV, sizeof(new_advData), new_advData); if (ret != 0) { return -11; } ret = GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX, 0); if (ret != 0) { return -12; } return 0; }
for some reason, if I call this function (I am doing it with a button press), I'll no longer see the advertisement on my phone (nrf connect app)
Can you please help me fix this issue.
Also, I am using DMM as well.