ProsecCoAP 🥂
 
Loading...
Searching...
No Matches
Detail.h
Go to the documentation of this file.
1
9#ifndef DETAIL_H_INCLUDED
10#define DETAIL_H_INCLUDED
11
12// Include common types.
13#include "../Definitions.h"
14
15namespace Coap
16{
17
21 namespace Detail
22 {
31 unsigned long getRandomTimeout();
32
42 size_t getMinOptionBytes(uint32_t value);
43
54 ErrorCode sendUdp(UDP *udp, const uint8_t *data, size_t length, IPAddress ip, uint16_t port);
55
64 class UriRegistry
65 {
66 private:
73 const char *_path[COAP_MAX_CALLBACKS];
84 size_t _count;
85
86 public:
87 UriRegistry() : _count(0) {}
109 ErrorCode add(const char *path, Callback callback);
123 ErrorCode find(const char *path, Callback &callback) const;
124 };
125
126 }
127}
128#endif // DETAIL_H_INCLUDED
#define COAP_MAX_CALLBACKS
Maximum number of callbacks that can be registered at runtime.
Definition Definitions.h:54
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:6
unsigned long getRandomTimeout()
Get a random timeout value for retransmissions.
Definition Detail.cpp:25
size_t getMinOptionBytes(uint32_t value)
Return the minimum number of bytes needed to represent the given value.
Definition Detail.cpp:30
Namespace for the library.
Definition Definitions.h:155
void(* Callback)(Message &message, IPAddress ip, uint16_t port)
Callback function type for handling incoming messages.
Definition Definitions.h:355
ErrorCode
Error codes used in the library.
Definition Definitions.h:321
WiFiUDP udp
Definition serverEsp32.ino:17
IPAddress ip(192, 168, 0, DEVICE_ID)