OS- Windows (Developemnt in msys32)
IDF- v3.3-beta1-136-g97eecfa1b
I am working on BLE to send and recieve data. I used "BLE_SPP_CLIENT" example for this. I connected this to a BLE 5.0 device which is HC-42 and also edited the "ESP_GATT_SPP_SERVICE_UUID" with its service UUID. I have written a program in HC-42 based system in which it can receive any input through BLE (of ESP32) and then transmit data accordingly to ESP32 via BLE.
Now I am able to connect with BLE (HC-42) by edited "static const char device_name[] = "HC-42";" this and then also able to write character to HC-42 from ESP32. But I am unable to recieve any data from HC-42 system to ESP32. For confirmation I used android BLE scanner app to send and get data from HC-42 system which is working fine.
Do I need to add NOTIFY_CHAR UUID of HC-42 for incoming data. As I sew and tried the code of "gattc_demo.c" of "gatt_client" example. In this I am able to recieve the data but not able to write it, just vice versa of previous. Please let me know how can I read or recive data in BLE_SPP_CLIENT or write data in gattc_demo.c example. Both the example with little changes are attached below.
How to call ESP_GATTC_NOTIFY_EVT in "spp_client_demo" example
-
- Posts: 2
- Joined: Tue Nov 26, 2019 10:17 am
How to call ESP_GATTC_NOTIFY_EVT in "spp_client_demo" example
- Attachments
-
- spp_client_demo.c
- (25.46 KiB) Downloaded 300 times
-
- gattc_demo.c
- (21.14 KiB) Downloaded 294 times
-
- Posts: 2
- Joined: Tue Nov 26, 2019 10:17 am
Re: How to call ESP_GATTC_NOTIFY_EVT in "spp_client_demo" example
I am using HC-42 module as a server with a MCU to recieve and transmit data. If HC-42 will recieve "S" then it should start transmitting sensor data to client. Now for client I am using ESP32 to write "S" to HM-42 and then receive data accordingly. To check my server part I used a android BLE scanner app to send the "S" and then recieve data accodingly.
Now, To implement it with ESP32 (as a client). I used "BLE_SPP_CLIENT" example and edited the "ESP_GATT_SPP_SERVICE_UUID" with HC-42 (server BLE) service UUID.
I am able to connect with HC-42 by edited "static const char device_name[] = "HC-42";" and then also able to write character to HC-42 from ESP32. But I am unable to recieve any data from HC-42 to ESP32 as it is transmitting but there is no event to recieve data in ESP-32. Do I need to add NOTIFY_CHAR UUID of HC-42 for incoming data, but this variable is not defined in this example.
As I saw and also tried the code of "gattc_demo.c" of "gatt_client" example. In this I am able to recieve the data but not able to write it, just vice versa of previous. In this NOTIFY_EVT called after connected to HC-42 and resposible for receiving data in ESP-32 from HC-42 module. But in this I am unable to send/write "S" to server (HC-42).
Please let me know if you need anything more in this. Meanwhile I also tried with your patch with example "ble_spp_client" (example attached above in my first reply) but getting same result. After sending character "S" from ESP32 it doesn't recieve any data from server (HC-42). Screenshot is attached below.
Now, To implement it with ESP32 (as a client). I used "BLE_SPP_CLIENT" example and edited the "ESP_GATT_SPP_SERVICE_UUID" with HC-42 (server BLE) service UUID.
I am able to connect with HC-42 by edited "static const char device_name[] = "HC-42";" and then also able to write character to HC-42 from ESP32. But I am unable to recieve any data from HC-42 to ESP32 as it is transmitting but there is no event to recieve data in ESP-32. Do I need to add NOTIFY_CHAR UUID of HC-42 for incoming data, but this variable is not defined in this example.
As I saw and also tried the code of "gattc_demo.c" of "gatt_client" example. In this I am able to recieve the data but not able to write it, just vice versa of previous. In this NOTIFY_EVT called after connected to HC-42 and resposible for receiving data in ESP-32 from HC-42 module. But in this I am unable to send/write "S" to server (HC-42).
Please let me know if you need anything more in this. Meanwhile I also tried with your patch with example "ble_spp_client" (example attached above in my first reply) but getting same result. After sending character "S" from ESP32 it doesn't recieve any data from server (HC-42). Screenshot is attached below.
Who is online
Users browsing this forum: Bing [Bot] and 130 guests