diff --git a/features/cellular/TESTS/api/cellular_device/main.cpp b/features/cellular/TESTS/api/cellular_device/main.cpp index c2a7861f30..f300fa677a 100644 --- a/features/cellular/TESTS/api/cellular_device/main.cpp +++ b/features/cellular/TESTS/api/cellular_device/main.cpp @@ -19,13 +19,6 @@ #error [NOT_SUPPORTED] A json configuration file is needed. Skipping this build. #endif -#include "CellularUtil.h" // for CELLULAR_ helper macros -#include "CellularTargets.h" - -#ifndef CELLULAR_DEVICE -#error [NOT_SUPPORTED] CELLULAR_DEVICE must be defined -#endif - #ifndef MBED_CONF_APP_CELLULAR_SIM_PIN #error [NOT_SUPPORTED] SIM pin code is needed. Skipping this build. #endif @@ -38,11 +31,9 @@ #include "CellularLog.h" #include "CellularDevice.h" -#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h) #include "Semaphore.h" #include "../../cellular_tests_common.h" -static UARTSerial cellular_serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE); static CellularDevice *device; static rtos::Semaphore semaphore; @@ -60,21 +51,21 @@ static CurrentOp op; static void create_device() { - device = new CELLULAR_DEVICE(&cellular_serial); + device = CellularDevice::get_default_instance(); TEST_ASSERT(device != NULL); } static void open_close_interfaces() { - CellularNetwork *nw = device->open_network(&cellular_serial); + CellularNetwork *nw = device->open_network(); TEST_ASSERT(nw != NULL); device->close_network(); - CellularInformation *info = device->open_information(&cellular_serial); + CellularInformation *info = device->open_information(); TEST_ASSERT(info != NULL); device->close_information(); - CellularSMS *sms = device->open_sms(&cellular_serial); + CellularSMS *sms = device->open_sms(); TEST_ASSERT(sms != NULL); device->close_sms(); @@ -91,7 +82,7 @@ static void other_methods() device->modem_debug_on(true); device->modem_debug_on(false); - CellularNetwork *nw = device->open_network(&cellular_serial); + CellularNetwork *nw = device->open_network(); TEST_ASSERT(nw != NULL); // then test with open interface which is called @@ -100,21 +91,17 @@ static void other_methods() device->modem_debug_on(false); TEST_ASSERT(device->get_queue() != NULL); - TEST_ASSERT_EQUAL_INT(device->init_module(), NSAPI_ERROR_OK); + TEST_ASSERT(device->hard_power_on() == NSAPI_ERROR_OK); + TEST_ASSERT(device->soft_power_on() == NSAPI_ERROR_OK); + wait(5); + TEST_ASSERT_EQUAL_INT(device->init(), NSAPI_ERROR_OK); } -static void shutdown_reset() +static void shutdown() { - TEST_ASSERT(device->set_device_ready() == NSAPI_ERROR_OK); TEST_ASSERT(device->shutdown() == NSAPI_ERROR_OK); - TEST_ASSERT(device->set_device_ready() == NSAPI_ERROR_OK); -} - -static void delete_device() -{ - // delete will close all opened interfaces - delete device; - device = NULL; + TEST_ASSERT(device->soft_power_off() == NSAPI_ERROR_OK); + TEST_ASSERT(device->hard_power_off() == NSAPI_ERROR_OK); } static void callback_func(nsapi_event_t ev, intptr_t ptr) @@ -155,7 +142,9 @@ static void init_to_device_ready_state() device->attach(&callback_func); op = OP_DEVICE_READY; - TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->init_module()); + TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->hard_power_on()); + TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->soft_power_on()); + TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->init()); TEST_ASSERT_EQUAL_INT(NSAPI_ERROR_OK, device->set_device_ready()); int sema_err = semaphore.wait(TIME_OUT_DEVICE_READY); @@ -204,13 +193,11 @@ static Case cases[] = { Case("CellularDevice create device", create_device, greentea_failure_handler), Case("CellularDevice Open and close interfaces", open_close_interfaces, greentea_failure_handler), Case("CellularDevice other methods", other_methods, greentea_failure_handler), - Case("CellularDevice delete device", delete_device, greentea_failure_handler), Case("CellularDevice init to device ready", init_to_device_ready_state, greentea_failure_handler), Case("CellularDevice sim ready", continue_to_sim_ready_state, greentea_failure_handler), Case("CellularDevice register", continue_to_register_state, greentea_failure_handler), - Case("CellularDevice attach", continue_to_attach_state, greentea_failure_handler) - Case("CellularDevice shutdown/reset", shutdown_reset, greentea_failure_handler), - Case("CellularDevice delete device", delete_device, greentea_failure_handler) + Case("CellularDevice attach", continue_to_attach_state, greentea_failure_handler), + Case("CellularDevice shutdown", shutdown, greentea_failure_handler), }; static utest::v1::status_t test_setup(const size_t number_of_cases) diff --git a/features/cellular/TESTS/api/cellular_information/main.cpp b/features/cellular/TESTS/api/cellular_information/main.cpp index bf18c553e2..8865bc920f 100644 --- a/features/cellular/TESTS/api/cellular_information/main.cpp +++ b/features/cellular/TESTS/api/cellular_information/main.cpp @@ -23,10 +23,6 @@ #include "CellularUtil.h" // for CELLULAR_ helper macros #include "CellularTargets.h" -#ifndef CELLULAR_DEVICE -#error [NOT_SUPPORTED] CELLULAR_DEVICE must be defined -#endif - #ifndef MBED_CONF_APP_CELLULAR_SIM_PIN #error [NOT_SUPPORTED] SIM pin code is needed. Skipping this build. #endif diff --git a/features/cellular/TESTS/api/cellular_network/main.cpp b/features/cellular/TESTS/api/cellular_network/main.cpp index b918f8df1a..73930b1013 100644 --- a/features/cellular/TESTS/api/cellular_network/main.cpp +++ b/features/cellular/TESTS/api/cellular_network/main.cpp @@ -20,21 +20,10 @@ #error [NOT_SUPPORTED] A json configuration file is needed. Skipping this build. #endif -#include "CellularUtil.h" // for CELLULAR_ helper macros -#include "CellularTargets.h" - -#ifndef CELLULAR_DEVICE -#error [NOT_SUPPORTED] CELLULAR_DEVICE must be defined -#endif - #ifndef MBED_CONF_APP_CELLULAR_SIM_PIN #error [NOT_SUPPORTED] SIM pin code is needed. Skipping this build. #endif -#if defined(TARGET_ADV_WISE_1570) || defined(TARGET_MTB_ADV_WISE_1570) -#error [NOT_SUPPORTED] target MTB_ADV_WISE_1570 is too unstable for network tests, IoT network is unstable -#endif - #include "greentea-client/test_env.h" #include "unity.h" #include "utest.h" @@ -45,7 +34,6 @@ #include "CellularContext.h" #include "CellularDevice.h" #include "../../cellular_tests_common.h" -#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h) #define NETWORK_TIMEOUT (180*1000) @@ -165,7 +153,6 @@ static void test_attach() static void test_other() { - const char *devi = CELLULAR_STRINGIFY(CELLULAR_DEVICE); TEST_ASSERT(nw->get_3gpp_error() == 0); nsapi_error_t err = nw->set_access_technology(CellularNetwork::RAT_GSM); @@ -204,52 +191,14 @@ static void test_other() nsapi_connection_status_t st = nw->get_connection_status(); TEST_ASSERT(st == NSAPI_STATUS_DISCONNECTED); -#ifndef TARGET_UBLOX_C027 // AT command is supported, but excluded as it runs out of memory easily (there can be very many operator names) - if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "SARA4_PPP") != 0) { - // QUECTEL_BG96 timeouts with this one, tested with 3 minute timeout - CellularNetwork::operator_names_list op_names; - err = nw->get_operator_names(op_names); - TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); - if (err == NSAPI_ERROR_DEVICE_ERROR) { - // if device error then we must check was that really device error or that modem/network does not support the commands - TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem - ((((AT_CellularNetwork *)nw)->get_device_error().errCode == 4) || // 4 == NOT SUPPORTED BY THE MODEM - (((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands - } else { - CellularNetwork::operator_names_t *opn = op_names.get_head(); - TEST_ASSERT(strlen(opn->numeric) > 0); - TEST_ASSERT(strlen(opn->alpha) > 0); - } - } -#endif - // TELIT_HE910 and QUECTEL_BG96 just gives an error and no specific error number so we can't know is this real error or that modem/network does not support the command CellularNetwork::CIoT_Supported_Opt supported_opt = CellularNetwork::CIOT_OPT_MAX; CellularNetwork::CIoT_Preferred_UE_Opt preferred_opt = CellularNetwork::PREFERRED_UE_OPT_MAX; err = nw->get_ciot_ue_optimization_config(supported_opt, preferred_opt); TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); - if (err == NSAPI_ERROR_DEVICE_ERROR) { - // if device error then we must check was that really device error or that modem/network does not support the commands - if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) { - TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem - ((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem - (((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands - } - } else { - TEST_ASSERT(supported_opt != CellularNetwork::CIOT_OPT_MAX); - TEST_ASSERT(preferred_opt != CellularNetwork::PREFERRED_UE_OPT_MAX); - } err = nw->set_ciot_optimization_config(supported_opt, preferred_opt, NULL); TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR); - if (err == NSAPI_ERROR_DEVICE_ERROR) { - // if device error then we must check was that really device error or that modem/network does not support the commands - if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) { - TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem - ((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem - (((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands - } - } } static void test_detach() diff --git a/features/cellular/TESTS/api/cellular_sms/main.cpp b/features/cellular/TESTS/api/cellular_sms/main.cpp index e4912a7a57..1c770c44ca 100644 --- a/features/cellular/TESTS/api/cellular_sms/main.cpp +++ b/features/cellular/TESTS/api/cellular_sms/main.cpp @@ -20,13 +20,6 @@ #error [NOT_SUPPORTED] A json configuration file is needed. Skipping this build. #endif -#include "CellularUtil.h" // for CELLULAR_ helper macros -#include "CellularTargets.h" - -#ifndef CELLULAR_DEVICE -#error [NOT_SUPPORTED] CELLULAR_DEVICE must be defined -#endif - #ifndef MBED_CONF_APP_CELLULAR_SIM_PIN #error [NOT_SUPPORTED] SIM pin code is needed. Skipping this build. #endif @@ -45,12 +38,10 @@ #include "CellularContext.h" #include "CellularDevice.h" #include "../../cellular_tests_common.h" -#include CELLULAR_STRINGIFY(CELLULAR_DEVICE.h) #define NETWORK_TIMEOUT (600*1000) #define SIM_BUSY 314 -static UARTSerial cellular_serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE); -static EventQueue queue(8 * EVENTS_EVENT_SIZE); + static CellularContext *ctx; static CellularDevice *device; static CellularSMS *sms; @@ -59,10 +50,10 @@ static int service_address_type; static void create_context() { - device = new CELLULAR_DEVICE(&cellular_serial); + device = CellularDevice::get_default_instance(); TEST_ASSERT(device != NULL); device->set_timeout(9000); - ctx = device->create_context(); + ctx = CellularContext::get_default_instance(); TEST_ASSERT(ctx != NULL); ctx->set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN); #ifdef MBED_CONF_APP_APN @@ -75,12 +66,12 @@ static void store_service_center_address() // First we need to go SIM_PIN state to make sure that we can get service address and device ready to accept AT commands create_context(); TEST_ASSERT(ctx->set_sim_ready() == NSAPI_ERROR_OK); - wait(1); - delete device; // will also delete context - wait(3); // some modems needs more time access sim + wait(5); // some modems needs more time access sim - ATHandler *at_init = new ATHandler(&cellular_serial, queue, 30000, "\r"); + ATHandler *at_init = device->get_at_handler(); + at_init->lock(); + at_init->set_at_timeout(30 * 1000); at_init->cmd_start("AT+CSCA?"); at_init->cmd_stop(); @@ -90,10 +81,10 @@ static void store_service_center_address() at_init->read_string(service_center_address, sizeof(service_center_address)); service_address_type = at_init->read_int(); at_init->resp_stop(); - TEST_ASSERT(at_init->get_last_error() == NSAPI_ERROR_OK); - delete at_init; + at_init->unlock(); + device->release_at_handler(at_init); } static void init() @@ -103,7 +94,7 @@ static void init() create_context(); TEST_ASSERT(ctx->register_to_network() == NSAPI_ERROR_OK); - sms = device->open_sms(&cellular_serial); + sms = device->open_sms(); TEST_ASSERT(sms != NULL); wait(3); // some modems needs more time access sim } diff --git a/features/cellular/TESTS/socket/udp/main.cpp b/features/cellular/TESTS/socket/udp/main.cpp index c5b856c9e0..6abd42f7eb 100644 --- a/features/cellular/TESTS/socket/udp/main.cpp +++ b/features/cellular/TESTS/socket/udp/main.cpp @@ -26,10 +26,6 @@ #error [NOT_SUPPORTED] SIM pin code is needed. Skipping this build. #endif -#if defined(TARGET_ADV_WISE_1570) || defined(TARGET_MTB_ADV_WISE_1570) -#error [NOT_SUPPORTED] target MTB_ADV_WISE_1570 is too unstable for network tests, IoT network is unstable -#endif - #include "greentea-client/test_env.h" #include "unity.h" #include "utest.h" diff --git a/features/cellular/framework/AT/AT_CellularContext.cpp b/features/cellular/framework/AT/AT_CellularContext.cpp index 91588c2cc1..5234e03e76 100644 --- a/features/cellular/framework/AT/AT_CellularContext.cpp +++ b/features/cellular/framework/AT/AT_CellularContext.cpp @@ -429,7 +429,7 @@ bool AT_CellularContext::set_new_context(int cid) _pdp_type = pdp_type; _cid = cid; _new_context_set = true; - tr_info("New PDP context %d, type %s", _cid, pdp_type); + tr_info("New PDP context %d, type %d", _cid, pdp_type); } return success; @@ -871,7 +871,6 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr) cell_callback_data_t *data = (cell_callback_data_t *)ptr; cellular_connection_status_t st = (cellular_connection_status_t)ev; _cb_data.error = data->error; - tr_debug("CellularContext: event %d, err %d, data %d", ev, data->error, data->status_data); #if USE_APN_LOOKUP if (st == CellularSIMStatusChanged && data->status_data == CellularDevice::SimStateReady && _cb_data.error == NSAPI_ERROR_OK) { @@ -903,7 +902,6 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr) if (!_nw && st == CellularDeviceReady && data->error == NSAPI_ERROR_OK) { _nw = _device->open_network(_fh); - tr_error("OPEN NETWORK"); } if (_cp_req && !_cp_in_use && (data->error == NSAPI_ERROR_OK) && @@ -948,7 +946,6 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr) } } } else { - tr_debug("CellularContext: event %d, ptr %d", ev, ptr); #if NSAPI_PPP_AVAILABLE if (_is_blocking) { if (ev == NSAPI_EVENT_CONNECTION_STATUS_CHANGE && ptr == NSAPI_STATUS_GLOBAL_UP) { diff --git a/features/cellular/framework/device/CellularDevice.cpp b/features/cellular/framework/device/CellularDevice.cpp index a8ad05e00f..b14175e3a8 100644 --- a/features/cellular/framework/device/CellularDevice.cpp +++ b/features/cellular/framework/device/CellularDevice.cpp @@ -44,6 +44,7 @@ CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref CellularDevice::~CellularDevice() { + tr_debug("CellularDevice destruct"); } void CellularDevice::stop() @@ -115,6 +116,7 @@ nsapi_error_t CellularDevice::create_state_machine() _state_machine->set_cellular_callback(callback(this, &CellularDevice::cellular_callback)); err = _state_machine->start_dispatch(); if (err) { + tr_error("Start state machine failed."); delete _state_machine; _state_machine = NULL; } diff --git a/features/cellular/framework/device/CellularStateMachine.cpp b/features/cellular/framework/device/CellularStateMachine.cpp index 104c898682..ad5783b25a 100644 --- a/features/cellular/framework/device/CellularStateMachine.cpp +++ b/features/cellular/framework/device/CellularStateMachine.cpp @@ -73,6 +73,7 @@ CellularStateMachine::CellularStateMachine(CellularDevice &device, events::Event CellularStateMachine::~CellularStateMachine() { + tr_debug("CellularStateMachine destruct"); stop(); } @@ -523,6 +524,7 @@ nsapi_error_t CellularStateMachine::run_to_state(CellularStateMachine::CellularS // call pre_event via queue so that it's in same thread and it's safe to decisions int id = _queue.call_in(0, this, &CellularStateMachine::pre_event, tmp_state); if (!id) { + report_failure("Failed to call queue."); stop(); _mutex.unlock(); return NSAPI_ERROR_NO_MEMORY; @@ -655,6 +657,7 @@ nsapi_error_t CellularStateMachine::start_dispatch() _queue_thread = new rtos::Thread(osPriorityNormal, 2048, NULL, "stm_queue"); if (_queue_thread->start(callback(&_queue, &events::EventQueue::dispatch_forever)) != osOK) { + report_failure("Failed to start thread."); stop(); return NSAPI_ERROR_NO_MEMORY; } diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp index 8bc75b85b4..26d7feb9f1 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.cpp @@ -16,9 +16,9 @@ */ #include "GEMALTO_CINTERION_CellularContext.h" +#include "GEMALTO_CINTERION_CellularInformation.h" #include "GEMALTO_CINTERION.h" #include "AT_CellularNetwork.h" -#include "AT_CellularInformation.h" #include "CellularLog.h" using namespace mbed; @@ -37,6 +37,14 @@ AT_CellularContext *GEMALTO_CINTERION::create_context_impl(ATHandler &at, const return new GEMALTO_CINTERION_CellularContext(at, this, apn, cp_req, nonip_req); } +AT_CellularInformation *GEMALTO_CINTERION::open_information_impl(ATHandler &at) +{ + if (_module == ModuleBGS2) { + return new GEMALTO_CINTERION_CellularInformation(at); + } + return AT_CellularDevice::open_information_impl(at); +} + nsapi_error_t GEMALTO_CINTERION::init() { nsapi_error_t err = AT_CellularDevice::init(); @@ -85,8 +93,8 @@ void GEMALTO_CINTERION::init_module_bgs2() { // BGS2-W_ATC_V00.100 static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = { - AT_CellularNetwork::RegistrationModeLAC, // C_EREG - AT_CellularNetwork::RegistrationModeLAC, // C_GREG + AT_CellularNetwork::RegistrationModeDisable, // C_EREG + AT_CellularNetwork::RegistrationModeEnable, // C_GREG AT_CellularNetwork::RegistrationModeLAC, // C_REG 0, // AT_CGSN_WITH_TYPE 1, // AT_CGDATA diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h index 522602de2c..d02fbf102f 100644 --- a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION.h @@ -48,6 +48,8 @@ public: protected: // AT_CellularDevice virtual AT_CellularContext *create_context_impl(ATHandler &at, const char *apn, bool cp_req = false, bool nonip_req = false); + virtual AT_CellularInformation *open_information_impl(ATHandler &at); + protected: virtual uint16_t get_send_delay() const; virtual nsapi_error_t init(); diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.cpp b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.cpp new file mode 100644 index 0000000000..3f81221401 --- /dev/null +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "GEMALTO_CINTERION_CellularInformation.h" + +namespace mbed { + +GEMALTO_CINTERION_CellularInformation::GEMALTO_CINTERION_CellularInformation(ATHandler &at) : AT_CellularInformation(at) +{ +} + +nsapi_error_t GEMALTO_CINTERION_CellularInformation::get_iccid(char *buf, size_t buf_size) +{ + _at.lock(); + _at.cmd_start("AT^SCID"); + _at.cmd_stop(); + _at.resp_start("^SCID:"); + _at.read_string(buf, buf_size); + _at.resp_stop(); + return _at.unlock_return_error(); +} + +} /* namespace mbed */ diff --git a/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.h b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.h new file mode 100644 index 0000000000..ef9fabc37b --- /dev/null +++ b/features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularInformation.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2018, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GEMALTO_CINTERION_CELLULARINFORMATION_H_ +#define GEMALTO_CINTERION_CELLULARINFORMATION_H_ + +#include "AT_CellularInformation.h" + +namespace mbed { + +class GEMALTO_CINTERION_CellularInformation: public AT_CellularInformation { +public: + GEMALTO_CINTERION_CellularInformation(ATHandler &at); + +public: // AT_CellularInformation + virtual nsapi_error_t get_iccid(char *buf, size_t buf_size); +}; + +} /* namespace mbed */ + +#endif /* GEMALTO_CINTERION_CELLULARINFORMATION_H_ */ diff --git a/features/netsocket/CellularBase.h b/features/netsocket/CellularBase.h index ac4c8cea6a..565d0918b0 100644 --- a/features/netsocket/CellularBase.h +++ b/features/netsocket/CellularBase.h @@ -39,17 +39,6 @@ public: */ static CellularBase *get_default_instance(); - /** Set default parameters on a cellular interface. - * - * A cellular interface instantiated directly or using - * CellularBase::get_default_instance() is initially unconfigured. - * This call can be used to set the default parameters that would - * have been set if the interface had been requested using - * NetworkInterface::get_default_instance() (see nsapi JSON - * configuration). - */ - virtual void set_default_parameters(); - /** Set the cellular network credentials. * * Please check documentation of connect() for default behavior of APN settings. @@ -148,6 +137,18 @@ protected: static CellularBase *get_target_default_instance(); #endif //!defined(DOXYGEN_ONLY) + +public: + /** Set default parameters on a cellular interface. + * + * A cellular interface instantiated directly or using + * CellularBase::get_default_instance() is initially unconfigured. + * This call can be used to set the default parameters that would + * have been set if the interface had been requested using + * NetworkInterface::get_default_instance() (see nsapi JSON + * configuration). + */ + virtual void set_default_parameters(); }; #endif //CELLULAR_BASE_H diff --git a/features/netsocket/NetworkInterface.h b/features/netsocket/NetworkInterface.h index 87e198a6c7..aeb7874b4b 100644 --- a/features/netsocket/NetworkInterface.h +++ b/features/netsocket/NetworkInterface.h @@ -84,17 +84,6 @@ public: */ static NetworkInterface *get_default_instance(); - /** Set default parameters on an interface. - * - * A network interface instantiated directly or using calls such as - * WiFiInterface::get_default_instance() is initially unconfigured. - * This call can be used to set the default parameters that would - * have been set if the interface had been requested using - * NetworkInterface::get_default_instance() (see nsapi JSON - * configuration). - */ - virtual void set_default_parameters(); - /** Get the local MAC address. * * Provided MAC address is intended for info or debug purposes and @@ -359,6 +348,18 @@ protected: */ static NetworkInterface *get_target_default_instance(); #endif //!defined(DOXYGEN_ONLY) + +public: + /** Set default parameters on an interface. + * + * A network interface instantiated directly or using calls such as + * WiFiInterface::get_default_instance() is initially unconfigured. + * This call can be used to set the default parameters that would + * have been set if the interface had been requested using + * NetworkInterface::get_default_instance() (see nsapi JSON + * configuration). + */ + virtual void set_default_parameters(); }; #endif diff --git a/features/netsocket/WiFiInterface.h b/features/netsocket/WiFiInterface.h index ea976803ff..4a3ed9cea6 100644 --- a/features/netsocket/WiFiInterface.h +++ b/features/netsocket/WiFiInterface.h @@ -40,17 +40,6 @@ public: */ static WiFiInterface *get_default_instance(); - /** Set default parameters on a Wi-Fi interface. - * - * A Wi-Fi interface instantiated directly or using - * WiFiInterface::get_default_instance() is initially unconfigured. - * This call can be used to set the default parameters that would - * have been set if the interface had been requested using - * NetworkInterface::get_default_instance() (see nsapi JSON - * configuration). - */ - virtual void set_default_parameters(); - /** Set the Wi-Fi network credentials. * * @param ssid Name of the network to connect to. @@ -134,6 +123,18 @@ protected: */ static WiFiInterface *get_target_default_instance(); #endif //!defined(DOXYGEN_ONLY) + +public: + /** Set default parameters on a Wi-Fi interface. + * + * A Wi-Fi interface instantiated directly or using + * WiFiInterface::get_default_instance() is initially unconfigured. + * This call can be used to set the default parameters that would + * have been set if the interface had been requested using + * NetworkInterface::get_default_instance() (see nsapi JSON + * configuration). + */ + virtual void set_default_parameters(); }; #endif diff --git a/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/ONBOARD_UBLOX_PPP.cpp b/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/ONBOARD_UBLOX_PPP.cpp index 614f07289e..28f1dfd934 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/ONBOARD_UBLOX_PPP.cpp +++ b/targets/TARGET_NXP/TARGET_LPC176X/TARGET_UBLOX_C027/ONBOARD_UBLOX_PPP.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_UBLOX_PPP.h" #include "cellular/onboard_modem_api.h" #include "UARTSerial.h" @@ -61,3 +63,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_UBLOX_PPP device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTB_MTS_DRAGONFLY/ONBOARD_TELIT_HE910.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTB_MTS_DRAGONFLY/ONBOARD_TELIT_HE910.cpp index d77f21e46c..ca763548b6 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTB_MTS_DRAGONFLY/ONBOARD_TELIT_HE910.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTB_MTS_DRAGONFLY/ONBOARD_TELIT_HE910.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "cellular/onboard_modem_api.h" #include "UARTSerial.h" #include "ONBOARD_TELIT_HE910.h" @@ -54,3 +56,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_TELIT_HE910 device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/ONBOARD_TELIT_HE910.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/ONBOARD_TELIT_HE910.cpp index 082ac9097f..8e524abdb7 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/ONBOARD_TELIT_HE910.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_MTS_DRAGONFLY_F411RE/ONBOARD_TELIT_HE910.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "cellular/onboard_modem_api.h" #include "UARTSerial.h" #include "ONBOARD_TELIT_HE910.h" @@ -61,3 +63,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_TELIT_HE910 device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX.cpp index cd6b922311..a9a32913c5 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_UBLOX_AT.h" #include "ONBOARD_UBLOX_PPP.h" #include "UARTSerial.h" @@ -31,3 +33,5 @@ CellularDevice *CellularDevice::get_target_default_instance() #endif return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_AT.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_AT.cpp index 137f9d9630..221d617fc4 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_AT.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_AT.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_UBLOX_AT.h" #include "cellular/onboard_modem_api.h" @@ -46,3 +48,5 @@ nsapi_error_t ONBOARD_UBLOX_AT::soft_power_off() ::onboard_modem_power_down(); return NSAPI_ERROR_OK; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_PPP.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_PPP.cpp index f3f18a5219..33b105f3a3 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_PPP.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F437xG/TARGET_UBLOX_C030/ONBOARD_UBLOX_PPP.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_UBLOX_PPP.h" #include "cellular/onboard_modem_api.h" @@ -46,3 +48,5 @@ nsapi_error_t ONBOARD_UBLOX_PPP::soft_power_off() ::onboard_modem_power_down(); return NSAPI_ERROR_OK; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_3G/ONBOARD_QUECTEL_BG96.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_3G/ONBOARD_QUECTEL_BG96.cpp index cd2a74cd9a..f218a8204e 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_3G/ONBOARD_QUECTEL_BG96.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_3G/ONBOARD_QUECTEL_BG96.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_QUECTEL_BG96.h" #include "cellular/onboard_modem_api.h" @@ -55,3 +57,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_QUECTEL_BG96 device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_BG96/ONBOARD_QUECTEL_BG96.cpp b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_BG96/ONBOARD_QUECTEL_BG96.cpp index cd2a74cd9a..f218a8204e 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_BG96/ONBOARD_QUECTEL_BG96.cpp +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_WIO_BG96/ONBOARD_QUECTEL_BG96.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_QUECTEL_BG96.h" #include "cellular/onboard_modem_api.h" @@ -55,3 +57,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_QUECTEL_BG96 device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32L4/TARGET_MTS_DRAGONFLY_L471QG/ONBOARD_SARA4_PPP.cpp b/targets/TARGET_STM/TARGET_STM32L4/TARGET_MTS_DRAGONFLY_L471QG/ONBOARD_SARA4_PPP.cpp index 029b2569af..de20f6c6ff 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/TARGET_MTS_DRAGONFLY_L471QG/ONBOARD_SARA4_PPP.cpp +++ b/targets/TARGET_STM/TARGET_STM32L4/TARGET_MTS_DRAGONFLY_L471QG/ONBOARD_SARA4_PPP.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_SARA4_PPP.h" #include "cellular/onboard_modem_api.h" #include "UARTSerial.h" @@ -61,3 +63,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_SARA4_PPP device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/TARGET_MTB_ADV_WISE_1570/ONBOARD_QUECTEL_BC95.cpp b/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/TARGET_MTB_ADV_WISE_1570/ONBOARD_QUECTEL_BC95.cpp index 4bce3631b0..684b0db47c 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/TARGET_MTB_ADV_WISE_1570/ONBOARD_QUECTEL_BC95.cpp +++ b/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/TARGET_MTB_ADV_WISE_1570/ONBOARD_QUECTEL_BC95.cpp @@ -14,9 +14,10 @@ * limitations under the License. */ +#if MBED_CONF_NSAPI_PRESENT + #include "ONBOARD_QUECTEL_BC95.h" -#include "cellular/onboard_modem_api.h" #include "UARTSerial.h" #include "CellularLog.h" @@ -28,25 +29,21 @@ ONBOARD_QUECTEL_BC95::ONBOARD_QUECTEL_BC95(FileHandle *fh) : QUECTEL_BC95(fh) nsapi_error_t ONBOARD_QUECTEL_BC95::hard_power_on() { - ::onboard_modem_init(); return NSAPI_ERROR_OK; } nsapi_error_t ONBOARD_QUECTEL_BC95::hard_power_off() { - ::onboard_modem_deinit(); return NSAPI_ERROR_OK; } nsapi_error_t ONBOARD_QUECTEL_BC95::soft_power_on() { - ::onboard_modem_power_up(); return NSAPI_ERROR_OK; } nsapi_error_t ONBOARD_QUECTEL_BC95::soft_power_off() { - ::onboard_modem_power_down(); return NSAPI_ERROR_OK; } @@ -62,3 +59,5 @@ CellularDevice *CellularDevice::get_target_default_instance() static ONBOARD_QUECTEL_BC95 device(&serial); return &device; } + +#endif // MBED_CONF_NSAPI_PRESENT diff --git a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws index 7030a5dce5..dd25563c2a 100644 --- a/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws +++ b/tools/test/travis-ci/doxy-spellchecker/ignore.en.pws @@ -1,5 +1,6 @@ personal_ws-1.1 en 1600 utf-8 _code_ +unconfigured mbed rtos malloc