Problem with HIGH_UNDIRECTED_DISCOVERABLE

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I am trying to add custom advertisement data in hello_client.

This is the code I am adding in void hello_client_create(void) function (copied from hello_sensor):

    // Read value of the service from GATT DB.

    bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_SERVICE_UUID, &db_pdu);

    ble_tracen((char *)db_pdu.pdu, db_pdu.len);

    if (db_pdu.len != 16)

    {

        ble_trace1("bad service UUID len: %d\n", db_pdu.len);

    }

    else

    {

    // total length should be less than 31 bytes

    BLE_ADV_FIELD adv[3];

        // flags

        adv[0].len     = 1 + 1;

        adv[0].val     = ADV_FLAGS;

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

        adv[1].len     = 16 + 1;

        adv[1].val     = ADV_SERVICE_UUID128_COMP;

        memcpy(adv[1].data, db_pdu.pdu, 16);

        // name

        adv[2].len      = strlen(bleprofile_p_cfg->local_name) + 1;

        adv[2].val      = ADV_LOCAL_NAME_COMP;

        memcpy(adv[2].data, bleprofile_p_cfg->local_name, adv[2].len - 1);

        bleprofile_GenerateADVData(adv, 3);

    }

At this point discoverable is turned on with:

    // need to do adverts to enable slave connections

    bleprofile_Discoverable(HIGH_UNDIRECTED_DISCOVERABLE, NULL);

What I noticed is that device is not discoverable for the first 30 seconds (high_undirect_adv_duration) until bleprofile_GetDiscoverable() reports:

LOW_UNDIRECTED_DISCOVERABLE

Can you tell me why it cannot start from HIGH_UNDIRECTED_DISCOVERABLE ?

I am attaching modified hello_client.

0 Likes
1 Solution

Are you invoking both bleprofile_Init() and blecen_Create()? If you are, then remove the call to bleprofile_Init().

View solution in original post

8 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

I took a quick glance of the above. I thought you missed a line:


blecm_setTxPowerInADV(0);

bleprofile_Discoverable(HIGH_UNDIRECTED_DISCOVERABLE, NULL);

Try it out...



0 Likes
Anonymous
Not applicable

I added:


blecm_setTxPowerInADV(0);


but that did not change anything

0 Likes

I think you missed the line

// total length should be less than 31 bytes

Please try hell instead of hello client.

0 Likes
Anonymous
Not applicable

I copied this section as is from hello_sensor.

It works in hello_sensor.

Why doesn't it work in hello_client ?

0 Likes

Are you invoking both bleprofile_Init() and blecen_Create()? If you are, then remove the call to bleprofile_Init().

Anonymous
Not applicable

That was it.

Thank you

0 Likes

I believe that calling both function 'bleprofile_Init' and 'blecen_Create' is originated in the sample hello_client.c from WICED Smart SDK.

Would you comment that which one is supposed to be removed? 'bleprofile_Init' or 'blecen_Create'?

0 Likes

In 2.2 version of the hello_client ble profile calls are commented out

// this is done by blecen

// bleprofile_Init(bleprofile_p_cfg);

// bleprofile_GPIOInit(bleprofile_gpio_p_cfg);

0 Likes