Skip to content

Commit f39958c

Browse files
readapting implementations to the new include structure
1 parent f2b100a commit f39958c

15 files changed

+76
-38
lines changed

src/Arduino_CatM1ConnectionHandler.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_CatM1ConnectionHandler.h"
22+
#include "Arduino_ConnectionHandlerDefinitions.h"
2323

2424
#ifdef BOARD_HAS_CATM1_NBIOT /* Only compile if the board has CatM1 BN-IoT */
25+
#include "Arduino_CatM1ConnectionHandler.h"
2526

2627
/******************************************************************************
2728
CTOR/DTOR
@@ -96,7 +97,7 @@ NetworkConnectionState CatM1ConnectionHandler::update_handleDisconnected()
9697
}
9798
else
9899
{
99-
return NetworkConnectionState::CLOSED;
100+
return NetworkConnectionState::CLOSED;
100101
}
101102
}
102103

src/Arduino_CatM1ConnectionHandler.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
INCLUDE
2323
******************************************************************************/
2424

25-
#include "Arduino_ConnectionHandler.h"
25+
#include "Arduino_ConnectionHandlerInterface.h"
2626

27-
28-
#ifdef BOARD_HAS_CATM1_NBIOT /* Only compile if the board has CatM1 BN-IoT */
27+
#if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_EDGE_CONTROL)
28+
#include <GSM.h>
29+
#endif
2930

3031
/******************************************************************************
3132
CLASS DECLARATION
@@ -66,6 +67,4 @@ class CatM1ConnectionHandler : public ConnectionHandler
6667
GSMClient _gsm_client;
6768
};
6869

69-
#endif /* #ifdef BOARD_HAS_CATM1_NBIOT */
70-
7170
#endif /* #ifndef ARDUINO_CATM1_CONNECTION_HANDLER_H_ */

src/Arduino_CellularConnectionHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
INCLUDE
1414
******************************************************************************/
1515

16-
#include "Arduino_CellularConnectionHandler.h"
16+
#include "Arduino_ConnectionHandlerDefinitions.h"
1717

1818
#ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */
19+
#include "Arduino_CellularConnectionHandler.h"
1920

2021
/******************************************************************************
2122
CTOR/DTOR

src/Arduino_CellularConnectionHandler.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818

1919
#include "Arduino_ConnectionHandler.h"
2020

21-
#ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */
2221

2322
/******************************************************************************
2423
CLASS DECLARATION
2524
******************************************************************************/
2625

26+
#if defined(ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7)
27+
#include <Arduino_Cellular.h>
28+
#endif
29+
2730
class CellularConnectionHandler : public ConnectionHandler
2831
{
2932
public:
@@ -56,6 +59,4 @@ class CellularConnectionHandler : public ConnectionHandler
5659
TinyGsmClient _gsm_client = _cellular.getNetworkClient();
5760
};
5861

59-
#endif /* #ifdef BOARD_HAS_CELLULAR */
60-
6162
#endif /* #ifndef ARDUINO_CELLULAR_CONNECTION_HANDLER_H_ */

src/Arduino_ConnectionHandlerDefinitions.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ enum class NetworkAdapter {
162162
NB,
163163
GSM,
164164
LORA,
165-
CATM1
165+
CATM1,
166+
CELL
166167
};
167168

168169
/******************************************************************************

src/Arduino_EthernetConnectionHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
INCLUDE
1717
******************************************************************************/
1818

19-
#include "Arduino_EthernetConnectionHandler.h"
19+
#include "Arduino_ConnectionHandlerDefinitions.h"
2020

2121
#ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */
22+
#include "Arduino_EthernetConnectionHandler.h"
2223

2324
/******************************************************************************
2425
CTOR/DTOR

src/Arduino_EthernetConnectionHandler.h

+12-5
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_ConnectionHandler.h"
23-
24-
#ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */
22+
#include "Arduino_ConnectionHandlerInterface.h"
23+
24+
#if defined(ARDUINO_PORTENTA_H7_M7)
25+
#include <Ethernet.h>
26+
#include <PortentaEthernet.h>
27+
#elif defined(ARDUINO_PORTENTA_C33)
28+
#include <EthernetC33.h>
29+
#include <EthernetUdp.h>
30+
#elif defined(ARDUINO_OPTA)
31+
#include <Ethernet.h>
32+
#include <PortentaEthernet.h>
33+
#endif
2534

2635
/******************************************************************************
2736
CLASS DECLARATION
@@ -64,6 +73,4 @@ class EthernetConnectionHandler : public ConnectionHandler
6473

6574
};
6675

67-
#endif /* #ifdef BOARD_HAS_ETHERNET */
68-
6976
#endif /* ARDUINO_ETHERNET_CONNECTION_HANDLER_H_ */

src/Arduino_GSMConnectionHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_GSMConnectionHandler.h"
22+
#include "Arduino_ConnectionHandlerDefinitions.h"
2323

2424
#ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */
25+
#include "Arduino_GSMConnectionHandler.h"
2526

2627
/******************************************************************************
2728
CONSTANTS

src/Arduino_GSMConnectionHandler.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
INCLUDE
2323
******************************************************************************/
2424

