takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GEMALTO_CINTERION_CellularNetwork.cpp Source File

GEMALTO_CINTERION_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 "GEMALTO_CINTERION_CellularNetwork.h"
00019 #include "GEMALTO_CINTERION_CellularStack.h"
00020 #include "GEMALTO_CINTERION_Module.h"
00021 
00022 using namespace mbed;
00023 
00024 GEMALTO_CINTERION_CellularNetwork::GEMALTO_CINTERION_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
00025 {
00026 }
00027 
00028 GEMALTO_CINTERION_CellularNetwork::~GEMALTO_CINTERION_CellularNetwork()
00029 {
00030 }
00031 
00032 #if !NSAPI_PPP_AVAILABLE
00033 NetworkStack *GEMALTO_CINTERION_CellularNetwork::get_stack()
00034 {
00035     if (!_stack) {
00036         _stack = new GEMALTO_CINTERION_CellularStack(_at, _apn, _cid, _ip_stack_type);
00037     }
00038     return _stack;
00039 }
00040 #endif // NSAPI_PPP_AVAILABLE
00041 
00042 bool GEMALTO_CINTERION_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t requested_stack)
00043 {
00044 #if NSAPI_PPP_AVAILABLE
00045     return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
00046 #else
00047     if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
00048         return (requested_stack == IPV4_STACK);
00049     }
00050     return (requested_stack == IPV4_STACK || requested_stack == IPV6_STACK);
00051 #endif
00052 }
00053 
00054 AT_CellularNetwork::RegistrationMode GEMALTO_CINTERION_CellularNetwork::has_registration(RegistrationType reg_type)
00055 {
00056     if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelEMS31) {
00057         return (reg_type == C_EREG) ? RegistrationModeLAC : RegistrationModeDisable;
00058     }
00059     if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
00060         if (reg_type == C_GREG) {
00061             return RegistrationModeEnable;
00062         }
00063         return (reg_type == C_REG) ? RegistrationModeLAC : RegistrationModeDisable;
00064     }
00065     return (reg_type == C_REG || reg_type == C_GREG || reg_type == C_EREG) ? RegistrationModeLAC : RegistrationModeDisable;
00066 }
00067 
00068 nsapi_error_t GEMALTO_CINTERION_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opsAct)
00069 {
00070     _op_act = RAT_UNKNOWN;
00071     return NSAPI_ERROR_UNSUPPORTED ;
00072 }