ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
Detail.h
Go to the documentation of this file.
1
6#ifndef DETAIL_H_INCLUDED
7#define DETAIL_H_INCLUDED
8
9// Include common types.
10#include "../Definitions.h"
11
12namespace Coap
13{
17 namespace Detail
18 {
27 unsigned long getRandomTimeout();
37 size_t getMinOptionBytes(uint32_t value);
48 ErrorCode sendUdp(UDP *udp, const uint8_t *data, size_t length, IPAddress ip, uint16_t port);
49
58 class UriRegistry
59 {
60 private:
67 const char *_path[COAP_MAX_CALLBACKS];
78 size_t _count;
79
80 public:
81 UriRegistry() : _count(0) {}
102 ErrorCode add(const char *path, Callback callback);
116 ErrorCode find(const char *path, Callback &callback) const;
117 };
118
119 }
120}
121#endif // DETAIL_H_INCLUDED
Shared definitions for the library.
#define COAP_MAX_CALLBACKS
Maximum number of callbacks that can be registered at runtime.
Definition Definitions.h:60
ErrorCode sendUdp(UDP *udp, const uint8_t *data, size_t length, IPAddress ip, uint16_t port)
Wrapper around low level function to send raw UDP data.
Definition Detail.cpp:8
unsigned long getRandomTimeout()
Get a random timeout value for retransmissions.
Definition Detail.cpp:27
size_t getMinOptionBytes(uint32_t value)
Return the minimum number of bytes needed to represent the given value.
Definition Detail.cpp:32
Namespace for the library.
Definition Definitions.h:161
void(* Callback)(Message &message, IPAddress ip, uint16_t port)
Callback function type for handling incoming messages.
Definition Definitions.h:361
ErrorCode
Error codes used in the library.
Definition Definitions.h:327
WiFiUDP udp
Definition serverEsp32.ino:18
IPAddress ip(192, 168, 0, DEVICE_ID)