Hi,
I am using custom hardware with MCUXpresso SDK 2.x for MKW41Z512xxx4. My board is the MKW38A512VFT4.
I would like to set the BLE advertising name to the device model that it receives externally during runtime. Unfortunately, the gap_interface.h function to set the data takes in constants that cannot be changed during run time:
bleResult_t Gap_SetAdvertisingData
(
const gapAdvertisingData_t* pAdvertisingData,
const gapScanResponseData_t* pScanResponseData
);
Would there be another work around to declare advertising data dynamically in this SDK?
Many thanks,
Jack
EDIT to complete:
I was particularly interested in this topic
However did not get a satisfactory result. It looks to me like undefined behaviour...
In runtime, after I've received "app_data" I define advScanRsp:
uint8_t adData3[25] = {0};
FLib_MemCpy(adData3,model_names[app_data.proxy_system_config[1]],
strlen(model_names[_app_data.proxy_system_config[1]]+1));
gapAdStructure_t advScanRsp = {
.adType = gAdCompleteLocalName_c,
.length = strlen(model_names[app_data.proxy_system_config[1]]+1),
.aData = (uint8_t*)adData3
};
gapScanResponseData_t gAppScanRspData =
{
1,
(void *)&advScanRsp
};
(void)Gap_SetAdvertisingData(&gAppAdvertisingData, &gAppScanRspData);
The code compiles and often the first go I might get the correct name up to the first 18 characters however if I change the model, the name would flash correct and then be overwritten with the previously compiled model name, hence my assumption that I have caused undefined behaviour.