From 75a57ad7977c2a6fe4c4b7d30bdb4f627a1243c0 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 4 Aug 2016 11:07:33 -0500 Subject: [PATCH 1/2] Exposed the network-socket API through mbed.h Currently this uses the same mechanism used by the rtos to conditionally include the network-socket API. Perhaps this should be builtin to the config system? Note: this does require that the bug-compatible inclusion of mbed.h be removed to avoid include-order issues. per @sg- --- features/net/network-socket/Socket.cpp | 1 + features/net/network-socket/Socket.h | 4 ---- features/net/network-socket/TCPServer.cpp | 2 +- features/net/network-socket/mbed_lib.json | 6 ++++++ features/net/network-socket/nsapi.h | 3 --- hal/api/mbed.h | 4 ++++ 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 features/net/network-socket/mbed_lib.json diff --git a/features/net/network-socket/Socket.cpp b/features/net/network-socket/Socket.cpp index c9be8921b1..7429144a39 100644 --- a/features/net/network-socket/Socket.cpp +++ b/features/net/network-socket/Socket.cpp @@ -15,6 +15,7 @@ */ #include "Socket.h" +#include "mbed.h" Socket::Socket() : _stack(0) diff --git a/features/net/network-socket/Socket.h b/features/net/network-socket/Socket.h index 35dfe0865b..c481930440 100644 --- a/features/net/network-socket/Socket.h +++ b/features/net/network-socket/Socket.h @@ -22,10 +22,6 @@ #include "rtos/Mutex.h" #include "Callback.h" -#ifndef NSAPI_NO_INCLUDE_MBED -#include "mbed.h" // needed for backwards compatability -#endif - /** Abstract socket class */ diff --git a/features/net/network-socket/TCPServer.cpp b/features/net/network-socket/TCPServer.cpp index 888b91b229..c3c23b0bcd 100644 --- a/features/net/network-socket/TCPServer.cpp +++ b/features/net/network-socket/TCPServer.cpp @@ -15,7 +15,7 @@ */ #include "TCPServer.h" -#include "Timer.h" +#include "mbed.h" TCPServer::TCPServer() : _pending(0), _accept_sem(0) diff --git a/features/net/network-socket/mbed_lib.json b/features/net/network-socket/mbed_lib.json new file mode 100644 index 0000000000..35edcf1017 --- /dev/null +++ b/features/net/network-socket/mbed_lib.json @@ -0,0 +1,6 @@ +{ + "name": "nsapi", + "config": { + "present": 1 + } +} diff --git a/features/net/network-socket/nsapi.h b/features/net/network-socket/nsapi.h index 35fd3a1b9f..d61fb5502c 100644 --- a/features/net/network-socket/nsapi.h +++ b/features/net/network-socket/nsapi.h @@ -21,9 +21,6 @@ // entry point for nsapi types #include "nsapi_types.h" -// disable bug-compatible mbed inclusion -#define NSAPI_NO_INCLUDE_MBED - #ifdef __cplusplus // entry point for C++ api diff --git a/hal/api/mbed.h b/hal/api/mbed.h index 3fac4c47ef..743438cf2c 100644 --- a/hal/api/mbed.h +++ b/hal/api/mbed.h @@ -22,6 +22,10 @@ #include "rtos/rtos.h" #endif +#if MBED_CONF_NSAPI_PRESENT +#include "network-socket/nsapi.h" +#endif + #include "toolchain.h" #include "platform.h" From a7d6aa59535021060e4eb4e1fdfe5c6d4381cb69 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Thu, 4 Aug 2016 17:47:30 -0500 Subject: [PATCH 2/2] Fixed indirect-dependency of mbed-client-classic through Socket.h Before: m2mconnectionhandlerpimpl.cpp -> Socket.h -> mbed.h Now: m2mconnectionhandlerpimpl.cpp -> mbed.h --- .../mbed-client-classic/source/m2mconnectionhandlerpimpl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/features/FEATURE_CLIENT/mbed-client-classic/source/m2mconnectionhandlerpimpl.cpp b/features/FEATURE_CLIENT/mbed-client-classic/source/m2mconnectionhandlerpimpl.cpp index 5703d82701..2b4f5a708a 100644 --- a/features/FEATURE_CLIENT/mbed-client-classic/source/m2mconnectionhandlerpimpl.cpp +++ b/features/FEATURE_CLIENT/mbed-client-classic/source/m2mconnectionhandlerpimpl.cpp @@ -27,6 +27,7 @@ #include "eventOS_scheduler.h" #include "mbed-trace/mbed_trace.h" +#include "mbed.h" #define TRACE_GROUP "mClt"