mirror of https://github.com/ARMmbed/mbed-os.git
Fix CellularInterface functions never being defined (#307)
* Fix several link errors with mbed-cellular * Fix unittest failure * Try again to fix unit tests? * OK try and fix these a little better * Fix stylepull/15530/head
parent
eb0012983a
commit
5a118826a8
|
@ -25,6 +25,28 @@ MBED_WEAK CellularInterface *CellularInterface::get_target_default_instance()
|
|||
return mbed::CellularContext::get_default_instance();
|
||||
}
|
||||
|
||||
void CellularInterface::set_default_parameters()
|
||||
{
|
||||
/* CellularInterface is expected to attempt to work without any parameters - we
|
||||
* will try, at least.
|
||||
*/
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN
|
||||
#ifndef MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME
|
||||
#define MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME NULL
|
||||
#endif
|
||||
#ifndef MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD
|
||||
#define MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD NULL
|
||||
#endif
|
||||
set_credentials(MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN, MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME, MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD);
|
||||
#endif
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_SIM_PIN
|
||||
set_sim_pin(MBED_CONF_NSAPI_DEFAULT_CELLULAR_SIM_PIN);
|
||||
#endif
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_PLMN
|
||||
set_plmn(MBED_CONF_NSAPI_DEFAULT_CELLULAR_PLMN);
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace mbed {
|
||||
|
||||
MBED_WEAK CellularContext *CellularContext::get_default_instance()
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
*/
|
||||
|
||||
#include "CellularContext.h"
|
||||
#include "netsocket/CellularInterface.h"
|
||||
|
||||
void CellularInterface::set_default_parameters()
|
||||
{
|
||||
}
|
||||
|
||||
namespace mbed {
|
||||
|
||||
|
|
|
@ -403,12 +403,12 @@ void mbedtls_ssl_conf_dtls_cookies(mbedtls_ssl_config *conf,
|
|||
void *p_cookie)
|
||||
{
|
||||
if (mbedtls_stub.cookie_obj && f_cookie_check && mbedtls_stub.cookie_len > 0) {
|
||||
f_cookie_check(mbedtls_stub.cookie_obj, &mbedtls_stub.cookie_value, mbedtls_stub.cookie_len, NULL, 0);
|
||||
f_cookie_check(mbedtls_stub.cookie_obj, mbedtls_stub.cookie_value, mbedtls_stub.cookie_len, NULL, 0);
|
||||
}
|
||||
if (mbedtls_stub.cookie_obj && f_cookie_write && mbedtls_stub.cookie_len > 0) {
|
||||
unsigned char out[16];
|
||||
unsigned char *ptr = &out;
|
||||
f_cookie_write(mbedtls_stub.cookie_obj, &ptr, ptr + mbedtls_stub.cookie_len, NULL, 0);
|
||||
unsigned char *ptr = out;
|
||||
f_cookie_write(mbedtls_stub.cookie_obj, &ptr, out + mbedtls_stub.cookie_len, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,9 +420,9 @@ void mbedtls_ssl_conf_export_keys_cb(mbedtls_ssl_config *conf,
|
|||
if (f_export_keys && p_export_keys) {
|
||||
unsigned char value[40];
|
||||
memset(&value, 1, 40);
|
||||
f_export_keys(p_export_keys, &value, "", 0, 0, 0); //failure case
|
||||
f_export_keys(p_export_keys, value, "", 0, 0, 0); //failure case
|
||||
|
||||
f_export_keys(p_export_keys, &value, "", 0, 20, 0); //success case
|
||||
f_export_keys(p_export_keys, value, "", 0, 20, 0); //success case
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -64,6 +64,11 @@ elseif("MBED_CONF_NSAPI_DEFAULT_STACK=NANOSTACK" IN_LIST MBED_CONFIG_DEFINITIONS
|
|||
target_link_libraries(mbed-netsocket-api PUBLIC mbed-nanostack)
|
||||
endif()
|
||||
|
||||
# Pull in cellular if cellular is the default network interface (used by NetworkInterfaceDefaults.cpp)
|
||||
if("MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE=CELLULAR" IN_LIST MBED_CONFIG_DEFINITIONS)
|
||||
target_link_libraries(mbed-netsocket-api PUBLIC mbed-cellular)
|
||||
endif()
|
||||
|
||||
if("DEVICE_EMAC=1" IN_LIST MBED_TARGET_DEFINITIONS)
|
||||
target_link_libraries(mbed-netsocket-api
|
||||
INTERFACE
|
||||
|
|
|
@ -43,13 +43,6 @@ 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
|
||||
* OnboardCellularInterface.cpp. We have no implementation for WiFi, so a
|
||||
|
@ -92,30 +85,6 @@ 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
|
||||
* will try, at least.
|
||||
*/
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN
|
||||
#ifndef MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME
|
||||
#define MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME NULL
|
||||
#endif
|
||||
#ifndef MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD
|
||||
#define MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD NULL
|
||||
#endif
|
||||
set_credentials(MBED_CONF_NSAPI_DEFAULT_CELLULAR_APN, MBED_CONF_NSAPI_DEFAULT_CELLULAR_USERNAME, MBED_CONF_NSAPI_DEFAULT_CELLULAR_PASSWORD);
|
||||
#endif
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_SIM_PIN
|
||||
set_sim_pin(MBED_CONF_NSAPI_DEFAULT_CELLULAR_SIM_PIN);
|
||||
#endif
|
||||
#ifdef MBED_CONF_NSAPI_DEFAULT_CELLULAR_PLMN
|
||||
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
|
||||
* preconfigured - the specific subtypes' defaults are not (necessarily).
|
||||
|
|
|
@ -52,10 +52,6 @@ void WiFiInterface::set_default_parameters()
|
|||
{
|
||||
}
|
||||
|
||||
void CellularInterface::set_default_parameters()
|
||||
{
|
||||
}
|
||||
|
||||
MBED_WEAK NetworkInterface *NetworkInterface::get_target_default_instance()
|
||||
{
|
||||
return NULL;
|
||||
|
|
|
@ -56,6 +56,16 @@ class Config(UserDict):
|
|||
"Please check your target_overrides are correct.\n"
|
||||
f"The parameter `{override.namespace}.{override.name}` will not be added to the configuration."
|
||||
)
|
||||
|
||||
valid_params_in_namespace = list(filter(
|
||||
lambda x: x.namespace == override.namespace,
|
||||
self.data.get(CONFIG_SECTION, []),
|
||||
))
|
||||
valid_param_names = [f'"{param.namespace}.{param.name}"' for param in valid_params_in_namespace]
|
||||
|
||||
if len(valid_param_names) > 0:
|
||||
logger.warning(f'Valid config parameters in this namespace are: {", ".join(valid_param_names)}. '
|
||||
f'Maybe you meant one of those?')
|
||||
else:
|
||||
setting.value = override.value
|
||||
|
||||
|
|
Loading…
Reference in New Issue