25-
#include "Arduino_ConnectionHandler.h"
25+
#include "Arduino_ConnectionHandlerInterface.h"
2626

27-
28-
#ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */
27+
#if defined(ARDUINO_SAMD_MKRGSM1400)
28+
#include <MKRGSM.h>
29+
#endif
2930

3031
/******************************************************************************
3132
CLASS DECLARATION
@@ -65,6 +66,4 @@ class GSMConnectionHandler : public ConnectionHandler
6566
GSMClient _gsm_client;
6667
};
6768

68-
#endif /* #ifdef BOARD_HAS_GSM */
69-
7069
#endif /* #ifndef GSM_CONNECTION_MANAGER_H_ */

src/Arduino_LoRaConnectionHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_LoRaConnectionHandler.h"
22+
#include "Arduino_ConnectionHandlerDefinitions.h"
2323

2424
#if defined(BOARD_HAS_LORA) /* Only compile if the board has LoRa */
25+
#include "Arduino_LoRaConnectionHandler.h"
2526

2627
/******************************************************************************
2728
TYPEDEF

src/Arduino_LoRaConnectionHandler.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
INCLUDE
2323
******************************************************************************/
2424

25-
#include "Arduino_ConnectionHandler.h"
25+
#include "Arduino_ConnectionHandlerInterface.h"
26+
27+
#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310)
28+
#include <MKRWAN.h>
29+
#endif
2630

2731
#ifdef BOARD_HAS_LORA /* Only compile if the board has LoRa */
2832

src/Arduino_NBConnectionHandler.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_NBConnectionHandler.h"
22+
#include "Arduino_ConnectionHandlerDefinitions.h"
2323

2424
#ifdef BOARD_HAS_NB /* Only compile if this is a board with NB */
25+
#include "Arduino_NBConnectionHandler.h"
2526

2627
/******************************************************************************
2728
CONSTANTS

src/Arduino_NBConnectionHandler.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
INCLUDE
2323
******************************************************************************/
2424

25-
#include "Arduino_ConnectionHandler.h"
25+
#include "Arduino_ConnectionHandlerInterface.h"
2626

27-
#ifdef BOARD_HAS_NB /* Only compile if this is a board with NB */
27+
#ifdef ARDUINO_SAMD_MKRNB1500
28+
#include <MKRNB.h>
29+
#endif
2830

2931
/******************************************************************************
3032
CLASS DECLARATION
@@ -68,6 +70,4 @@ class NBConnectionHandler : public ConnectionHandler
6870
NBClient _nb_client;
6971
};
7072

71-
#endif /* #ifdef BOARD_HAS_NB */
72-
7373
#endif /* #ifndef NB_CONNECTION_MANAGER_H_ */

src/Arduino_WiFiConnectionHandler.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
INCLUDE
2020
******************************************************************************/
2121

22-
#include "Arduino_WiFiConnectionHandler.h"
22+
#include "Arduino_ConnectionHandlerDefinitions.h"
2323

2424
#ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */
25+
#include "Arduino_WiFiConnectionHandler.h"
2526

2627
/******************************************************************************
2728
CONSTANTS
@@ -143,7 +144,7 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnected()
143144
Debug.print(DBG_INFO, F("Attempting reconnection"));
144145
#endif
145146
}
146-
147+
147148
return NetworkConnectionState::DISCONNECTED;
148149
}
149150
return NetworkConnectionState::CONNECTED;

src/Arduino_WiFiConnectionHandler.h

+25-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,31 @@
2222
INCLUDE
2323
******************************************************************************/
2424

25-
#include "Arduino_ConnectionHandler.h"
26-
27-
#ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */
25+
#include "Arduino_ConnectionHandlerInterface.h"
26+
27+
#ifdef ARDUINO_SAMD_MKR1000
28+
#include <WiFi101.h>
29+
#include <WiFiUdp.h>
30+
#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \
31+
defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined (ARDUINO_NANO_RP2040_CONNECT)
32+
#include <WiFiNINA.h>
33+
#include <WiFiUdp.h>
34+
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M7) || \
35+
defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_OPTA) || defined(ARDUINO_GIGA)
36+
#include <WiFi.h>
37+
#include <WiFiUdp.h>
38+
#elif defined(ARDUINO_PORTENTA_C33)
39+
#include <WiFiC3.h>
40+
#include <WiFiUdp.h>
41+
#elif defined(ARDUINO_ARCH_ESP8266)
42+
#include <ESP8266WiFi.h>
43+
#include <WiFiUdp.h>
44+
#elif defined(ARDUINO_ARCH_ESP32)
45+
#include <WiFi.h>
46+
#include <WiFiUdp.h>
47+
#elif defined(ARDUINO_UNOR4_WIFI)
48+
#include <WiFiS3.h>
49+
#endif
2850

2951
/******************************************************************************
3052
CLASS DECLARATION
@@ -59,6 +81,4 @@ class WiFiConnectionHandler : public ConnectionHandler
5981
WiFiClient _wifi_client;
6082
};
6183

62-
#endif /* #ifdef BOARD_HAS_WIFI */
63-
6484
#endif /* ARDUINO_WIFI_CONNECTION_HANDLER_H_ */

0 commit comments

Comments
 (0)