- This topic has 1 reply, 2 voices, and was last updated 1 year, 6 months ago by .
- You must be logged in to reply to this topic.
Home › Forums › The libraries hosted on the site › EByte LoRa e220 UART devices LLCC68 › Does the library identify when it ends and starts the Struct in the buffer?
Hi Renzo
The library provides ResponseContainer receiveMessageUntil(char delimiter = '\0');
which allows sending a string with a “\0” delimiter at the end. With this, the Receiver, when reading the buffer, identifies when a message starts and ends.
Does the same happen when sending a Struct? I was analyzing the library code (I’m a beginner), but I didn’t identify which strategy is used to identify the beginning and end of a Struct in the buffer.
How does ResponseStructContainer receiveMessage(const uint8_t size);
know/identify when a Struct ends and starts another Struct in the buffer?
If there is no such identification, if the developer makes a mistake in the buffer reading strategy, will this cause a memory leak?
Hi George,
for a structure, with a fixed size, you do not need to identify the end of the struct, you already know the size.
If you have some different messages, you can use a simple trick like this (read the first part of the struct to understand the type).
Bye Renzo
More
3D Printer 3D printer upgrade ABB Arduino Arduino IDE Arduino SAMD boards Aurora AWS CNC Cyclone PCB Factory Cyclone PCB Factory how to build It Display DynamoDB E32 E70 EByte esp01 esp32 esp8266 File System Firmware i2c Library LoRa MicroPython Milling PCB My PCB Networking PCB pinout Power saving Raspberry Pi REST API RF rp2040 SD Card Sensors Sleep and Wake UP SPI STM32 Temperature Tutorial Web Server Wemos D1 mini WiFi