You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal is to discover the IP address and port of the server (the ESP inside a BB) to open a socket with the client (the BB GUI). Here, we discuss several choices of programming framework, then we configure the communication platform, and eventually propose a discovery protocol.
👨🏻💻 Is QT or Csharp the best choice to develop multiplatform applications ? On my point of view C# graphical designer and syntax looks better and is easier to handle. Whether QT designer is not always responsive and it gets sometimes messy between how one has to write code, is it in javascript, qml or C++. Without mentioning signals and slots. But pros for QT are it is written in C++, can handle python. The biggest cons for C# is .NET dependency.
👨🏻💻 Now BB GUI is relying on the appLoader library developed in C++ by F. Lassabe under QT Creator. Therefore, for socket communications between an ESP8266 and the GUI the Winsock library itself will no work, as its connect(host) function will be conflicting with the connect(signal,slot) in QML. So we have to go with QTcpSocket and stay inside QT.
👨🏻💻 Finally we need to find a way to bridge serial data from the GUI towards a Blinky Block over the air. This can be easily done with the help of a ESP8266 or ESP32 configured as an AP. Once connected to the AP on the GUI client side, the former shares its IP@ and port and starts receiving serial packet and forwarding ack packets. ESP8266/32 Rx and Tx are directly connected to the BB's UART.
👨🏻💻 From the GUI I need to know the IP@ of the available ESP before I establish the socket connection. I followed these steps to write a standard SSDP solution:
On your client side create a QTcpSocket and a QUdpSocket and on the server side create a QTcpServer and a QUdpSocket.
On the client, send out a broadcast message saying "who is out there, i am a client"
Once the packet is received on the server, send a direct UDP packet back to the QUdpSocket saying "i am here, pick me this is my tcp ip address and tcp port" (you can get the address and port from the received packet). I usually populate a QListView with the ipaddress and ports so that user can choose who he wants to connect to.
When your ready to connect, just take the tcp address and port sent in the packet and connect the QTcpSocket to the QTcpServer.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The goal is to discover the IP address and port of the server (the ESP inside a BB) to open a socket with the client (the BB GUI). Here, we discuss several choices of programming framework, then we configure the communication platform, and eventually propose a discovery protocol.
👨🏻💻 Is QT or Csharp the best choice to develop multiplatform applications ? On my point of view C# graphical designer and syntax looks better and is easier to handle. Whether QT designer is not always responsive and it gets sometimes messy between how one has to write code, is it in javascript, qml or C++. Without mentioning signals and slots. But pros for QT are it is written in C++, can handle python. The biggest cons for C# is .NET dependency.
Is C# a better choice than QT C++ to develop a Windows UI app?
C++ QT vs C# .NET for Windows Development
👨🏻💻 Now BB GUI is relying on the appLoader library developed in C++ by F. Lassabe under QT Creator. Therefore, for socket communications between an ESP8266 and the GUI the Winsock library itself will no work, as its
connect(host)function will be conflicting with theconnect(signal,slot)in QML. So we have to go with QTcpSocket and stay inside QT.Winsock tutorial - Socket programming in C on windows
C++ Tutorial: Sockets - Server & Client using QT - 2020
Qt - TCP Client | qt Tutorial
👨🏻💻 Finally we need to find a way to bridge serial data from the GUI towards a Blinky Block over the air. This can be easily done with the help of a ESP8266 or ESP32 configured as an AP. Once connected to the AP on the GUI client side, the former shares its IP@ and port and starts receiving serial packet and forwarding ack packets. ESP8266/32 Rx and Tx are directly connected to the BB's UART.
WiFi-UART Serial Bridge Using ESP8266 or ESP32 - Atadiat
AlphaLima/ESP32-Serial-Bridge
👨🏻💻 From the GUI I need to know the IP@ of the available ESP before I establish the socket connection. I followed these steps to write a standard SSDP solution:
On your client side create a QTcpSocket and a QUdpSocket and on the server side create a QTcpServer and a QUdpSocket.
On the client, send out a broadcast message saying "who is out there, i am a client"
Once the packet is received on the server, send a direct UDP packet back to the QUdpSocket saying "i am here, pick me this is my tcp ip address and tcp port" (you can get the address and port from the received packet). I usually populate a QListView with the ipaddress and ports so that user can choose who he wants to connect to.
When your ready to connect, just take the tcp address and port sent in the packet and connect the QTcpSocket to the QTcpServer.
How to get the address of server dynamically?
Beta Was this translation helpful? Give feedback.
All reactions