- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start out with the hello_sensor.c code instead of smart designer and apply modifications as appropriate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Start out with the hello_sensor.c code instead of smart designer and apply modifications as appropriate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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