- This topic has 1 reply, 2 voices, and was last updated 2 years, 7 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
Just like a well-organized workbench, this website uses cookies to function properly and efficiently.
🛠️ The Essentials (Necessary): Some cookies are categorized as necessary and are stored on your browser because they are critical for the basic working of the site.
📊 The Analytics (Third-party): We also use third-party cookies to help us analyze traffic and understand which projects you like the most. These are stored only if you give us the green light.
You can choose to opt-out, but keep in mind that disabling them might make the site experience a bit less "smooth".
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
| cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
| cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
| cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
| viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
