Implement set_access_technology_impl for Telit ME910

pull/12020/head
Lin Gao 2019-12-03 14:39:13 -06:00
parent a5a9683348
commit d5d4520d62
4 changed files with 90 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "TELIT_ME910.h" #include "TELIT_ME910.h"
#include "TELIT_ME910_CellularContext.h" #include "TELIT_ME910_CellularContext.h"
#include "TELIT_ME910_CellularNetwork.h"
#include "AT_CellularNetwork.h" #include "AT_CellularNetwork.h"
#include "PinNames.h" #include "PinNames.h"
#include "rtos/ThisThread.h" #include "rtos/ThisThread.h"
@ -187,3 +188,8 @@ nsapi_error_t TELIT_ME910::soft_power_off()
{ {
return AT_CellularDevice::soft_power_off(); return AT_CellularDevice::soft_power_off();
} }
AT_CellularNetwork *TELIT_ME910::open_network_impl(ATHandler &at)
{
return new TELIT_ME910_CellularNetwork(at);
}

View File

@ -48,6 +48,8 @@ protected: // AT_CellularDevice
virtual nsapi_error_t hard_power_off(); virtual nsapi_error_t hard_power_off();
virtual nsapi_error_t soft_power_on(); virtual nsapi_error_t soft_power_on();
virtual nsapi_error_t soft_power_off(); virtual nsapi_error_t soft_power_off();
virtual AT_CellularNetwork *open_network_impl(ATHandler &at);
private: private:
bool _active_high; bool _active_high;
DigitalOut _pwr_key; DigitalOut _pwr_key;

View File

@ -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;
}
}

View File

@ -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_