mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Fix cellular specific Greentea tests
parent
007caa0235
commit
95839662c6
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 */
|
|
@ -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_ */
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include "ONBOARD_QUECTEL_BC95.h"
|
||||
|
||||
#include "cellular/onboard_modem_api.h"
|
||||
#include "UARTSerial.h"
|
||||
#include "CellularLog.h"
|
||||
|
||||
|
@ -28,25 +27,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
personal_ws-1.1 en 1600 utf-8
|
||||
_code_
|
||||
unconfigured
|
||||
mbed
|
||||
rtos
|
||||
malloc
|
||||
|
|
Loading…
Reference in New Issue