Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
RM1000_AT_CellularNetwork.cpp
00001 /* 00002 * Copyright (c) 2018, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include <stdlib.h> 00019 #include "rtos.h" 00020 #include "CellularCommon.h" 00021 #include "RM1000_AT_CellularNetwork.h" 00022 #include "platform/mbed_wait_api.h" 00023 #include "AT_CellularDevice.h" 00024 00025 #include "mbed-trace/mbed_trace.h" 00026 #ifndef TRACE_GROUP 00027 #define TRACE_GROUP "RIOT" 00028 #endif // TRACE_GROUP 00029 using namespace mbed; 00030 00031 // Callback for MODEM faults URC. 00032 void RM1000_AT_CellularNetwork::MODEM_FAULT_URC() 00033 { 00034 tr_debug("RM1000_AT_CellularNetwork::ASSERTED_URC"); 00035 _connect_status = NSAPI_STATUS_DISCONNECTED ; 00036 if (_connection_status_cb) { 00037 _connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE , NSAPI_STATUS_DISCONNECTED ); 00038 } 00039 } 00040 00041 RM1000_AT_CellularNetwork::RM1000_AT_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device) : AT_CellularNetwork(atHandler, device) 00042 { 00043 tr_debug("RM1000_AT_CellularNetwork::RM1000_B0_CellularNetwork"); 00044 _op_act = RAT_UNKNOWN; 00045 _at.set_urc_handler("ASSERTED!", callback(this, &RM1000_AT_CellularNetwork::MODEM_FAULT_URC)); 00046 _at.set_urc_handler("ERRCODE:", callback(this, &RM1000_AT_CellularNetwork::MODEM_FAULT_URC)); 00047 _at.set_urc_handler("Halt the processor", callback(this, &RM1000_AT_CellularNetwork::MODEM_FAULT_URC)); 00048 } 00049 00050 RM1000_AT_CellularNetwork::~RM1000_AT_CellularNetwork() 00051 { 00052 tr_debug("RM1000_AT_CellularNetwork::~RM1000_B0_CellularNetwork"); 00053 00054 _at.set_urc_handler("ASSERTED!", NULL); 00055 _at.set_urc_handler("ERRCODE:", NULL); 00056 _at.set_urc_handler("Halt the processor", NULL); 00057 } 00058 00059 nsapi_error_t RM1000_AT_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat) 00060 { 00061 nsapi_error_t ret = NSAPI_ERROR_OK ; 00062 00063 tr_debug("RM1000_AT_CellularNetwork::set_access_technology_impl %d", opRat); 00064 00065 switch (opRat) { 00066 case RAT_NB1: 00067 break; 00068 default: { 00069 _op_act = RAT_UNKNOWN; 00070 ret = NSAPI_ERROR_UNSUPPORTED ; 00071 } 00072 } 00073 00074 return (ret); 00075 } 00076 00077 nsapi_error_t RM1000_AT_CellularNetwork::set_registration_urc(RegistrationType type, bool urc_on) 00078 { 00079 tr_debug("RM1000_AT_CellularNetwork::set_registration_urc"); 00080 00081 int index = (int)type; 00082 MBED_ASSERT(index >= 0 && index < C_MAX); 00083 00084 RegistrationMode mode = (RegistrationMode)_device.get_property((AT_CellularDevice::CellularProperty)type); 00085 if (mode == RegistrationModeDisable) { 00086 return NSAPI_ERROR_UNSUPPORTED ; 00087 } else { 00088 return NSAPI_ERROR_OK ; /* FIXME use at commands */ 00089 } 00090 }
Generated on Tue Jul 12 2022 13:54:47 by
