mirror of https://github.com/ARMmbed/mbed-os.git
Remove Cellular dependency in netsocket
Tip: Create a .mbedignore file with connectivity/cellular* connectivity/drivers/cellular*pull/13809/head
parent
f2278567d0
commit
8e58d64e13
|
@ -52,3 +52,13 @@ Cellular connectivity can be tested with generic Mbed OS netsocket and network i
|
|||
## Unit tests
|
||||
|
||||
Cellular unit tests are in Mbed OS root `UNITTESTS/connectivity/cellular`.
|
||||
|
||||
## Dependency with netsocket
|
||||
|
||||
If you create a .mbedignore file with
|
||||
```
|
||||
connectivity/cellular*
|
||||
connectivity/drivers/cellular*
|
||||
```
|
||||
|
||||
MBED_CONF_CELLULAR_PRESENT will not be set
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"name": "cellular",
|
||||
"config": {
|
||||
"present": {
|
||||
"help": "MBED_CONF_CELLULAR_PRESENT will be defined if cellular is used",
|
||||
"value": 1
|
||||
},
|
||||
"use-apn-lookup": {
|
||||
"help": "Use APN database lookup",
|
||||
"value": false
|
||||
|
|
|
@ -34,7 +34,9 @@
|
|||
#include "netsocket/NetworkInterface.h"
|
||||
#include "netsocket/EthInterface.h"
|
||||
#include "netsocket/WiFiInterface.h"
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
#include "netsocket/CellularInterface.h"
|
||||
#endif
|
||||
#include "netsocket/MeshInterface.h"
|
||||
|
||||
#include "netsocket/Socket.h"
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
|
||||
#include "platform/Callback.h"
|
||||
#include "netsocket/CellularNonIPSocket.h"
|
||||
#include <stdio.h>
|
||||
|
@ -267,3 +269,5 @@ nsapi_error_t CellularNonIPSocket::bind(const SocketAddress &address)
|
|||
{
|
||||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
|
||||
#include "netsocket/EthInterface.h"
|
||||
#include "netsocket/WiFiInterface.h"
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
#include "netsocket/CellularInterface.h"
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
#include "netsocket/MeshInterface.h"
|
||||
|
||||
/* Weak default instance static classes for the various abstract classes.
|
||||
|
@ -41,10 +43,12 @@ MBED_WEAK MeshInterface *MeshInterface::get_default_instance()
|
|||
return get_target_default_instance();
|
||||
}
|
||||
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
MBED_WEAK CellularInterface *CellularInterface::get_default_instance()
|
||||
{
|
||||
return get_target_default_instance();
|
||||
}
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
|
||||
/* For other types, we can provide a reasonable get_target_default_instance
|
||||
* in some cases. This is done in EthernetInterface.cpp, mbed-mesh-api and
|
||||
|
@ -88,6 +92,7 @@ void WiFiInterface::set_default_parameters()
|
|||
#endif
|
||||
}
|
||||
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
void CellularInterface::set_default_parameters()
|
||||
{
|
||||
/* CellularInterface is expected to attempt to work without any parameters - we
|
||||
|
@ -109,6 +114,7 @@ void CellularInterface::set_default_parameters()
|
|||
set_plmn(MBED_CONF_NSAPI_DEFAULT_CELLULAR_PLMN);
|
||||
#endif
|
||||
}
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
|
||||
/* Finally the dispatch from the JSON default interface type to the specific
|
||||
* subclasses. It's our job to configure - the default NetworkInterface is
|
||||
|
@ -147,6 +153,7 @@ MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
|
|||
return MeshInterface::get_default_instance();
|
||||
}
|
||||
#elif MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == CELLULAR
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
|
||||
{
|
||||
CellularInterface *cellular = CellularInterface::get_default_instance();
|
||||
|
@ -156,6 +163,7 @@ MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
|
|||
cellular->set_default_parameters();
|
||||
return cellular;
|
||||
}
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
#elif defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE)
|
||||
/* If anyone invents a new JSON value, they must have their own default weak
|
||||
* implementation.
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#include "unity/unity.h"
|
||||
#include "utest.h"
|
||||
#include "tcp_tests.h"
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
#include "CellularDevice.h"
|
||||
#endif
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
#include "utest/utest_stack_trace.h"
|
||||
#include "tls_tests.h"
|
||||
#include "cert.h"
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
#include "CellularDevice.h"
|
||||
#endif
|
||||
#include "ip6string.h"
|
||||
|
||||
#ifndef ECHO_SERVER_ADDR
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
#include "unity/unity.h"
|
||||
#include "utest.h"
|
||||
#include "udp_tests.h"
|
||||
#ifdef MBED_CONF_APP_BAUD_RATE
|
||||
#include "CellularDevice.h"
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue