Skip to content

Commit

Permalink
readapting implementations to the new include structure
Browse files Browse the repository at this point in the history
  • Loading branch information
andreagilardoni committed Jun 10, 2024
1 parent f2b100a commit f39958c
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 38 deletions.
5 changes: 3 additions & 2 deletions src/Arduino_CatM1ConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_CatM1ConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CTOR/DTOR
Expand Down Expand Up @@ -96,7 +97,7 @@ NetworkConnectionState CatM1ConnectionHandler::update_handleDisconnected()
}
else
{
return NetworkConnectionState::CLOSED;
return NetworkConnectionState::CLOSED;
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/Arduino_CatM1ConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"
#include "Arduino_ConnectionHandlerInterface.h"


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

/******************************************************************************
CLASS DECLARATION
Expand Down Expand Up @@ -66,6 +67,4 @@ class CatM1ConnectionHandler : public ConnectionHandler
GSMClient _gsm_client;
};

#endif /* #ifdef BOARD_HAS_CATM1_NBIOT */

#endif /* #ifndef ARDUINO_CATM1_CONNECTION_HANDLER_H_ */
3 changes: 2 additions & 1 deletion src/Arduino_CellularConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_CellularConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CTOR/DTOR
Expand Down
7 changes: 4 additions & 3 deletions src/Arduino_CellularConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

#include "Arduino_ConnectionHandler.h"

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

/******************************************************************************
CLASS DECLARATION
******************************************************************************/

#if defined(ARDUINO_PORTENTA_C33) || defined(ARDUINO_PORTENTA_H7_M7)
#include <Arduino_Cellular.h>
#endif

class CellularConnectionHandler : public ConnectionHandler
{
public:
Expand Down Expand Up @@ -56,6 +59,4 @@ class CellularConnectionHandler : public ConnectionHandler
TinyGsmClient _gsm_client = _cellular.getNetworkClient();
};

#endif /* #ifdef BOARD_HAS_CELLULAR */

#endif /* #ifndef ARDUINO_CELLULAR_CONNECTION_HANDLER_H_ */
3 changes: 2 additions & 1 deletion src/Arduino_ConnectionHandlerDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ enum class NetworkAdapter {
NB,
GSM,
LORA,
CATM1
CATM1,
CELL
};

/******************************************************************************
Expand Down
3 changes: 2 additions & 1 deletion src/Arduino_EthernetConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_EthernetConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CTOR/DTOR
Expand Down
17 changes: 12 additions & 5 deletions src/Arduino_EthernetConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"

#ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */
#include "Arduino_ConnectionHandlerInterface.h"

#if defined(ARDUINO_PORTENTA_H7_M7)
#include <Ethernet.h>
#include <PortentaEthernet.h>
#elif defined(ARDUINO_PORTENTA_C33)
#include <EthernetC33.h>
#include <EthernetUdp.h>
#elif defined(ARDUINO_OPTA)
#include <Ethernet.h>
#include <PortentaEthernet.h>
#endif

/******************************************************************************
CLASS DECLARATION
Expand Down Expand Up @@ -64,6 +73,4 @@ class EthernetConnectionHandler : public ConnectionHandler

};

#endif /* #ifdef BOARD_HAS_ETHERNET */

#endif /* ARDUINO_ETHERNET_CONNECTION_HANDLER_H_ */
3 changes: 2 additions & 1 deletion src/Arduino_GSMConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_GSMConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CONSTANTS
Expand Down
9 changes: 4 additions & 5 deletions src/Arduino_GSMConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"
#include "Arduino_ConnectionHandlerInterface.h"


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

/******************************************************************************
CLASS DECLARATION
Expand Down Expand Up @@ -65,6 +66,4 @@ class GSMConnectionHandler : public ConnectionHandler
GSMClient _gsm_client;
};

#endif /* #ifdef BOARD_HAS_GSM */

#endif /* #ifndef GSM_CONNECTION_MANAGER_H_ */
3 changes: 2 additions & 1 deletion src/Arduino_LoRaConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_LoRaConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
TYPEDEF
Expand Down
6 changes: 5 additions & 1 deletion src/Arduino_LoRaConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"
#include "Arduino_ConnectionHandlerInterface.h"

#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310)
#include <MKRWAN.h>
#endif

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

Expand Down
3 changes: 2 additions & 1 deletion src/Arduino_NBConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_NBConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CONSTANTS
Expand Down
8 changes: 4 additions & 4 deletions src/Arduino_NBConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"
#include "Arduino_ConnectionHandlerInterface.h"

#ifdef BOARD_HAS_NB /* Only compile if this is a board with NB */
#ifdef ARDUINO_SAMD_MKRNB1500
#include <MKRNB.h>
#endif

/******************************************************************************
CLASS DECLARATION
Expand Down Expand Up @@ -68,6 +70,4 @@ class NBConnectionHandler : public ConnectionHandler
NBClient _nb_client;
};

#endif /* #ifdef BOARD_HAS_NB */

#endif /* #ifndef NB_CONNECTION_MANAGER_H_ */
5 changes: 3 additions & 2 deletions src/Arduino_WiFiConnectionHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
INCLUDE
******************************************************************************/

#include "Arduino_WiFiConnectionHandler.h"
#include "Arduino_ConnectionHandlerDefinitions.h"

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

/******************************************************************************
CONSTANTS
Expand Down Expand Up @@ -143,7 +144,7 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnected()
Debug.print(DBG_INFO, F("Attempting reconnection"));
#endif
}

return NetworkConnectionState::DISCONNECTED;
}
return NetworkConnectionState::CONNECTED;
Expand Down
30 changes: 25 additions & 5 deletions src/Arduino_WiFiConnectionHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,31 @@
INCLUDE
******************************************************************************/

#include "Arduino_ConnectionHandler.h"

#ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */
#include "Arduino_ConnectionHandlerInterface.h"

#ifdef ARDUINO_SAMD_MKR1000
#include <WiFi101.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \
defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined (ARDUINO_NANO_RP2040_CONNECT)
#include <WiFiNINA.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M7) || \
defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_OPTA) || defined(ARDUINO_GIGA)
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_PORTENTA_C33)
#include <WiFiC3.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_ARCH_ESP8266)
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_ARCH_ESP32)
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(ARDUINO_UNOR4_WIFI)
#include <WiFiS3.h>
#endif

/******************************************************************************
CLASS DECLARATION
Expand Down Expand Up @@ -59,6 +81,4 @@ class WiFiConnectionHandler : public ConnectionHandler
WiFiClient _wifi_client;
};

#endif /* #ifdef BOARD_HAS_WIFI */

#endif /* ARDUINO_WIFI_CONNECTION_HANDLER_H_ */

0 comments on commit f39958c

Please sign in to comment.