Dynamic assignment of BLE Advertising Data MKW39A512xxx4

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Dynamic assignment of BLE Advertising Data MKW39A512xxx4

ソリューションへジャンプ
1,608件の閲覧回数
jacklooks4answers
Contributor II

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.
0 件の賞賛
返信
1 解決策
1,562件の閲覧回数
jacklooks4answers
Contributor II

I apologise for my mistake, the library is working just as it should. My aData variable was being overwritten elsewhere... I hope you have a nice day and I thank you for your time.

Best,

Jack

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,563件の閲覧回数
jacklooks4answers
Contributor II

I apologise for my mistake, the library is working just as it should. My aData variable was being overwritten elsewhere... I hope you have a nice day and I thank you for your time.

Best,

Jack

0 件の賞賛
返信
1,587件の閲覧回数
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Hope you are doing well. First of all, could you please clarify what MCU are you using? What SDK version are you using?

We always encourage to use the latest SDK for the specific MCU.

 

Regards,

Ricardo

0 件の賞賛
返信
1,581件の閲覧回数
jacklooks4answers
Contributor II
Hello Ricardo and thanks,

I am using the MKW38A512VFT4 and the SDK version is 2.6.11.

Best,
Jack
0 件の賞賛
返信