From d5d4520d62d413571e90080c5dbf31300a7410d9 Mon Sep 17 00:00:00 2001 From: Lin Gao Date: Tue, 3 Dec 2019 14:39:13 -0600 Subject: [PATCH] Implement set_access_technology_impl for Telit ME910 --- .../targets/TELIT/ME910/TELIT_ME910.cpp | 6 +++ .../targets/TELIT/ME910/TELIT_ME910.h | 2 + .../ME910/TELIT_ME910_CellularNetwork.cpp | 45 +++++++++++++++++++ .../TELIT/ME910/TELIT_ME910_CellularNetwork.h | 37 +++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.cpp create mode 100644 features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.h diff --git a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp index 9449a67eef..59cbe3612d 100644 --- a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp +++ b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.cpp @@ -17,6 +17,7 @@ #include "TELIT_ME910.h" #include "TELIT_ME910_CellularContext.h" +#include "TELIT_ME910_CellularNetwork.h" #include "AT_CellularNetwork.h" #include "PinNames.h" #include "rtos/ThisThread.h" @@ -187,3 +188,8 @@ nsapi_error_t TELIT_ME910::soft_power_off() { return AT_CellularDevice::soft_power_off(); } + +AT_CellularNetwork *TELIT_ME910::open_network_impl(ATHandler &at) +{ + return new TELIT_ME910_CellularNetwork(at); +} diff --git a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.h b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.h index 6b0455d3fb..9212b618e6 100644 --- a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.h +++ b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910.h @@ -48,6 +48,8 @@ protected: // AT_CellularDevice virtual nsapi_error_t hard_power_off(); virtual nsapi_error_t soft_power_on(); virtual nsapi_error_t soft_power_off(); + virtual AT_CellularNetwork *open_network_impl(ATHandler &at); + private: bool _active_high; DigitalOut _pwr_key; diff --git a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.cpp b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.cpp new file mode 100644 index 0000000000..adf998dd19 --- /dev/null +++ b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "TELIT_ME910_CellularNetwork.h" + +using namespace mbed; + +TELIT_ME910_CellularNetwork::TELIT_ME910_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler) +{ +} + +TELIT_ME910_CellularNetwork::~TELIT_ME910_CellularNetwork() +{ +} + +nsapi_error_t TELIT_ME910_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opsAct) +{ + switch (opsAct) { + case RAT_GSM: + case RAT_CATM1: + case RAT_NB1: + _op_act = opsAct; + return NSAPI_ERROR_OK; + + default: + _op_act = RAT_UNKNOWN; + return NSAPI_ERROR_UNSUPPORTED; + } +} + + diff --git a/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.h b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.h new file mode 100644 index 0000000000..439bf6137d --- /dev/null +++ b/features/cellular/framework/targets/TELIT/ME910/TELIT_ME910_CellularNetwork.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019, Arm Limited and affiliates. + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TELIT_ME910_CELLULAR_NETWORK_H_ +#define TELIT_ME910_CELLULAR_NETWORK_H_ + +#include "AT_CellularNetwork.h" + +namespace mbed { + +class TELIT_ME910_CellularNetwork : public AT_CellularNetwork { +public: + TELIT_ME910_CellularNetwork(ATHandler &atHandler); + virtual ~ TELIT_ME910_CellularNetwork(); + +protected: + virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat); + +}; + +} // namespace mbed + +#endif // TELIT_ME910_CELLULAR_NETWORK_H_