send notify in response to digital input

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

Hello I try to send notify in response to digital input using BCM20737S and I debug with Light Blue.

I made a new project with WICED Smart Desiner. I attached the files.

I can send notify depend on digital input when I write a code based on hello_sensor.

I add some statement in hello_sensor_send_message function as follows.

---------------------------------------------------------------------------------------------------------------------<<<<form here

void hello_sensor_send_message(void)

{

    BLEPROFILE_DB_PDU db_pdu;

    int res = gpio_getPinInput(0,4);

    ble_trace1("res = %d\n",res);

    // If client has not registered for indication or notification, do not need to do anything

    if (hello_sensor_hostinfo.characteristic_client_configuration == 0)

        return;

    // Read value of the characteristic to send from the GATT DB.

    bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);

    db_pdu.pdu[0x00] = (UINT8)res;

    bleprofile_WriteHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);

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

    if (hello_sensor_hostinfo.characteristic_client_configuration & CCC_NOTIFICATION)

    {

        bleprofile_sendNotification(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, (UINT8 *)db_pdu.pdu, db_pdu.len);

    }

    else

    {

        if (!hello_sensor_indication_sent)

        {

            hello_sensor_indication_sent = TRUE;

            bleprofile_sendIndication(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, (UINT8 *)db_pdu.pdu, db_pdu.len, hello_sensor_indication_cfm);

        }

    }

}

-----------------------------------------------------------------------------------------------------------------------<<<<to here

However there is not send_message function in the file of my new project, so I wrote same processes which can realize to send notification at hello_sensor

---------------------------------------------------------------------------------------------------------------------<<<<form here

int res = gpio_getPinInput(0,4);

bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);

db_pdu.pdu[0x00] = (UINT8)res;

bleprofile_WriteHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);

---------------------------------------------------------------------------------------------------------------------<<<<to here

in  BOOL store_in_db_send_notify_test2 function in my file which is look like sending notify.

However any notification didn't send.

And I also made a send_message function in my test2 project but any signal didn't send.

-----------------------------------------------------------------------------------------------------------------------<<<<form here

void test2_send_message(void)

{

    BLEPROFILE_DB_PDU db_pdu;

    int res = gpio_getPinInput(0,4);

    ble_trace1("res = %d\n",res);

    ble_trace0("Hello\n");

    // If client has not registered for indication or notification, do not need to do anything

    if (test2_hostinfo.characteristic_client_configuration == 0)

        return;

    // Read value of the characteristic to send from the GATT DB.

    bleprofile_ReadHandle(HDLC_SEND_NOTIFY_TEST2_VALUE, &db_pdu);

    db_pdu.pdu[0x00] = (UINT8)res; // Added

    bleprofile_WriteHandle(HDLC_SEND_NOTIFY_TEST2_VALUE, &db_pdu); // Added

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

    if (test2_hostinfo.characteristic_client_configuration & CCC_NOTIFICATION)

    {

        bleprofile_sendNotification(HDLC_SEND_NOTIFY_TEST2_VALUE, (UINT8 *)db_pdu.pdu, db_pdu.len);

    }

    else

    {

        if (!test2_indication_sent)

        {

            test2_indication_sent = TRUE;

            bleprofile_sendIndication(HDLC_SEND_NOTIFY_TEST2_VALUE, (UINT8 *)db_pdu.pdu, db_pdu.len, test2_indication_cfm);

        }

    }

}

-----------------------------------------------------------------------------------------------------------------------<<<<to here

Could you help me to solve this problem. I will appreciate your suggestion of how to write a process.

Thank you

0 Likes
1 Solution
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Start out with the hello_sensor.c code instead of smart designer and apply modifications as appropriate.

notification sanity check &amp; smart designer

View solution in original post

0 Likes
3 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Start out with the hello_sensor.c code instead of smart designer and apply modifications as appropriate.

notification sanity check &amp; smart designer

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Any luck?

上平倫太郎

0 Likes
Anonymous
Not applicable

thank you boont.


This is what I want to know!

This is helpful information. I will modify my code referring this.

Thank you

Ka mi

0 Likes