- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Community
I try to read switching digital value and show it on a iphone display.
I have done that setting BCM207373's pin0 to Input, and I can see a message on a teraterm when I turn on or off a switch.
Here is part of code I add some line to hello sensor.c
----------
void hello_sensor_send_message(void)
{
BLEPROFILE_DB_PDU db_pdu;
int res = gpio_getPinInput(0,0); <-here
ble_trace1("res = %d\n",res); <-here
// 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);
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);
}
}
}
------
I am a new so please let me know some information or knowledge I need to refer to.
I will really appreciate your contribution
Thank you.
Solved! Go to Solution.
- Labels:
-
GPIO
-
ReadWrite Characteristics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What you want to do is sending P0 value through UUID_HELLO_CHARACTERISTIC_NOTIFY?
If yes, please modify your code as below.
-----
bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);
db_pdu.pdu[0x00] = (UINT8)res; // Added
bleprofile_WriteHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu); // Added
ble_tracen((char *)db_pdu.pdu, db_pdu.len);
-----
Then the first byte of "Hello" will be changed to 0 or 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What you want to do is sending P0 value through UUID_HELLO_CHARACTERISTIC_NOTIFY?
If yes, please modify your code as below.
-----
bleprofile_ReadHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu);
db_pdu.pdu[0x00] = (UINT8)res; // Added
bleprofile_WriteHandle(HANDLE_HELLO_SENSOR_VALUE_NOTIFY, &db_pdu); // Added
ble_tracen((char *)db_pdu.pdu, db_pdu.len);
-----
Then the first byte of "Hello" will be changed to 0 or 1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you for replying!
It was able to work as what I was aiming.
I really appreciate your support.
Thank you so much.