Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GENERIC_AT3GPP.cpp Source File

GENERIC_AT3GPP.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 "GENERIC_AT3GPP.h"
00019 #include "AT_CellularNetwork.h"
00020 
00021 using namespace mbed;
00022 
00023 // by default all properties are supported
00024 static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
00025     AT_CellularNetwork::RegistrationModeLAC,    // C_EREG
00026     AT_CellularNetwork::RegistrationModeLAC,    // C_GREG
00027     AT_CellularNetwork::RegistrationModeLAC,    // C_REG
00028     1,  // AT_CGSN_WITH_TYPE
00029     1,  // AT_CGDATA
00030     1,  // AT_CGAUTH
00031     1,  // AT_CNMI
00032     1,  // AT_CSMP
00033     1,  // AT_CMGF
00034     1,  // AT_CSDH
00035     1,  // PROPERTY_IPV4_STACK
00036     1,  // PROPERTY_IPV6_STACK
00037     1,  // PROPERTY_IPV4V6_STACK
00038     0,  // PROPERTY_NON_IP_PDP_TYPE
00039     1,  // PROPERTY_AT_CGEREP
00040 };
00041 
00042 GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)
00043 {
00044     set_cellular_properties(cellular_properties);
00045 }
00046 
00047 #if MBED_CONF_GENERIC_AT3GPP_PROVIDE_DEFAULT
00048 #include "UARTSerial.h"
00049 CellularDevice *CellularDevice::get_default_instance()
00050 {
00051     static UARTSerial serial(MBED_CONF_GENERIC_AT3GPP_TX, MBED_CONF_GENERIC_AT3GPP_RX, MBED_CONF_GENERIC_AT3GPP_BAUDRATE);
00052 #if defined (MBED_CONF_GENERIC_AT3GPP_RTS) && defined(MBED_CONF_GENERIC_AT3GPP_CTS)
00053     tr_debug("GENERIC_AT3GPP flow control: RTS %d CTS %d", MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
00054     serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_GENERIC_AT3GPP_RTS, MBED_CONF_GENERIC_AT3GPP_CTS);
00055 #endif
00056     static GENERIC_AT3GPP device(&serial);
00057     return &device;
00058 }
00059 #endif