Skip to content

Latest commit

 

History

History
50 lines (44 loc) · 4.34 KB

data-structures.md

File metadata and controls

50 lines (44 loc) · 4.34 KB

Documentation index


Data structures

PJON_Endpoint

PJON_Endpoint contains the device id, bus id and MAC address of a device:

struct PJON_Endpoint {
  uint8_t id = PJON_NOT_ASSIGNED;
  uint8_t bus_id[4] = {0, 0, 0, 0};
  uint8_t mac[6] = {0, 0, 0, 0, 0, 0};
};

PJON_Endpoint contains mac if PJON_INCLUDE_MAC is defined. The conditional inclusion is present to reduce the footprint of programs where the MAC address is not used.

PJON_Packet_Info

PJON_Packet_Info contains all meta-data supported by the PJON packet format. The tx and rx data structures of type PJON_Endpoint contain the transmitter and receiver information.

struct PJON_Packet_Info {
  PJON_Endpoint tx;
  PJON_Endpoint rx;
  void *custom_pointer;
  uint8_t header = PJON_NO_HEADER;
  uint8_t hops = 0;
  uint16_t id = 0;
  uint16_t port = PJON_BROADCAST;
};

PJON_Packet_Info contains port if PJON_INCLUDE_PORT is defined and id if PJON_INCLUDE_PACKET_ID is defined. The conditional inclusion is present to reduce the footprint of programs where the port and the packet id are not used.

The custom_pointer can be used to link other classes or instances passing any sort of data structure. To understand how to use it see the ClassMemberCallback example.