Why Can't update broadcast data ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi Sir

I add code to puart_control.c, As follows :

aaaaa.jpg

I use sinffer check the package content ,

It has not been modified.

Can tell me why ?

0 Likes
1 Solution
Anonymous
Not applicable

Hi again.

Were you able to change the advertisement packets?

I was able to change the advertisement with your code.

I added your code to the original puart_control app:

/*

* handle advertise command from UART

*/

void puart_control_handle_advertise_cmd(BOOL enable)

{

    if (enable)

    {

        BLE_ADV_FIELD adv[2];

        adv[0].len = 2;

        adv[0].val = ADV_FLAGS;

        adv[0].data[0] = LE_GENERAL_DISCOVERABLE | BR_EDR_NOT_SUPPORTED;

        adv[1].len = 2;

        adv[1].val = 1;

        adv[1].data[0] = 1;

        bleprofile_GenerateADVData(adv,2);

        bleprofile_Discoverable(HIGH_UNDIRECTED_DISCOVERABLE, NULL);

        puart_control_send_advertisement_state_event(HIGH_UNDIRECTED_DISCOVERABLE);

    }

    else

    {

        bleprofile_Discoverable(NO_DISCOVERABLE, NULL);

        puart_control_send_advertisement_state_event(NO_DISCOVERABLE);

    }

}

This is the ADDRESS that I used.

pastedImage_0.png

Then I used ClientControl app (located in puart_control) to interact with puart_control.

pastedImage_1.png

This is the snippet of the advertisement packet. Notice the matching data with the code.

pastedImage_0.png

I don't know why you weren't able to update the broadcast data.

Are there any other changes you made to puart_control?

Are you using some other app than ClientControl(WICED Smart UART Controller) to communicate with the puart_control?

As for the bleprofile_init call, it did not make any difference.

First I tested with the app with both bleprofile_Init and blecen_Create calls in the puart_control_create.

Then I tried with only calling blecen_Create while commenting out the call to bleprofile_Init.

The results were the same, and it did not make any difference.

I just told you what I did, since I could not duplicate your problem.

If you still have this problem, please let me know the steps you are taking to get the problem.

Thank you.

James

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

Hello.

Can you confirm your function is being called and has the right conditions for the if statement?

You can try putting some debug traces in the function and see if it actually gets called, because I don't see any reason why it will not change the advertisement if it is properly being called.

Thank you.

James

0 Likes
Anonymous
Not applicable

Hi James ,


I sure it can run to if(enable){ ....}

and I find a problem in puart_control project

This "bleprofile_Init(bleprofile_p_cfg)" function can't called two times.

Otherwise can't update broadcast data.

first in puart_control_create()

{

     ...

     bleprofile_Init(bleprofile_p_cfg);

}

second in blecen_Create()

{

     ...

     bleprofile_Init(bleprofile_p_cfg);

}

Maybe you can try my test ....

Thanks you.

0 Likes
Anonymous
Not applicable

Hi again.

Were you able to change the advertisement packets?

I was able to change the advertisement with your code.

I added your code to the original puart_control app:

/*

* handle advertise command from UART

*/

void puart_control_handle_advertise_cmd(BOOL enable)

{

    if (enable)

    {

        BLE_ADV_FIELD adv[2];

        adv[0].len = 2;

        adv[0].val = ADV_FLAGS;

        adv[0].data[0] = LE_GENERAL_DISCOVERABLE | BR_EDR_NOT_SUPPORTED;

        adv[1].len = 2;

        adv[1].val = 1;

        adv[1].data[0] = 1;

        bleprofile_GenerateADVData(adv,2);

        bleprofile_Discoverable(HIGH_UNDIRECTED_DISCOVERABLE, NULL);

        puart_control_send_advertisement_state_event(HIGH_UNDIRECTED_DISCOVERABLE);

    }

    else

    {

        bleprofile_Discoverable(NO_DISCOVERABLE, NULL);

        puart_control_send_advertisement_state_event(NO_DISCOVERABLE);

    }

}

This is the ADDRESS that I used.

pastedImage_0.png

Then I used ClientControl app (located in puart_control) to interact with puart_control.

pastedImage_1.png

This is the snippet of the advertisement packet. Notice the matching data with the code.

pastedImage_0.png

I don't know why you weren't able to update the broadcast data.

Are there any other changes you made to puart_control?

Are you using some other app than ClientControl(WICED Smart UART Controller) to communicate with the puart_control?

As for the bleprofile_init call, it did not make any difference.

First I tested with the app with both bleprofile_Init and blecen_Create calls in the puart_control_create.

Then I tried with only calling blecen_Create while commenting out the call to bleprofile_Init.

The results were the same, and it did not make any difference.

I just told you what I did, since I could not duplicate your problem.

If you still have this problem, please let me know the steps you are taking to get the problem.

Thank you.

James

0 Likes