ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
messageBuilder.ino File Reference

Examples of advanced message building. More...

#include <Ethernet.h>
#include <EthernetUdp.h>
#include <ProsecCoAP.h>

Functions

IPAddress deviceIp (192, 168, 0, 99)
 
void setup ()
 
void loop ()
 

Variables

byte mac [] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}
 
IPAddress destinationIp = IPAddress(192, 168, 0, 100)
 
EthernetUDP Udp
 

Detailed Description

Examples of advanced message building.

Note
Message building does not require to initialise the CoAP node. See the client example to see how to send the message after building it.

Function Documentation

◆ deviceIp()

IPAddress deviceIp ( 192 ,
168 ,
0 ,
99  )

◆ loop()

void loop ( )

PRO-TIP: The library supports building a message in any order. However, given the structure of the CoAP message, some memmove calls will be necessary.

It is slightly more efficient to perform operations in this order:

  1. Instantiate the message with type and code.
  2. Add a token.
  3. Add options from the option with lower OptionNumber to the higher one.
  4. Lastly, add a payload.

◆ setup()

void setup ( )

Variable Documentation

◆ destinationIp

IPAddress destinationIp = IPAddress(192, 168, 0, 100)

◆ mac

byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}

◆ Udp

EthernetUDP Udp