Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SARA4_PPP.cpp Source File

SARA4_PPP.cpp

00001 /*
00002  * Copyright (c) 2017, 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 "SARA4_PPP.h"
00019 #include "SARA4_PPP_CellularNetwork.h"
00020 
00021 using namespace mbed;
00022 using namespace events;
00023 
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::RegistrationModeDisable, // C_REG
00028     0,  // AT_CGSN_WITH_TYPE
00029     0,  // 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     0,  // PROPERTY_IPV6_STACK
00037     0,  // PROPERTY_IPV4V6_STACK
00038     0,  // PROPERTY_NON_IP_PDP_TYPE
00039     1,  // PROPERTY_AT_CGEREP
00040 };
00041 
00042 SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh)
00043 {
00044     set_cellular_properties(cellular_properties);
00045 }
00046 
00047 AT_CellularNetwork *SARA4_PPP::open_network_impl(ATHandler &at)
00048 {
00049     return new SARA4_PPP_CellularNetwork(at, *this);
00050 }
00051 
00052 #if MBED_CONF_SARA4_PPP_PROVIDE_DEFAULT
00053 #include "UARTSerial.h"
00054 CellularDevice *CellularDevice::get_default_instance()
00055 {
00056     static UARTSerial serial(MBED_CONF_SARA4_PPP_TX, MBED_CONF_SARA4_PPP_RX, MBED_CONF_SARA4_PPP_BAUDRATE);
00057 #if defined (MBED_CONF_SARA4_PPP_RTS) && defined (MBED_CONF_SARA4_PPP_CTS)
00058     tr_debug("SARA4_PPP flow control: RTS %d CTS %d", MBED_CONF_SARA4_PPP_RTS, MBED_CONF_SARA4_PPP_CTS);
00059     serial.set_flow_control(SerialBase::RTSCTS, MBED_CONF_SARA4_PPP_RTS, MBED_CONF_SARA4_PPP_CTS);
00060 #endif
00061     static SARA4_PPP device(&serial);
00062     return &device;
00063 }
00064 #endif