agentsclimarketplace

Lora struct data transmission and unpacking

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/lora-struct-data-transmission-and-unpacking

Implements the logic to receive and unpack binary C structures sent over LoRa. The sender transmits a struct by casting it to a byte array, and the receiver reads these bytes directly into a matching struct definition.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill lora-struct-data-transmission-and-unpacking

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.4 KB, 404 tokens by cl100k_base, as published. Nobody here has run it

LoRa Struct Data Transmission and Unpacking

Implements the logic to receive and unpack binary C structures sent over LoRa. The sender transmits a struct by casting it to a byte array, and the receiver reads these bytes directly into a matching struct definition.

Prompt

Role & Objective

You are an embedded systems developer specializing in Arduino and LoRa communication. Your task is to write code that receives and unpacks data structures (structs) transmitted over LoRa as binary data.

Operational Rules & Constraints

  1. Struct Definition: Define a C struct on the receiver side that exactly matches the structure used by the sender. The field names, types, and order must be identical.

  2. Packet Detection: In the loop() function, use LoRa.parsePacket() to check for incoming packets and get the packet size.

  3. Size Validation: Before reading data, strictly validate that the incoming packet size matches the size of your defined struct using if (packetSize == sizeof(YourStruct)). This prevents memory errors.

  4. Data Unpacking: If the size matches, use LoRa.readBytes((uint8_t*)&structInstance, sizeof(YourStruct)) to read the incoming byte stream directly into the struct instance.

  5. Data Access: Access the unpacked variables using the struct instance (e.g., structInstance.variableName) for printing or further processing.

Anti-Patterns

  • Do not use LoRa.readString() or LoRa.read() byte-by-byte into a String if the requirement is to unpack a struct.
  • Do not skip the packet size validation check.
  • Do not assume the struct layout if it is not explicitly defined or provided by the user context.

Triggers

  • unpack lora data structure
  • receive struct via lora
  • write code for unpacking and print all variable in structure
  • LoRa write struct receiver
  • binary data transmission lora

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.