ogabrielinacio / esp_provisioning_ble

A Flutter plugin for provisioning ESP32 modules with Ble
MIT License
10 stars 3 forks source link

is anyone can help me #4

Closed Manaf-A closed 10 months ago

Manaf-A commented 11 months ago

this is not an issue .i want pass another custom data after connected with wifi.i want to pass the custom data to a particular endpoint .is it possible to do with this package .by using sendReceiveCustomData its only accept one argument

Manaf-A commented 11 months ago

when iam sending using send custom data it only shows one parameter .it only accepting one parameter .can anyone helpme or give any idea to do it

ogabrielinacio commented 10 months ago

Hi @adbumanaf ! Yes it is possible, you can create another event to handle this, and just use : var customAnswerBytes = await prov.sendReceiveCustomData( Uint8List.fromList( utf8.encode(event.customSendMessage), ), ); var customAnswer = utf8.decode(customAnswerBytes); log.i("Custom data answer: $customAnswer");

And in response to your question about sending an array of data rather than just a single string, you can transmit a List and then concatenate the elements into a single string using the following code snippet:

list.reduce((value, element) => value + ',' + element) Here, i use a comma (",") to separate the elements, or you can use a semicolon (";") if you prefer, and then handle the data on your ESP32 device.

firstImage SecondImage ThirdImage

While this package can temporarily transmit custom data to an ESP32, it is not intended for this purpose. As far as I recall, the ESP32 terminates the connection after provisioning, limiting data transmission to a brief period. You can use this package as a foundation for developing your own custom data transmission solution via BLE, but you will also need to modify the ESP32 provisioning code