RF24Ethernet - TCP/IP over RF24Network v2.2.1
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
RF24Server.h
Go to the documentation of this file.
1/*
2 RF24Server.h - Arduino implementation of a uIP wrapper class.
3 Copyright (c) 2014 tmrh20@gmail.com, github.com/TMRh20
4 Copyright (c) 2013 Norbert Truchsess <norbert.truchsess@t-online.de>
5 All rights reserved.
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef RF24SERVER_H
19#define RF24SERVER_H
20
21#if __has_include(<Server.h>)
22 #include <Server.h>
23#elif __has_include("Server.h")
24 #include "Server.h"
25#else
26 #include <Arduino.h>
27#endif
28
29#include "RF24Client.h"
30#include "ethernet_comp.h"
31
32class RF24Server : public Server
33{
34
35public:
36 RF24Server(uint16_t);
39 void begin();
40#if defined(ESP32)
41 /* on esp32 this is a pure virtual func */
42 void begin(uint16_t port);
43#endif
44 size_t write(uint8_t);
45 size_t write(const uint8_t* buf, size_t size);
46 using Print::write;
47
48 /**
49 * Set server side timeouts in mS. If data is not succesfully sent or received in this timeframe, disconnect the client.
50 */
51 void setTimeout(uint32_t timeout);
52
53 static bool connectionActive;
54 static int serverSocket;
55
56private:
57#if USE_LWIP < 1
58 uint16_t _port;
59#elif USE_LWIP == 1
60 static struct tcp_pcb* sPcb;
61 static struct tcp_pcb* bindPcb;
62 static uint16_t _port;
63 static EthernetClient::ConnectState* serverState;
64#elif USE_LWIP == 2
65 static uint16_t _port;
66 static bool serverListening;
67 static uint32_t timeoutTimer;
68 static RF24Client serverClient;
69#endif
70};
71
72#endif
size_t write(uint8_t)
static int serverSocket
Definition RF24Server.h:54
RF24Server(uint16_t)
static bool connectionActive
Definition RF24Server.h:53
RF24Client available()
void setTimeout(uint32_t timeout)