mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #12020 from linlingao/fix_rat
Fix issues in setting radio access technologypull/12183/head
commit
6baa5e479d
|
|
@ -161,6 +161,13 @@ public:
|
|||
NWModeManualAutomatic // if manual fails, fallback to automatic
|
||||
};
|
||||
|
||||
/// Operator name format
|
||||
enum OperatorNameFormat {
|
||||
OperatorNameAlphaLong = 0, // alphanumeric long form
|
||||
OperatorNameAlphaShort, // alphanumeric short form
|
||||
OperatorNameNumeric // numeric digits
|
||||
};
|
||||
|
||||
/// Network registration information
|
||||
struct registration_params_t {
|
||||
RegistrationType _type;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ public:
|
|||
PROPERTY_IPV4V6_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support IPV4 and IPV6 simultaneously?
|
||||
PROPERTY_NON_IP_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support Non-IP?
|
||||
PROPERTY_AT_CGEREP, // 0 = not supported, 1 = supported. Does modem support AT command AT+CGEREP.
|
||||
PROPERTY_AT_COPS_FALLBACK_AUTO, // 0 = not supported, 1 = supported. Does modem support mode 4 of AT+COPS= ?
|
||||
|
||||
PROPERTY_MAX
|
||||
};
|
||||
|
|
|
|||
|
|
@ -209,9 +209,10 @@ nsapi_error_t AT_CellularNetwork::get_network_registering_mode(NWRegisteringMode
|
|||
nsapi_error_t AT_CellularNetwork::set_registration(const char *plmn)
|
||||
{
|
||||
|
||||
NWRegisteringMode mode = NWModeAutomatic;
|
||||
|
||||
if (!plmn) {
|
||||
tr_debug("Automatic network registration");
|
||||
NWRegisteringMode mode;
|
||||
if (get_network_registering_mode(mode) != NSAPI_ERROR_OK) {
|
||||
return NSAPI_ERROR_DEVICE_ERROR;
|
||||
}
|
||||
|
|
@ -221,10 +222,17 @@ nsapi_error_t AT_CellularNetwork::set_registration(const char *plmn)
|
|||
return NSAPI_ERROR_OK;
|
||||
} else {
|
||||
tr_debug("Manual network registration to %s", plmn);
|
||||
mode = NWModeManual;
|
||||
OperatorNameFormat format = OperatorNameNumeric;
|
||||
#ifdef MBED_CONF_CELLULAR_PLMN_FALLBACK_AUTO
|
||||
if (_device.get_property(AT_CellularDevice::PROPERTY_AT_COPS_FALLBACK_AUTO)) {
|
||||
mode = NWModeManualAutomatic;
|
||||
}
|
||||
#endif
|
||||
if (_op_act != RAT_UNKNOWN) {
|
||||
return _at.at_cmd_discard("+COPS", "=1,2,", "%s%d", plmn, _op_act);
|
||||
return _at.at_cmd_discard("+COPS", "=", "%d%d%s%d", mode, format, plmn, _op_act);
|
||||
} else {
|
||||
return _at.at_cmd_discard("+COPS", "=1,2,", "%s", plmn);
|
||||
return _at.at_cmd_discard("+COPS", "=", "%d%d%s", mode, format, plmn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
GENERIC_AT3GPP::GENERIC_AT3GPP(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
SARA4_PPP::SARA4_PPP(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV6_STACK
|
||||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
0, // PROPERTY_AT_CGEREP
|
||||
0, // PROPERTY_AT_CGEREP,
|
||||
0, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
QUECTEL_BC95::QUECTEL_BC95(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV6_STACK
|
||||
0, // PROPERTY_IPV4V6_STACK
|
||||
1, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_CGEREP,
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
QUECTEL_BG96::QUECTEL_BG96(FileHandle *fh, PinName pwr, bool active_high, PinName rst)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV6_STACK
|
||||
1, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_CGEREP,
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
QUECTEL_EC2X::QUECTEL_EC2X(FileHandle *fh, PinName pwr, bool active_high, PinName rst)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
QUECTEL_M26::QUECTEL_M26(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV6_STACK
|
||||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_CGEREP,
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
QUECTEL_UG96::QUECTEL_UG96(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
0, // PROPERTY_AT_CGEREP
|
||||
0, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
RM1000_AT::RM1000_AT(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV6_STACK
|
||||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_CGEREP,
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
TELIT_HE910::TELIT_HE910(FileHandle *fh) : AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -57,6 +58,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
//the delay between sending AT commands
|
||||
|
|
@ -187,3 +189,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, *this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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_CellularDevice &device) : AT_CellularNetwork(atHandler, device)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -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, AT_CellularDevice &device);
|
||||
virtual ~ TELIT_ME910_CellularNetwork();
|
||||
|
||||
protected:
|
||||
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
|
||||
|
||||
};
|
||||
|
||||
} // namespace mbed
|
||||
|
||||
#endif // TELIT_ME910_CELLULAR_NETWORK_H_
|
||||
|
|
@ -37,6 +37,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX)
|
||||
static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
1, // PROPERTY_IPV4_STACK
|
||||
0, // PROPERTY_IPV6_STACK
|
||||
0, // PROPERTY_IPV4V6_STACK
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
|
||||
UBLOX_N2XX::UBLOX_N2XX(FileHandle *fh): AT_CellularDevice(fh)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
|||
0, // PROPERTY_IPV4V6_STACK
|
||||
0, // PROPERTY_NON_IP_PDP_TYPE
|
||||
1, // PROPERTY_AT_CGEREP
|
||||
1, // PROPERTY_AT_COPS_FALLBACK_AUTO
|
||||
};
|
||||
#elif defined(UBX_MDM_SARA_U2XX) || defined(UBX_MDM_SARA_G3XX)
|
||||
static const intptr_t cellular_properties[AT_CellularDevice::PROPERTY_MAX] = {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@
|
|||
"max-cp-data-recv-len" : {
|
||||
"help": "Max length of the buffer storing data received over control plane",
|
||||
"value": 1358
|
||||
},
|
||||
"plmn-fallback-auto" : {
|
||||
"help": "If manual PLMN is selected, use mode 4 manual/automatic in AT+COPS to try automatic mode if manual selection fails. Set to null to disable",
|
||||
"value": null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue