Skip to content

Commit d0a724d

Browse files
committed
Prevent compilation of the other ConnectionManagers if the associates boards/capabilities are not present
1 parent 9ff1b4c commit d0a724d

6 files changed

+26
-1
lines changed

src/EthernetConnectionManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "EthernetConnectionManager.h"
2323

24+
#ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */
25+
2426
/******************************************************************************
2527
* CONSTANTS
2628
******************************************************************************/
@@ -187,3 +189,5 @@ void EthConnectionManager::changeConnectionState(NetworkConnectionState _newStat
187189
connectionTickTimeInterval = newInterval;
188190
lastConnectionTickTime = millis();
189191
}
192+
193+
#endif /* #ifdef BOARD_HAS_ETHERNET */

src/EthernetConnectionManager.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424

2525
#include "ConnectionManager.h"
2626

27+
#define BOARD_HAS_ETHERNET /* FIXME - In current implementation this define is always set -> the compilation is always enabled - is this really necessary? */
28+
29+
#ifdef BOARD_HAS_ETHERNET /* Only compile if the board has ethernet */
2730
#include <Ethernet.h>
28-
#define BOARD_HAS_ETHERNET
2931

3032
/******************************************************************************
3133
* CLASS DECLARATION
@@ -62,4 +64,6 @@ class EthConnectionManager : public ConnectionManager {
6264
int connectionTickTimeInterval;
6365
};
6466

67+
#endif /* #ifdef BOARD_HAS_ETHERNET */
68+
6569
#endif

src/GSMConnectionManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "GSMConnectionManager.h"
2323

24+
#ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */
25+
2426
/******************************************************************************
2527
* CONSTANTS
2628
******************************************************************************/
@@ -175,3 +177,5 @@ void GSMConnectionManager::changeConnectionState(NetworkConnectionState _newStat
175177
lastConnectionTickTime = millis();
176178
netConnectionState = _newState;
177179
}
180+
181+
#endif /* #ifdef BOARD_HAS_GSM */

src/GSMConnectionManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "ConnectionManager.h"
2626

27+
#ifdef BOARD_HAS_GSM /* Only compile if this is a board with GSM */
28+
2729
/******************************************************************************
2830
* CLASS DECLARATION
2931
******************************************************************************/
@@ -65,4 +67,6 @@ class GSMConnectionManager : public ConnectionManager {
6567

6668
};
6769

70+
#endif /* #ifdef BOARD_HAS_GSM */
71+
6872
#endif /* GSM_CONNECTION_MANAGER_H_ */

src/WiFiConnectionManager.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "WiFiConnectionManager.h"
2323

24+
#ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */
25+
2426
/******************************************************************************
2527
* CONSTANTS
2628
******************************************************************************/
@@ -172,3 +174,5 @@ void WiFiConnectionManager::changeConnectionState(NetworkConnectionState _newSta
172174
lastConnectionTickTime = millis();
173175
netConnectionState = _newState;
174176
}
177+
178+
#endif /* #ifdef BOARD_HAS_WIFI */

src/WiFiConnectionManager.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
******************************************************************************/
2424

2525
#include "ConnectionManager.h"
26+
27+
#ifdef BOARD_HAS_WIFI /* Only compile if the board has WiFi */
28+
2629
#include <WiFiUdp.h>
2730

2831
/******************************************************************************
@@ -64,4 +67,6 @@ class WiFiConnectionManager : public ConnectionManager {
6467
int connectionTickTimeInterval;
6568
};
6669

70+
#endif /* #ifdef BOARD_HAS_WIFI */
71+
6772
#endif /* WIFI_CONNECTION_MANAGER_H_ */

0 commit comments

Comments
 (0)