add config option and property to choose automatic fallback for PLMN manual operator selection

pull/12020/head
Lin Gao 2019-12-12 15:14:24 -06:00
parent d5d4520d62
commit c8524c25be
17 changed files with 57 additions and 26 deletions

View File

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

View File

@ -42,21 +42,22 @@ public:
* to the end (just before PROPERTY_MAX). Do not modify any of the existing fields.
*/
enum CellularProperty {
PROPERTY_C_EREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_GREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_REG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
PROPERTY_AT_CNMI, // 0 = not supported, 1 = supported. New message (SMS) indication AT command
PROPERTY_AT_CSMP, // 0 = not supported, 1 = supported. Set text mode AT command
PROPERTY_AT_CMGF, // 0 = not supported, 1 = supported. Set preferred message format AT command
PROPERTY_AT_CSDH, // 0 = not supported, 1 = supported. Show text mode AT command
PROPERTY_IPV4_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support IPV4?
PROPERTY_IPV6_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support IPV6?
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_C_EREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_GREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_C_REG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
PROPERTY_AT_CNMI, // 0 = not supported, 1 = supported. New message (SMS) indication AT command
PROPERTY_AT_CSMP, // 0 = not supported, 1 = supported. Set text mode AT command
PROPERTY_AT_CMGF, // 0 = not supported, 1 = supported. Set preferred message format AT command
PROPERTY_AT_CSDH, // 0 = not supported, 1 = supported. Show text mode AT command
PROPERTY_IPV4_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support IPV4?
PROPERTY_IPV6_PDP_TYPE, // 0 = not supported, 1 = supported. Does modem support IPV6?
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
};

View File

@ -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", "=4,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);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -42,7 +42,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)

View File

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

View File

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

View File

@ -58,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
@ -191,5 +192,5 @@ nsapi_error_t TELIT_ME910::soft_power_off()
AT_CellularNetwork *TELIT_ME910::open_network_impl(ATHandler &at)
{
return new TELIT_ME910_CellularNetwork(at);
return new TELIT_ME910_CellularNetwork(at, *this);
}

View File

@ -19,7 +19,7 @@
using namespace mbed;
TELIT_ME910_CellularNetwork::TELIT_ME910_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
TELIT_ME910_CellularNetwork::TELIT_ME910_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device) : AT_CellularNetwork(atHandler, device)
{
}

View File

@ -24,7 +24,7 @@ namespace mbed {
class TELIT_ME910_CellularNetwork : public AT_CellularNetwork {
public:
TELIT_ME910_CellularNetwork(ATHandler &atHandler);
TELIT_ME910_CellularNetwork(ATHandler &atHandler, AT_CellularDevice &device);
virtual ~ TELIT_ME910_CellularNetwork();
protected:

View File

@ -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] = {

View File

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

View File

@ -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] = {

View File

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