Skip to content

Commit cbe3db0

Browse files
added getNewClient for tcp connections
1 parent 2b21c3c commit cbe3db0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/Arduino_GenericClient.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#pragma once
2+
3+
#include "Arduino_ConnectionHandler.h"
4+
5+
namespace connectionHandler {
6+
inline Client* getNewClient(NetworkAdapter net) {
7+
switch(net) {
8+
#ifdef BOARD_HAS_WIFI
9+
case NetworkAdapter::WIFI:
10+
return new WiFiClient();
11+
#endif // BOARD_HAS_WIFI
12+
#ifdef BOARD_HAS_ETHERNET
13+
case NetworkAdapter::ETHERNET:
14+
return new EthernetClient();
15+
#endif // BOARD_HAS_ETHERNET
16+
#ifdef BOARD_HAS_NB
17+
case NetworkAdapter::NB:
18+
return new NBClient();
19+
#endif // BOARD_HAS_NB
20+
#ifdef BOARD_HAS_GSM
21+
case NetworkAdapter::GSM:
22+
return new GSMClient();
23+
#endif // BOARD_HAS_GSM
24+
#ifdef BOARD_HAS_CATM1_NBIOT
25+
case NetworkAdapter::CATM1:
26+
return new GSMClient();
27+
#endif // BOARD_HAS_CATM1_NBIOT
28+
default:
29+
return nullptr;
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)