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.


This document is automatically generated from the github repository. If you have noticed an error or an inconsistency, please report it opening an issue here

The PJON protocol handbook

This is the second publication about PJON, which contains the documentation, the specification, many application examples and troubleshooting techniques. The book is Made in Italy and within its 204 pages the whole PJON network protocol stack and its strategies are accurately described with graphs, color pictures and comments on its implementation. Choosing this handy format, you will always have PJON with you, also when not being connected to Internet.


BUY NOW!