takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GEMALTO_CINTERION_Module.cpp Source File

GEMALTO_CINTERION_Module.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 <string.h>
00019 
00020 #include "AT_CellularBase.h"
00021 #include "GEMALTO_CINTERION_Module.h"
00022 #include "CellularLog.h"
00023 
00024 using namespace mbed;
00025 
00026 // unsupported features as per ELS61-E2_ATC_V01.000
00027 static const AT_CellularBase::SupportedFeature unsupported_features_els61[] =  {
00028     AT_CellularBase::AT_CGSN_WITH_TYPE,
00029     AT_CellularBase::SUPPORTED_FEATURE_END_MARK
00030 };
00031 
00032 // unsupported features as per BGS2-W_ATC_V00.100
00033 static const AT_CellularBase::SupportedFeature unsupported_features_bgs2[] =  {
00034     AT_CellularBase::AT_CGSN_WITH_TYPE,
00035     AT_CellularBase::SUPPORTED_FEATURE_END_MARK
00036 };
00037 
00038 // unsupported features as per EMS31-US_ATC_V4.9.5
00039 static const AT_CellularBase::SupportedFeature unsupported_features_ems31[] =  {
00040     AT_CellularBase::SUPPORTED_FEATURE_END_MARK
00041 };
00042 
00043 GEMALTO_CINTERION_Module::Model GEMALTO_CINTERION_Module::_model;
00044 
00045 nsapi_error_t GEMALTO_CINTERION_Module::detect_model(const char *model)
00046 {
00047     static const AT_CellularBase::SupportedFeature *unsupported_features;
00048     if (memcmp(model, "ELS61", sizeof("ELS61") - 1) == 0) {
00049         _model = ModelELS61;
00050         unsupported_features = unsupported_features_els61;
00051     } else if (memcmp(model, "BGS2", sizeof("BGS2") - 1) == 0) {
00052         _model = ModelBGS2;
00053         unsupported_features = unsupported_features_bgs2;
00054     } else if (memcmp(model, "EMS31", sizeof("EMS31") - 1) == 0) {
00055         _model = ModelEMS31;
00056         unsupported_features = unsupported_features_ems31;
00057     } else {
00058         tr_error("Cinterion model unsupported %s", model);
00059         return NSAPI_ERROR_UNSUPPORTED ;
00060     }
00061     tr_info("Cinterion model %s (%d)", model, _model);
00062     AT_CellularBase::set_unsupported_features(unsupported_features);
00063     return NSAPI_ERROR_OK ;
00064 }
00065 
00066 GEMALTO_CINTERION_Module::Model GEMALTO_CINTERION_Module::get_model()
00067 {
00068     return _model;
00069 }