From f2b100a866875110ed5de9c5dd183d385f8e1c11 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Wed, 5 Jun 2024 13:48:25 +0200 Subject: [PATCH 1/4] splitting src/Arduino_ConnectionHandler.h into multiple files to avoid cyclic includes --- src/Arduino_ConnectionHandler.h | 270 +----------------- src/Arduino_ConnectionHandlerDefinitions.h | 185 ++++++++++++ ...=> Arduino_ConnectionHandlerInterface.cpp} | 2 +- src/Arduino_ConnectionHandlerInterface.h | 99 +++++++ 4 files changed, 293 insertions(+), 263 deletions(-) create mode 100644 src/Arduino_ConnectionHandlerDefinitions.h rename src/{Arduino_ConnectionHandler.cpp => Arduino_ConnectionHandlerInterface.cpp} (99%) create mode 100644 src/Arduino_ConnectionHandlerInterface.h diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index b4f8e315..ee79dc3a 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -27,275 +27,21 @@ #endif #include +#include "Arduino_ConnectionHandlerDefinitions.h" -#ifdef ARDUINO_SAMD_MKR1000 - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED - #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED -#endif - -#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \ - defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined (ARDUINO_NANO_RP2040_CONNECT) - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_MODULE - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED - #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_LATEST_VERSION -#endif - -#if defined(ARDUINO_PORTENTA_H7_M7) - #include - #include - #include - #include - #include - #include - - #define BOARD_HAS_WIFI - #define BOARD_HAS_ETHERNET - #define BOARD_HAS_CATM1_NBIOT - #define BOARD_HAS_CELLULAR - #define BOARD_HAS_PORTENTA_CATM1_NBIOT_SHIELD - #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED -#endif - -#if defined(ARDUINO_PORTENTA_C33) - #include - #include - #include - #include - #include - - #define BOARD_HAS_WIFI - #define BOARD_HAS_ETHERNET - #define BOARD_HAS_CELLULAR - #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED -#endif - -#if defined(ARDUINO_NICLA_VISION) - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED -#endif - -#if defined(ARDUINO_OPTA) - #include - #include - #include - #include - - #define BOARD_HAS_WIFI - #define BOARD_HAS_ETHERNET - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED -#endif - -#if defined(ARDUINO_GIGA) - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED -#endif - -#ifdef ARDUINO_SAMD_MKRGSM1400 - #include - #define BOARD_HAS_GSM - #define NETWORK_HARDWARE_ERROR GPRS_PING_ERROR - #define NETWORK_IDLE_STATUS GSM3_NetworkStatus_t::IDLE - #define NETWORK_CONNECTED GSM3_NetworkStatus_t::GPRS_READY -#endif - -#ifdef ARDUINO_SAMD_MKRNB1500 - #include - #define BOARD_HAS_NB - #define NETWORK_HARDWARE_ERROR - #define NETWORK_IDLE_STATUS NB_NetworkStatus_t::IDLE - #define NETWORK_CONNECTED NB_NetworkStatus_t::GPRS_READY -#endif - -#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) - #include - #define BOARD_HAS_LORA -#endif - -#if defined(ARDUINO_ARCH_ESP8266) - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED - #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED -#endif - -#if defined(ARDUINO_ARCH_ESP32) - #include - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED - #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED -#endif - -#if defined(ARDUINO_UNOR4_WIFI) - #include - - #define BOARD_HAS_WIFI - #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD - #define NETWORK_IDLE_STATUS WL_IDLE_STATUS - #define NETWORK_CONNECTED WL_CONNECTED - #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_LATEST_VERSION +#if defined(BOARD_HAS_WIFI) + #include "Arduino_WiFiConnectionHandler.h" #endif -#ifdef ARDUINO_EDGE_CONTROL - #include - #define BOARD_HAS_CATM1_NBIOT - #define BOARD_HAS_PORTENTA_CATM1_NBIOT_SHIELD - #define NETWORK_HARDWARE_ERROR +#if defined(BOARD_HAS_GSM) + #include "Arduino_GSMConnectionHandler.h" #endif -/****************************************************************************** - TYPEDEFS - ******************************************************************************/ - -enum class NetworkConnectionState : unsigned int { - INIT = 0, - CONNECTING = 1, - CONNECTED = 2, - DISCONNECTING = 3, - DISCONNECTED = 4, - CLOSED = 5, - ERROR = 6 -}; - -enum class NetworkConnectionEvent { - CONNECTED, - DISCONNECTED, - ERROR -}; - -enum class NetworkAdapter { - WIFI, - ETHERNET, - NB, - GSM, - LORA, - CATM1, - CELL -}; - -typedef void (*OnNetworkEventCallback)(); - -/****************************************************************************** - CONSTANTS - ******************************************************************************/ - -static unsigned int const CHECK_INTERVAL_TABLE[] = -{ - /* INIT */ 100, -#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) - /* CONNECTING */ 4000, -#else - /* CONNECTING */ 500, +#if defined(BOARD_HAS_NB) + #include "Arduino_NBConnectionHandler.h" #endif - /* CONNECTED */ 10000, - /* DISCONNECTING */ 100, - /* DISCONNECTED */ 1000, - /* CLOSED */ 1000, - /* ERROR */ 1000 -}; - -/****************************************************************************** - CLASS DECLARATION - ******************************************************************************/ - -class ConnectionHandler { - public: - - ConnectionHandler(bool const keep_alive, NetworkAdapter interface); - - NetworkConnectionState check(); - - #if !defined(BOARD_HAS_LORA) - virtual unsigned long getTime() = 0; - virtual Client &getClient() = 0; - virtual UDP &getUDP() = 0; - #else - virtual int write(const uint8_t *buf, size_t size) = 0; - virtual int read() = 0; - virtual bool available() = 0; - #endif - - NetworkConnectionState getStatus() __attribute__((deprecated)) { - return _current_net_connection_state; - } - - NetworkAdapter getInterface() { - return _interface; - } - - void connect(); - void disconnect(); - - void addCallback(NetworkConnectionEvent const event, OnNetworkEventCallback callback); - void addConnectCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); - void addDisconnectCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); - void addErrorCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); - - protected: - - bool _keep_alive; - NetworkAdapter _interface; - - virtual NetworkConnectionState update_handleInit () = 0; - virtual NetworkConnectionState update_handleConnecting () = 0; - virtual NetworkConnectionState update_handleConnected () = 0; - virtual NetworkConnectionState update_handleDisconnecting() = 0; - virtual NetworkConnectionState update_handleDisconnected () = 0; - - - private: - - unsigned long _lastConnectionTickTime; - NetworkConnectionState _current_net_connection_state; - OnNetworkEventCallback _on_connect_event_callback = NULL, - _on_disconnect_event_callback = NULL, - _on_error_event_callback = NULL; -}; - -#if defined(BOARD_HAS_WIFI) - #include "Arduino_WiFiConnectionHandler.h" -#elif defined(BOARD_HAS_GSM) - #include "Arduino_GSMConnectionHandler.h" -#elif defined(BOARD_HAS_NB) - #include "Arduino_NBConnectionHandler.h" -#elif defined(BOARD_HAS_LORA) +#if defined(BOARD_HAS_LORA) #include "Arduino_LoRaConnectionHandler.h" #endif diff --git a/src/Arduino_ConnectionHandlerDefinitions.h b/src/Arduino_ConnectionHandlerDefinitions.h new file mode 100644 index 00000000..74212d3e --- /dev/null +++ b/src/Arduino_ConnectionHandlerDefinitions.h @@ -0,0 +1,185 @@ +/* + This file is part of ArduinoIoTCloud. + + Copyright 2019 ARDUINO SA (http://www.arduino.cc/) + + This software is released under the GNU General Public License version 3, + which covers the main part of arduino-cli. + The terms of this license can be found at: + https://www.gnu.org/licenses/gpl-3.0.en.html + + You can be released from the requirements of the above licenses by purchasing + a commercial license. Buying such a license is mandatory if you want to modify or + otherwise use the software for commercial activities involving the Arduino + software without disclosing the source code of your own applications. To purchase + a commercial license, send an email to license@arduino.cc. +*/ + +#pragma once + +/****************************************************************************** + INCLUDES + ******************************************************************************/ + +#include + +#ifdef ARDUINO_SAMD_MKR1000 + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED +#endif + +#if defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \ + defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined (ARDUINO_NANO_RP2040_CONNECT) + + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_MODULE + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_LATEST_VERSION +#endif + +#if defined(ARDUINO_PORTENTA_H7_M7) + #define BOARD_HAS_WIFI + #define BOARD_HAS_ETHERNET + #define BOARD_HAS_CATM1_NBIOT + #define BOARD_HAS_CELLULAR + #define BOARD_HAS_PORTENTA_CATM1_NBIOT_SHIELD + #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED +#endif + +#if defined(ARDUINO_PORTENTA_C33) + #define BOARD_HAS_WIFI + #define BOARD_HAS_ETHERNET + #define BOARD_HAS_CELLULAR + #define BOARD_HAS_PORTENTA_VISION_SHIELD_ETHERNET + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED +#endif + +#if defined(ARDUINO_NICLA_VISION) + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED +#endif + +#if defined(ARDUINO_OPTA) + #define BOARD_HAS_WIFI + #define BOARD_HAS_ETHERNET + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED +#endif + +#if defined(ARDUINO_GIGA) + + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED +#endif + +#ifdef ARDUINO_SAMD_MKRGSM1400 + #define BOARD_HAS_GSM + #define NETWORK_HARDWARE_ERROR GPRS_PING_ERROR + #define NETWORK_IDLE_STATUS GSM3_NetworkStatus_t::IDLE + #define NETWORK_CONNECTED GSM3_NetworkStatus_t::GPRS_READY +#endif + +#ifdef ARDUINO_SAMD_MKRNB1500 + #define BOARD_HAS_NB + #define NETWORK_HARDWARE_ERROR + #define NETWORK_IDLE_STATUS NB_NetworkStatus_t::IDLE + #define NETWORK_CONNECTED NB_NetworkStatus_t::GPRS_READY +#endif + +#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) + #define BOARD_HAS_LORA +#endif + +#if defined(ARDUINO_ARCH_ESP8266) + + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED +#endif + +#if defined(ARDUINO_ARCH_ESP32) + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_REQUIRED +#endif + +#if defined(ARDUINO_UNOR4_WIFI) + + #define BOARD_HAS_WIFI + #define NETWORK_HARDWARE_ERROR WL_NO_SHIELD + #define NETWORK_IDLE_STATUS WL_IDLE_STATUS + #define NETWORK_CONNECTED WL_CONNECTED + #define WIFI_FIRMWARE_VERSION_REQUIRED WIFI_FIRMWARE_LATEST_VERSION +#endif + +#ifdef ARDUINO_EDGE_CONTROL + #define BOARD_HAS_CATM1_NBIOT + #define BOARD_HAS_PORTENTA_CATM1_NBIOT_SHIELD + #define NETWORK_HARDWARE_ERROR +#endif + +/****************************************************************************** + TYPEDEFS + ******************************************************************************/ + +enum class NetworkConnectionState : unsigned int { + INIT = 0, + CONNECTING = 1, + CONNECTED = 2, + DISCONNECTING = 3, + DISCONNECTED = 4, + CLOSED = 5, + ERROR = 6 +}; + +enum class NetworkConnectionEvent { + CONNECTED, + DISCONNECTED, + ERROR +}; + +enum class NetworkAdapter { + WIFI, + ETHERNET, + NB, + GSM, + LORA, + CATM1 +}; + +/****************************************************************************** + CONSTANTS + ******************************************************************************/ + +static unsigned int const CHECK_INTERVAL_TABLE[] = +{ + /* INIT */ 100, +#if defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32) + /* CONNECTING */ 4000, +#else + /* CONNECTING */ 500, +#endif + /* CONNECTED */ 10000, + /* DISCONNECTING */ 100, + /* DISCONNECTED */ 1000, + /* CLOSED */ 1000, + /* ERROR */ 1000 +}; diff --git a/src/Arduino_ConnectionHandler.cpp b/src/Arduino_ConnectionHandlerInterface.cpp similarity index 99% rename from src/Arduino_ConnectionHandler.cpp rename to src/Arduino_ConnectionHandlerInterface.cpp index ab83fa08..ccfc4df9 100644 --- a/src/Arduino_ConnectionHandler.cpp +++ b/src/Arduino_ConnectionHandlerInterface.cpp @@ -19,7 +19,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandler.h" +#include "Arduino_ConnectionHandlerInterface.h" /****************************************************************************** CONSTRUCTOR/DESTRUCTOR diff --git a/src/Arduino_ConnectionHandlerInterface.h b/src/Arduino_ConnectionHandlerInterface.h new file mode 100644 index 00000000..52a09bd5 --- /dev/null +++ b/src/Arduino_ConnectionHandlerInterface.h @@ -0,0 +1,99 @@ +/* + This file is part of ArduinoIoTCloud. + + Copyright 2019 ARDUINO SA (http://www.arduino.cc/) + + This software is released under the GNU General Public License version 3, + which covers the main part of arduino-cli. + The terms of this license can be found at: + https://www.gnu.org/licenses/gpl-3.0.en.html + + You can be released from the requirements of the above licenses by purchasing + a commercial license. Buying such a license is mandatory if you want to modify or + otherwise use the software for commercial activities involving the Arduino + software without disclosing the source code of your own applications. To purchase + a commercial license, send an email to license@arduino.cc. +*/ + +#pragma once + +/****************************************************************************** + INCLUDES + ******************************************************************************/ + +#if !defined(__AVR__) +# include +#endif + +#include +#include +#include +#include "Arduino_ConnectionHandlerDefinitions.h" + +/****************************************************************************** + TYPEDEFS + ******************************************************************************/ + +typedef void (*OnNetworkEventCallback)(); + +/****************************************************************************** + CLASS DECLARATION + ******************************************************************************/ + +class ConnectionHandler { + public: + + ConnectionHandler(bool const keep_alive, NetworkAdapter interface); + + + NetworkConnectionState check(); + + #if defined(BOARD_HAS_WIFI) || defined(BOARD_HAS_GSM) || defined(BOARD_HAS_NB) || defined(BOARD_HAS_ETHERNET) || defined(BOARD_HAS_CATM1_NBIOT) + virtual unsigned long getTime() = 0; + virtual Client &getClient() = 0; + virtual UDP &getUDP() = 0; + #endif + + #if defined(BOARD_HAS_LORA) + virtual int write(const uint8_t *buf, size_t size) = 0; + virtual int read() = 0; + virtual bool available() = 0; + #endif + + NetworkConnectionState getStatus() __attribute__((deprecated)) { + return _current_net_connection_state; + } + + NetworkAdapter getInterface() { + return _interface; + } + + void connect(); + void disconnect(); + + void addCallback(NetworkConnectionEvent const event, OnNetworkEventCallback callback); + void addConnectCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); + void addDisconnectCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); + void addErrorCallback(OnNetworkEventCallback callback) __attribute__((deprecated)); + + protected: + + bool _keep_alive; + NetworkAdapter _interface; + + virtual NetworkConnectionState update_handleInit () = 0; + virtual NetworkConnectionState update_handleConnecting () = 0; + virtual NetworkConnectionState update_handleConnected () = 0; + virtual NetworkConnectionState update_handleDisconnecting() = 0; + virtual NetworkConnectionState update_handleDisconnected () = 0; + + + private: + + unsigned long _lastConnectionTickTime; + NetworkConnectionState _current_net_connection_state; + OnNetworkEventCallback _on_connect_event_callback = NULL, + _on_disconnect_event_callback = NULL, + _on_error_event_callback = NULL; +}; + From f39958c8899828e3503cfa337afaea66cd2e791c Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Wed, 5 Jun 2024 13:48:52 +0200 Subject: [PATCH 2/4] readapting implementations to the new include structure --- src/Arduino_CatM1ConnectionHandler.cpp | 5 ++-- src/Arduino_CatM1ConnectionHandler.h | 9 +++---- src/Arduino_CellularConnectionHandler.cpp | 3 ++- src/Arduino_CellularConnectionHandler.h | 7 ++--- src/Arduino_ConnectionHandlerDefinitions.h | 3 ++- src/Arduino_EthernetConnectionHandler.cpp | 3 ++- src/Arduino_EthernetConnectionHandler.h | 17 ++++++++---- src/Arduino_GSMConnectionHandler.cpp | 3 ++- src/Arduino_GSMConnectionHandler.h | 9 +++---- src/Arduino_LoRaConnectionHandler.cpp | 3 ++- src/Arduino_LoRaConnectionHandler.h | 6 ++++- src/Arduino_NBConnectionHandler.cpp | 3 ++- src/Arduino_NBConnectionHandler.h | 8 +++--- src/Arduino_WiFiConnectionHandler.cpp | 5 ++-- src/Arduino_WiFiConnectionHandler.h | 30 ++++++++++++++++++---- 15 files changed, 76 insertions(+), 38 deletions(-) diff --git a/src/Arduino_CatM1ConnectionHandler.cpp b/src/Arduino_CatM1ConnectionHandler.cpp index 0b99716d..46553730 100644 --- a/src/Arduino_CatM1ConnectionHandler.cpp +++ b/src/Arduino_CatM1ConnectionHandler.cpp @@ -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 @@ -96,7 +97,7 @@ NetworkConnectionState CatM1ConnectionHandler::update_handleDisconnected() } else { - return NetworkConnectionState::CLOSED; + return NetworkConnectionState::CLOSED; } } diff --git a/src/Arduino_CatM1ConnectionHandler.h b/src/Arduino_CatM1ConnectionHandler.h index de5fd01f..ec6b2633 100644 --- a/src/Arduino_CatM1ConnectionHandler.h +++ b/src/Arduino_CatM1ConnectionHandler.h @@ -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 +#endif /****************************************************************************** CLASS DECLARATION @@ -66,6 +67,4 @@ class CatM1ConnectionHandler : public ConnectionHandler GSMClient _gsm_client; }; -#endif /* #ifdef BOARD_HAS_CATM1_NBIOT */ - #endif /* #ifndef ARDUINO_CATM1_CONNECTION_HANDLER_H_ */ diff --git a/src/Arduino_CellularConnectionHandler.cpp b/src/Arduino_CellularConnectionHandler.cpp index 7e543b0e..ff7111c7 100644 --- a/src/Arduino_CellularConnectionHandler.cpp +++ b/src/Arduino_CellularConnectionHandler.cpp @@ -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 diff --git a/src/Arduino_CellularConnectionHandler.h b/src/Arduino_CellularConnectionHandler.h index 0c4d5f89..8515fa99 100644 --- a/src/Arduino_CellularConnectionHandler.h +++ b/src/Arduino_CellularConnectionHandler.h @@ -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 +#endif + class CellularConnectionHandler : public ConnectionHandler { public: @@ -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_ */ diff --git a/src/Arduino_ConnectionHandlerDefinitions.h b/src/Arduino_ConnectionHandlerDefinitions.h index 74212d3e..3fdde169 100644 --- a/src/Arduino_ConnectionHandlerDefinitions.h +++ b/src/Arduino_ConnectionHandlerDefinitions.h @@ -162,7 +162,8 @@ enum class NetworkAdapter { NB, GSM, LORA, - CATM1 + CATM1, + CELL }; /****************************************************************************** diff --git a/src/Arduino_EthernetConnectionHandler.cpp b/src/Arduino_EthernetConnectionHandler.cpp index 0fa2e254..52254501 100644 --- a/src/Arduino_EthernetConnectionHandler.cpp +++ b/src/Arduino_EthernetConnectionHandler.cpp @@ -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 diff --git a/src/Arduino_EthernetConnectionHandler.h b/src/Arduino_EthernetConnectionHandler.h index cc22bfee..29dde2fa 100644 --- a/src/Arduino_EthernetConnectionHandler.h +++ b/src/Arduino_EthernetConnectionHandler.h @@ -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 + #include +#elif defined(ARDUINO_PORTENTA_C33) + #include + #include +#elif defined(ARDUINO_OPTA) + #include + #include +#endif /****************************************************************************** CLASS DECLARATION @@ -64,6 +73,4 @@ class EthernetConnectionHandler : public ConnectionHandler }; -#endif /* #ifdef BOARD_HAS_ETHERNET */ - #endif /* ARDUINO_ETHERNET_CONNECTION_HANDLER_H_ */ diff --git a/src/Arduino_GSMConnectionHandler.cpp b/src/Arduino_GSMConnectionHandler.cpp index e57a7201..684abdee 100644 --- a/src/Arduino_GSMConnectionHandler.cpp +++ b/src/Arduino_GSMConnectionHandler.cpp @@ -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 diff --git a/src/Arduino_GSMConnectionHandler.h b/src/Arduino_GSMConnectionHandler.h index 714ed8c5..c2d2b053 100644 --- a/src/Arduino_GSMConnectionHandler.h +++ b/src/Arduino_GSMConnectionHandler.h @@ -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 +#endif /****************************************************************************** CLASS DECLARATION @@ -65,6 +66,4 @@ class GSMConnectionHandler : public ConnectionHandler GSMClient _gsm_client; }; -#endif /* #ifdef BOARD_HAS_GSM */ - #endif /* #ifndef GSM_CONNECTION_MANAGER_H_ */ diff --git a/src/Arduino_LoRaConnectionHandler.cpp b/src/Arduino_LoRaConnectionHandler.cpp index cf1deaf0..2f94910b 100644 --- a/src/Arduino_LoRaConnectionHandler.cpp +++ b/src/Arduino_LoRaConnectionHandler.cpp @@ -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 diff --git a/src/Arduino_LoRaConnectionHandler.h b/src/Arduino_LoRaConnectionHandler.h index aa769ab5..fb0f560b 100644 --- a/src/Arduino_LoRaConnectionHandler.h +++ b/src/Arduino_LoRaConnectionHandler.h @@ -22,7 +22,11 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandler.h" +#include "Arduino_ConnectionHandlerInterface.h" + +#if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) + #include +#endif #ifdef BOARD_HAS_LORA /* Only compile if the board has LoRa */ diff --git a/src/Arduino_NBConnectionHandler.cpp b/src/Arduino_NBConnectionHandler.cpp index 344e104f..a06fb797 100644 --- a/src/Arduino_NBConnectionHandler.cpp +++ b/src/Arduino_NBConnectionHandler.cpp @@ -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 diff --git a/src/Arduino_NBConnectionHandler.h b/src/Arduino_NBConnectionHandler.h index 53d2174e..0a7ec8ad 100644 --- a/src/Arduino_NBConnectionHandler.h +++ b/src/Arduino_NBConnectionHandler.h @@ -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 +#endif /****************************************************************************** CLASS DECLARATION @@ -68,6 +70,4 @@ class NBConnectionHandler : public ConnectionHandler NBClient _nb_client; }; -#endif /* #ifdef BOARD_HAS_NB */ - #endif /* #ifndef NB_CONNECTION_MANAGER_H_ */ diff --git a/src/Arduino_WiFiConnectionHandler.cpp b/src/Arduino_WiFiConnectionHandler.cpp index 902b53f0..34ed664d 100644 --- a/src/Arduino_WiFiConnectionHandler.cpp +++ b/src/Arduino_WiFiConnectionHandler.cpp @@ -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 @@ -143,7 +144,7 @@ NetworkConnectionState WiFiConnectionHandler::update_handleConnected() Debug.print(DBG_INFO, F("Attempting reconnection")); #endif } - + return NetworkConnectionState::DISCONNECTED; } return NetworkConnectionState::CONNECTED; diff --git a/src/Arduino_WiFiConnectionHandler.h b/src/Arduino_WiFiConnectionHandler.h index bf16fa06..e7621e57 100644 --- a/src/Arduino_WiFiConnectionHandler.h +++ b/src/Arduino_WiFiConnectionHandler.h @@ -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 + #include +#elif defined(ARDUINO_SAMD_MKRWIFI1010) || defined(ARDUINO_SAMD_NANO_33_IOT) || \ + defined(ARDUINO_AVR_UNO_WIFI_REV2) || defined (ARDUINO_NANO_RP2040_CONNECT) + #include + #include +#elif defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M7) || \ + defined(ARDUINO_NICLA_VISION) || defined(ARDUINO_OPTA) || defined(ARDUINO_GIGA) + #include + #include +#elif defined(ARDUINO_PORTENTA_C33) + #include + #include +#elif defined(ARDUINO_ARCH_ESP8266) + #include + #include +#elif defined(ARDUINO_ARCH_ESP32) + #include + #include +#elif defined(ARDUINO_UNOR4_WIFI) + #include +#endif /****************************************************************************** CLASS DECLARATION @@ -59,6 +81,4 @@ class WiFiConnectionHandler : public ConnectionHandler WiFiClient _wifi_client; }; -#endif /* #ifdef BOARD_HAS_WIFI */ - #endif /* ARDUINO_WIFI_CONNECTION_HANDLER_H_ */ From 62ad2b83f77b0922e8d76ae9712f7eeb75b9a8ad Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 20 Aug 2024 11:57:43 +0200 Subject: [PATCH 3/4] renaming connection handler implmentation files --- src/Arduino_ConnectionHandler.h | 16 ++++++++-------- ...ionHandler.cpp => CatM1ConnectionHandler.cpp} | 4 ++-- ...nectionHandler.h => CatM1ConnectionHandler.h} | 2 +- ...Handler.cpp => CellularConnectionHandler.cpp} | 4 ++-- ...tionHandler.h => CellularConnectionHandler.h} | 0 ...initions.h => ConnectionHandlerDefinitions.h} | 0 ...erface.cpp => ConnectionHandlerInterface.cpp} | 2 +- ...rInterface.h => ConnectionHandlerInterface.h} | 2 +- ...Handler.cpp => EthernetConnectionHandler.cpp} | 4 ++-- ...tionHandler.h => EthernetConnectionHandler.h} | 2 +- ...ctionHandler.cpp => GSMConnectionHandler.cpp} | 4 ++-- ...onnectionHandler.h => GSMConnectionHandler.h} | 2 +- ...tionHandler.cpp => LoRaConnectionHandler.cpp} | 4 ++-- ...nnectionHandler.h => LoRaConnectionHandler.h} | 2 +- ...ectionHandler.cpp => NBConnectionHandler.cpp} | 4 ++-- ...ConnectionHandler.h => NBConnectionHandler.h} | 2 +- ...tionHandler.cpp => WiFiConnectionHandler.cpp} | 4 ++-- ...nnectionHandler.h => WiFiConnectionHandler.h} | 2 +- 18 files changed, 30 insertions(+), 30 deletions(-) rename src/{Arduino_CatM1ConnectionHandler.cpp => CatM1ConnectionHandler.cpp} (97%) rename src/{Arduino_CatM1ConnectionHandler.h => CatM1ConnectionHandler.h} (98%) rename src/{Arduino_CellularConnectionHandler.cpp => CellularConnectionHandler.cpp} (96%) rename src/{Arduino_CellularConnectionHandler.h => CellularConnectionHandler.h} (100%) rename src/{Arduino_ConnectionHandlerDefinitions.h => ConnectionHandlerDefinitions.h} (100%) rename src/{Arduino_ConnectionHandlerInterface.cpp => ConnectionHandlerInterface.cpp} (99%) rename src/{Arduino_ConnectionHandlerInterface.h => ConnectionHandlerInterface.h} (98%) rename src/{Arduino_EthernetConnectionHandler.cpp => EthernetConnectionHandler.cpp} (97%) rename src/{Arduino_EthernetConnectionHandler.h => EthernetConnectionHandler.h} (98%) rename src/{Arduino_GSMConnectionHandler.cpp => GSMConnectionHandler.cpp} (98%) rename src/{Arduino_GSMConnectionHandler.h => GSMConnectionHandler.h} (97%) rename src/{Arduino_LoRaConnectionHandler.cpp => LoRaConnectionHandler.cpp} (98%) rename src/{Arduino_LoRaConnectionHandler.h => LoRaConnectionHandler.h} (98%) rename src/{Arduino_NBConnectionHandler.cpp => NBConnectionHandler.cpp} (98%) rename src/{Arduino_NBConnectionHandler.h => NBConnectionHandler.h} (98%) rename src/{Arduino_WiFiConnectionHandler.cpp => WiFiConnectionHandler.cpp} (98%) rename src/{Arduino_WiFiConnectionHandler.h => WiFiConnectionHandler.h} (98%) diff --git a/src/Arduino_ConnectionHandler.h b/src/Arduino_ConnectionHandler.h index ee79dc3a..bb4c0e64 100644 --- a/src/Arduino_ConnectionHandler.h +++ b/src/Arduino_ConnectionHandler.h @@ -27,34 +27,34 @@ #endif #include -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #if defined(BOARD_HAS_WIFI) - #include "Arduino_WiFiConnectionHandler.h" + #include "WiFiConnectionHandler.h" #endif #if defined(BOARD_HAS_GSM) - #include "Arduino_GSMConnectionHandler.h" + #include "GSMConnectionHandler.h" #endif #if defined(BOARD_HAS_NB) - #include "Arduino_NBConnectionHandler.h" + #include "NBConnectionHandler.h" #endif #if defined(BOARD_HAS_LORA) - #include "Arduino_LoRaConnectionHandler.h" + #include "LoRaConnectionHandler.h" #endif #if defined(BOARD_HAS_ETHERNET) - #include "Arduino_EthernetConnectionHandler.h" + #include "EthernetConnectionHandler.h" #endif #if defined(BOARD_HAS_CATM1_NBIOT) - #include "Arduino_CatM1ConnectionHandler.h" + #include "CatM1ConnectionHandler.h" #endif #if defined(BOARD_HAS_CELLULAR) - #include "Arduino_CellularConnectionHandler.h" + #include "CellularConnectionHandler.h" #endif #endif /* CONNECTION_HANDLER_H_ */ diff --git a/src/Arduino_CatM1ConnectionHandler.cpp b/src/CatM1ConnectionHandler.cpp similarity index 97% rename from src/Arduino_CatM1ConnectionHandler.cpp rename to src/CatM1ConnectionHandler.cpp index 46553730..0263a397 100644 --- a/src/Arduino_CatM1ConnectionHandler.cpp +++ b/src/CatM1ConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_CATM1_NBIOT /* Only compile if the board has CatM1 BN-IoT */ -#include "Arduino_CatM1ConnectionHandler.h" +#include "CatM1ConnectionHandler.h" /****************************************************************************** CTOR/DTOR diff --git a/src/Arduino_CatM1ConnectionHandler.h b/src/CatM1ConnectionHandler.h similarity index 98% rename from src/Arduino_CatM1ConnectionHandler.h rename to src/CatM1ConnectionHandler.h index ec6b2633..987230f8 100644 --- a/src/Arduino_CatM1ConnectionHandler.h +++ b/src/CatM1ConnectionHandler.h @@ -22,7 +22,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #if defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_EDGE_CONTROL) #include diff --git a/src/Arduino_CellularConnectionHandler.cpp b/src/CellularConnectionHandler.cpp similarity index 96% rename from src/Arduino_CellularConnectionHandler.cpp rename to src/CellularConnectionHandler.cpp index ff7111c7..2e4499a0 100644 --- a/src/Arduino_CellularConnectionHandler.cpp +++ b/src/CellularConnectionHandler.cpp @@ -13,10 +13,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_CELLULAR /* Only compile if the board has Cellular */ -#include "Arduino_CellularConnectionHandler.h" +#include "CellularConnectionHandler.h" /****************************************************************************** CTOR/DTOR diff --git a/src/Arduino_CellularConnectionHandler.h b/src/CellularConnectionHandler.h similarity index 100% rename from src/Arduino_CellularConnectionHandler.h rename to src/CellularConnectionHandler.h diff --git a/src/Arduino_ConnectionHandlerDefinitions.h b/src/ConnectionHandlerDefinitions.h similarity index 100% rename from src/Arduino_ConnectionHandlerDefinitions.h rename to src/ConnectionHandlerDefinitions.h diff --git a/src/Arduino_ConnectionHandlerInterface.cpp b/src/ConnectionHandlerInterface.cpp similarity index 99% rename from src/Arduino_ConnectionHandlerInterface.cpp rename to src/ConnectionHandlerInterface.cpp index ccfc4df9..2fdc10e1 100644 --- a/src/Arduino_ConnectionHandlerInterface.cpp +++ b/src/ConnectionHandlerInterface.cpp @@ -19,7 +19,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" /****************************************************************************** CONSTRUCTOR/DESTRUCTOR diff --git a/src/Arduino_ConnectionHandlerInterface.h b/src/ConnectionHandlerInterface.h similarity index 98% rename from src/Arduino_ConnectionHandlerInterface.h rename to src/ConnectionHandlerInterface.h index 52a09bd5..94768ea8 100644 --- a/src/Arduino_ConnectionHandlerInterface.h +++ b/src/ConnectionHandlerInterface.h @@ -28,7 +28,7 @@ #include #include #include -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" /****************************************************************************** TYPEDEFS diff --git a/src/Arduino_EthernetConnectionHandler.cpp b/src/EthernetConnectionHandler.cpp similarity index 97% rename from src/Arduino_EthernetConnectionHandler.cpp rename to src/EthernetConnectionHandler.cpp index 52254501..14f7aee4 100644 --- a/src/Arduino_EthernetConnectionHandler.cpp +++ b/src/EthernetConnectionHandler.cpp @@ -16,10 +16,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */ -#include "Arduino_EthernetConnectionHandler.h" +#include "EthernetConnectionHandler.h" /****************************************************************************** CTOR/DTOR diff --git a/src/Arduino_EthernetConnectionHandler.h b/src/EthernetConnectionHandler.h similarity index 98% rename from src/Arduino_EthernetConnectionHandler.h rename to src/EthernetConnectionHandler.h index 29dde2fa..e6f08dd9 100644 --- a/src/Arduino_EthernetConnectionHandler.h +++ b/src/EthernetConnectionHandler.h @@ -19,7 +19,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #if defined(ARDUINO_PORTENTA_H7_M7) #include diff --git a/src/Arduino_GSMConnectionHandler.cpp b/src/GSMConnectionHandler.cpp similarity index 98% rename from src/Arduino_GSMConnectionHandler.cpp rename to src/GSMConnectionHandler.cpp index 684abdee..34bf1792 100644 --- a/src/Arduino_GSMConnectionHandler.cpp +++ b/src/GSMConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */ -#include "Arduino_GSMConnectionHandler.h" +#include "GSMConnectionHandler.h" /****************************************************************************** CONSTANTS diff --git a/src/Arduino_GSMConnectionHandler.h b/src/GSMConnectionHandler.h similarity index 97% rename from src/Arduino_GSMConnectionHandler.h rename to src/GSMConnectionHandler.h index c2d2b053..e524cda5 100644 --- a/src/Arduino_GSMConnectionHandler.h +++ b/src/GSMConnectionHandler.h @@ -22,7 +22,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #if defined(ARDUINO_SAMD_MKRGSM1400) #include diff --git a/src/Arduino_LoRaConnectionHandler.cpp b/src/LoRaConnectionHandler.cpp similarity index 98% rename from src/Arduino_LoRaConnectionHandler.cpp rename to src/LoRaConnectionHandler.cpp index 2f94910b..1f454a51 100644 --- a/src/Arduino_LoRaConnectionHandler.cpp +++ b/src/LoRaConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #if defined(BOARD_HAS_LORA) /* Only compile if the board has LoRa */ -#include "Arduino_LoRaConnectionHandler.h" +#include "LoRaConnectionHandler.h" /****************************************************************************** TYPEDEF diff --git a/src/Arduino_LoRaConnectionHandler.h b/src/LoRaConnectionHandler.h similarity index 98% rename from src/Arduino_LoRaConnectionHandler.h rename to src/LoRaConnectionHandler.h index fb0f560b..828fec2c 100644 --- a/src/Arduino_LoRaConnectionHandler.h +++ b/src/LoRaConnectionHandler.h @@ -22,7 +22,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #if defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) #include diff --git a/src/Arduino_NBConnectionHandler.cpp b/src/NBConnectionHandler.cpp similarity index 98% rename from src/Arduino_NBConnectionHandler.cpp rename to src/NBConnectionHandler.cpp index a06fb797..eb72f3e7 100644 --- a/src/Arduino_NBConnectionHandler.cpp +++ b/src/NBConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_NB /* Only compile if this is a board with NB */ -#include "Arduino_NBConnectionHandler.h" +#include "NBConnectionHandler.h" /****************************************************************************** CONSTANTS diff --git a/src/Arduino_NBConnectionHandler.h b/src/NBConnectionHandler.h similarity index 98% rename from src/Arduino_NBConnectionHandler.h rename to src/NBConnectionHandler.h index 0a7ec8ad..ddda333b 100644 --- a/src/Arduino_NBConnectionHandler.h +++ b/src/NBConnectionHandler.h @@ -22,7 +22,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #ifdef ARDUINO_SAMD_MKRNB1500 #include diff --git a/src/Arduino_WiFiConnectionHandler.cpp b/src/WiFiConnectionHandler.cpp similarity index 98% rename from src/Arduino_WiFiConnectionHandler.cpp rename to src/WiFiConnectionHandler.cpp index 34ed664d..0cd2e126 100644 --- a/src/Arduino_WiFiConnectionHandler.cpp +++ b/src/WiFiConnectionHandler.cpp @@ -19,10 +19,10 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerDefinitions.h" +#include "ConnectionHandlerDefinitions.h" #ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */ -#include "Arduino_WiFiConnectionHandler.h" +#include "WiFiConnectionHandler.h" /****************************************************************************** CONSTANTS diff --git a/src/Arduino_WiFiConnectionHandler.h b/src/WiFiConnectionHandler.h similarity index 98% rename from src/Arduino_WiFiConnectionHandler.h rename to src/WiFiConnectionHandler.h index e7621e57..88a1e460 100644 --- a/src/Arduino_WiFiConnectionHandler.h +++ b/src/WiFiConnectionHandler.h @@ -22,7 +22,7 @@ INCLUDE ******************************************************************************/ -#include "Arduino_ConnectionHandlerInterface.h" +#include "ConnectionHandlerInterface.h" #ifdef ARDUINO_SAMD_MKR1000 #include From bc9691b38519ec1031109958442944d773e3cd04 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Tue, 20 Aug 2024 14:32:38 +0200 Subject: [PATCH 4/4] added error when compiling unsupported connection handler --- src/CatM1ConnectionHandler.h | 4 ++++ src/CellularConnectionHandler.h | 4 ++++ src/EthernetConnectionHandler.h | 4 ++++ src/GSMConnectionHandler.h | 4 ++++ src/LoRaConnectionHandler.h | 7 ++++--- src/NBConnectionHandler.h | 4 ++++ src/WiFiConnectionHandler.h | 4 ++++ 7 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/CatM1ConnectionHandler.h b/src/CatM1ConnectionHandler.h index 987230f8..33ac9fea 100644 --- a/src/CatM1ConnectionHandler.h +++ b/src/CatM1ConnectionHandler.h @@ -28,6 +28,10 @@ #include #endif +#ifndef BOARD_HAS_CATM1_NBIOT + #error "Board doesn't support CATM1_NBIOT" +#endif + /****************************************************************************** CLASS DECLARATION ******************************************************************************/ diff --git a/src/CellularConnectionHandler.h b/src/CellularConnectionHandler.h index 8515fa99..048c9f74 100644 --- a/src/CellularConnectionHandler.h +++ b/src/CellularConnectionHandler.h @@ -27,6 +27,10 @@ #include #endif +#ifndef BOARD_HAS_CELLULAR + #error "Board doesn't support CELLULAR" +#endif + class CellularConnectionHandler : public ConnectionHandler { public: diff --git a/src/EthernetConnectionHandler.h b/src/EthernetConnectionHandler.h index e6f08dd9..35a02cd9 100644 --- a/src/EthernetConnectionHandler.h +++ b/src/EthernetConnectionHandler.h @@ -32,6 +32,10 @@ #include #endif +#ifndef BOARD_HAS_ETHERNET + #error "Board doesn't support ETHERNET" +#endif + /****************************************************************************** CLASS DECLARATION ******************************************************************************/ diff --git a/src/GSMConnectionHandler.h b/src/GSMConnectionHandler.h index e524cda5..1f3db49a 100644 --- a/src/GSMConnectionHandler.h +++ b/src/GSMConnectionHandler.h @@ -28,6 +28,10 @@ #include #endif +#ifndef BOARD_HAS_GSM + #error "Board doesn't support GSM" +#endif + /****************************************************************************** CLASS DECLARATION ******************************************************************************/ diff --git a/src/LoRaConnectionHandler.h b/src/LoRaConnectionHandler.h index 828fec2c..3ddcca24 100644 --- a/src/LoRaConnectionHandler.h +++ b/src/LoRaConnectionHandler.h @@ -28,7 +28,10 @@ #include #endif -#ifdef BOARD_HAS_LORA /* Only compile if the board has LoRa */ +#ifndef BOARD_HAS_LORA + #error "Board doesn't support LORA" +#endif + /****************************************************************************** CLASS DECLARATION @@ -78,6 +81,4 @@ class LoRaConnectionHandler : public ConnectionHandler LoRaModem _modem; }; -#endif /* #ifdef BOARD_HAS_LORA */ - #endif /* ARDUINO_LORA_CONNECTION_HANDLER_H_ */ diff --git a/src/NBConnectionHandler.h b/src/NBConnectionHandler.h index ddda333b..fd2afb6c 100644 --- a/src/NBConnectionHandler.h +++ b/src/NBConnectionHandler.h @@ -28,6 +28,10 @@ #include #endif +#ifndef BOARD_HAS_NB + #error "Board doesn't support NB" +#endif + /****************************************************************************** CLASS DECLARATION ******************************************************************************/ diff --git a/src/WiFiConnectionHandler.h b/src/WiFiConnectionHandler.h index 88a1e460..e5e2e25d 100644 --- a/src/WiFiConnectionHandler.h +++ b/src/WiFiConnectionHandler.h @@ -48,6 +48,10 @@ #include #endif +#ifndef BOARD_HAS_WIFI + #error "Board doesn't support WIFI" +#endif + /****************************************************************************** CLASS DECLARATION ******************************************************************************/