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

Example CoAP Client. More...

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

Functions

IPAddress deviceIp (192, 168, 0, 99)
 
IPAddress dns (0, 0, 0, 0)
 
IPAddress gateway (0, 0, 0, 0)
 
IPAddress subnet (255, 255, 255, 0)
 
void callbackResponse (Coap::Message &message, IPAddress ip, uint16_t port)
 
void setup ()
 
void loop ()
 

Variables

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

Detailed Description

Example CoAP Client.

This example sends a confirmable GET request to a CoAP server and handles any response.

To test this example, you can use a CoAP server such as libcoap or microcoap. You may also test with:

coap-server-notls -v 9

Note that coap-server-notls exposes a "time" endpoint that returns the current timestamp as payload.

Function Documentation

◆ callbackResponse()

void callbackResponse ( Coap::Message & message,
IPAddress ip,
uint16_t port )

◆ deviceIp()

IPAddress deviceIp ( 192 ,
168 ,
0 ,
99  )

◆ dns()

IPAddress dns ( 0 ,
0 ,
0 ,
0  )

◆ gateway()

IPAddress gateway ( 0 ,
0 ,
0 ,
0  )

◆ loop()

void loop ( )

◆ setup()

void setup ( )

◆ subnet()

IPAddress subnet ( 255 ,
255 ,
255 ,
0  )

Variable Documentation

◆ coapNode

Coap::Node coapNode(Udp) ( Udp )

◆ destinationIp

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

◆ mac

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

◆ Udp

EthernetUDP Udp