mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
Variable number of TCP clients
This commit is contained in:
parent
657fb7009c
commit
701f4e852f
|
@ -56,8 +56,7 @@ template<typename... Targs> void CommandDistributor::broadcastReply(clientType t
|
||||||
#ifdef CD_HANDLE_RING
|
#ifdef CD_HANDLE_RING
|
||||||
// wifi or ethernet ring streams with multiple client types
|
// wifi or ethernet ring streams with multiple client types
|
||||||
RingStream * CommandDistributor::ring=0;
|
RingStream * CommandDistributor::ring=0;
|
||||||
CommandDistributor::clientType CommandDistributor::clients[8]={
|
CommandDistributor::clientType CommandDistributor::clients[MAX_NUM_TCP_CLIENTS]={ NONE_TYPE }; // 0 is and must be NONE_TYPE
|
||||||
NONE_TYPE,NONE_TYPE,NONE_TYPE,NONE_TYPE,NONE_TYPE,NONE_TYPE,NONE_TYPE,NONE_TYPE};
|
|
||||||
|
|
||||||
// Parse is called by Withrottle or Ethernet interface to determine which
|
// Parse is called by Withrottle or Ethernet interface to determine which
|
||||||
// protocol the client is using and call the appropriate part of dcc++Ex
|
// protocol the client is using and call the appropriate part of dcc++Ex
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
|
|
||||||
class CommandDistributor {
|
class CommandDistributor {
|
||||||
public:
|
public:
|
||||||
enum clientType: byte {NONE_TYPE,COMMAND_TYPE,WITHROTTLE_TYPE};
|
enum clientType: byte {NONE_TYPE=0,COMMAND_TYPE,WITHROTTLE_TYPE};
|
||||||
private:
|
private:
|
||||||
static void broadcastToClients(clientType type);
|
static void broadcastToClients(clientType type);
|
||||||
static StringBuffer * broadcastBufferWriter;
|
static StringBuffer * broadcastBufferWriter;
|
||||||
#ifdef CD_HANDLE_RING
|
#ifdef CD_HANDLE_RING
|
||||||
static RingStream * ring;
|
static RingStream * ring;
|
||||||
static clientType clients[8];
|
static clientType clients[MAX_NUM_TCP_CLIENTS];
|
||||||
#endif
|
#endif
|
||||||
public :
|
public :
|
||||||
static void parse(byte clientId,byte* buffer, RingStream * ring);
|
static void parse(byte clientId,byte* buffer, RingStream * ring);
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include <lwip/netif.h>
|
#include <lwip/netif.h>
|
||||||
extern "C" struct netif gnetif;
|
extern "C" struct netif gnetif;
|
||||||
#define STM32_ETHERNET
|
#define STM32_ETHERNET
|
||||||
#define MAX_SOCK_NUM 8
|
#define MAX_SOCK_NUM MAX_NUM_TCP_CLIENTS
|
||||||
#else
|
#else
|
||||||
#include "Ethernet.h"
|
#include "Ethernet.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -137,6 +137,13 @@ The configuration file for DCC-EX Command Station
|
||||||
//
|
//
|
||||||
//#define ENABLE_ETHERNET true
|
//#define ENABLE_ETHERNET true
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// MAX_NUM_TCP_CLIENTS: If you on STM32 Ethernet (and only there) want more than
|
||||||
|
// 10 TCP clients, enable this here **AND** follow the instructions in STM32lwiopts.h
|
||||||
|
//
|
||||||
|
//#define MAX_NUM_TCP_CLIENTS 20
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
|
|
15
defines.h
15
defines.h
|
@ -239,4 +239,19 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_STM32)
|
||||||
|
// Allow override of MAX_NUM_TCP_CLIENTS but default is 10
|
||||||
|
#ifndef MAX_NUM_TCP_CLIENTS
|
||||||
|
#define MAX_NUM_TCP_CLIENTS 10
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
|
// Espressif LWIP stack
|
||||||
|
#define MAX_NUM_TCP_CLIENTS 10
|
||||||
|
#else
|
||||||
|
// Wifi shields etc
|
||||||
|
#define MAX_NUM_TCP_CLIENTS 8
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif //DEFINES_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user