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
QUECTEL_UG96.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 "QUECTEL_UG96.h" 00019 #include "QUECTEL_UG96_CellularContext.h" 00020 #include "AT_CellularNetwork.h" 00021 00022 using namespace mbed; 00023 using namespace events; 00024 00025 #define CONNECT_DELIM "\r\n" 00026 #define CONNECT_BUFFER_SIZE (1280 + 80 + 80) // AT response + sscanf format 00027 #define CONNECT_TIMEOUT 8000 00028 00029 static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = { 00030 AT_CellularNetwork::RegistrationModeDisable,// C_EREG 00031 AT_CellularNetwork::RegistrationModeLAC, // C_GREG 00032 AT_CellularNetwork::RegistrationModeLAC, // C_REG 00033 1, // AT_CGSN_WITH_TYPE 00034 1, // AT_CGDATA 00035 1, // AT_CGAUTH 00036 1, // AT_CNMI 00037 1, // AT_CSMP 00038 1, // AT_CMGF 00039 1, // AT_CSDH 00040 1, // PROPERTY_IPV4_STACK 00041 0, // PROPERTY_IPV6_STACK 00042 0, // PROPERTY_IPV4V6_STACK 00043 0, // PROPERTY_NON_IP_PDP_TYPE 00044 1, // PROPERTY_AT_CGEREP 00045 }; 00046 00047 QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh) 00048 { 00049 set_cellular_properties(cellular_properties); 00050 } 00051 00052 AT_CellularContext *QUECTEL_UG96::create_context_impl(ATHandler &at, const char *apn, bool cp_req, bool nonip_req) 00053 { 00054 return new QUECTEL_UG96_CellularContext(at, this, apn, cp_req, nonip_req); 00055 } 00056 00057 #if MBED_CONF_QUECTEL_UG96_PROVIDE_DEFAULT 00058 #include "UARTSerial.h" 00059 CellularDevice *CellularDevice::get_default_instance() 00060 { 00061 static UARTSerial serial(MBED_CONF_QUECTEL_UG96_TX, MBED_CONF_QUECTEL_UG96_RX, MBED_CONF_QUECTEL_UG96_BAUDRATE); 00062 #if defined (MBED_CONF_QUECTEL_UG96_RTS) && defined (MBED_CONF_QUECTEL_UG96_CTS) 00063 tr_debug("QUECTEL_UG96 flow control: RTS %d CTS %d", MBED_CONF_QUECTEL_UG96_RTS, MBED_CONF_QUECTEL_UG96_CTS); 00064 serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_QUECTEL_UG96_RTS, MBED_CONF_QUECTEL_UG96_CTS); 00065 #endif 00066 static QUECTEL_UG96 device(&serial); 00067 return &device; 00068 } 00069 #endif 00070
Generated on Tue Jul 12 2022 13:54:46 by
1.7.2