mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Disable AT+CGAUTH on HE910 and BC95
parent
4698cd268d
commit
13106fb774
|
|
@ -162,7 +162,7 @@ static void udp_network_stack()
|
||||||
cellular.set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN);
|
cellular.set_sim_pin(MBED_CONF_APP_CELLULAR_SIM_PIN);
|
||||||
#ifdef MBED_CONF_APP_APN
|
#ifdef MBED_CONF_APP_APN
|
||||||
CellularNetwork *network = cellular.get_network();
|
CellularNetwork *network = cellular.get_network();
|
||||||
TEST_ASSERT(network->set_credentials(MBED_CONF_APP_APN) == NSAPI_ERROR_OK);
|
TEST_ASSERT(network->set_credentials(MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == NSAPI_ERROR_OK);
|
||||||
#endif
|
#endif
|
||||||
cellular_target_state = CellularConnectionFSM::STATE_CONNECTED;
|
cellular_target_state = CellularConnectionFSM::STATE_CONNECTED;
|
||||||
TEST_ASSERT(cellular.continue_to_state(cellular_target_state) == NSAPI_ERROR_OK);
|
TEST_ASSERT(cellular.continue_to_state(cellular_target_state) == NSAPI_ERROR_OK);
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return NSAPI_ERROR_OK on success
|
* @return NSAPI_ERROR_OK on success
|
||||||
* NSAPI_ERROR_NO_CONNECTION if fails to find suitable context to activate or activation failed (if not already activated)
|
* NSAPI_ERROR_NO_CONNECTION if fails to find suitable context to activate or activation failed (if not already activated)
|
||||||
* NSAPI_ERROR_UNSUPPORTED if NetworkStack was not found
|
* NSAPI_ERROR_UNSUPPORTED if NetworkStack was not found or cellular device does not support authentication
|
||||||
* NSAPI_ERROR_AUTH_FAILURE if password and username were provided and authentication to network failed
|
* NSAPI_ERROR_AUTH_FAILURE if password and username were provided and authentication to network failed
|
||||||
* Also if PPP mode
|
* Also if PPP mode
|
||||||
* NSAPI_ERROR_DEVICE_ERROR on failure and check more error from nsapi_ppp_connect(...)
|
* NSAPI_ERROR_DEVICE_ERROR on failure and check more error from nsapi_ppp_connect(...)
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ public:
|
||||||
enum SupportedFeature {
|
enum SupportedFeature {
|
||||||
AT_CGSN_WITH_TYPE, // AT+CGSN without type is likely always supported similar to AT+GSN
|
AT_CGSN_WITH_TYPE, // AT+CGSN without type is likely always supported similar to AT+GSN
|
||||||
AT_CGDATA, // alternative is to support only ATD*99***<cid>#
|
AT_CGDATA, // alternative is to support only ATD*99***<cid>#
|
||||||
|
AT_CGAUTH, // APN authentication AT commands supported
|
||||||
SUPPORTED_FEATURE_END_MARK // must be last element in the array of features
|
SUPPORTED_FEATURE_END_MARK // must be last element in the array of features
|
||||||
};
|
};
|
||||||
static void set_unsupported_features(const SupportedFeature *unsupported_features);
|
static void set_unsupported_features(const SupportedFeature *unsupported_features);
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,9 @@ nsapi_error_t AT_CellularNetwork::set_credentials(const char *apn,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (username && (len = strlen(username)) > 0) {
|
if (username && (len = strlen(username)) > 0) {
|
||||||
|
if (!is_supported(AT_CGAUTH)) { // APN authentication is needed with username/password
|
||||||
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
_uname = (char *)malloc(len * sizeof(char) + 1);
|
_uname = (char *)malloc(len * sizeof(char) + 1);
|
||||||
if (_uname) {
|
if (_uname) {
|
||||||
memcpy(_uname, username, len + 1);
|
memcpy(_uname, username, len + 1);
|
||||||
|
|
@ -512,6 +515,9 @@ nsapi_error_t AT_CellularNetwork::do_user_authentication()
|
||||||
{
|
{
|
||||||
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
|
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
|
||||||
if (_pwd && _uname) {
|
if (_pwd && _uname) {
|
||||||
|
if (!is_supported(AT_CGAUTH)) {
|
||||||
|
return NSAPI_ERROR_UNSUPPORTED;
|
||||||
|
}
|
||||||
_at.cmd_start("AT+CGAUTH=");
|
_at.cmd_start("AT+CGAUTH=");
|
||||||
_at.write_int(_cid);
|
_at.write_int(_cid);
|
||||||
_at.write_int(_authentication_type);
|
_at.write_int(_authentication_type);
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,12 @@ protected:
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat);
|
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat);
|
||||||
|
|
||||||
|
/** APN user authentication
|
||||||
|
*
|
||||||
|
* @return NSAPI_ERROR_OK on success
|
||||||
|
* NSAPI_ERROR_UNSUPPORTED on authentication not supported by cellular device
|
||||||
|
* NSAPI_ERROR_AUTH_FAILURE on authentication to network failed
|
||||||
|
*/
|
||||||
virtual nsapi_error_t do_user_authentication();
|
virtual nsapi_error_t do_user_authentication();
|
||||||
private:
|
private:
|
||||||
// "NO CARRIER" urc
|
// "NO CARRIER" urc
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,14 @@
|
||||||
using namespace events;
|
using namespace events;
|
||||||
using namespace mbed;
|
using namespace mbed;
|
||||||
|
|
||||||
|
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
|
||||||
|
AT_CellularBase::AT_CGAUTH, // BC95_AT_Commands_Manual_V1.9
|
||||||
|
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
|
||||||
|
};
|
||||||
|
|
||||||
QUECTEL_BC95::QUECTEL_BC95(EventQueue &queue) : AT_CellularDevice(queue)
|
QUECTEL_BC95::QUECTEL_BC95(EventQueue &queue) : AT_CellularDevice(queue)
|
||||||
{
|
{
|
||||||
|
AT_CellularBase::set_unsupported_features(unsupported_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
QUECTEL_BC95::~QUECTEL_BC95()
|
QUECTEL_BC95::~QUECTEL_BC95()
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ using namespace events;
|
||||||
|
|
||||||
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
|
static const AT_CellularBase::SupportedFeature unsupported_features[] = {
|
||||||
AT_CellularBase::AT_CGSN_WITH_TYPE, // HE910/UE910/UL865/UE866 AT Commands Reference Guide Rev. 11-2006-10-14
|
AT_CellularBase::AT_CGSN_WITH_TYPE, // HE910/UE910/UL865/UE866 AT Commands Reference Guide Rev. 11-2006-10-14
|
||||||
|
AT_CellularBase::AT_CGAUTH, // HE910/UE910/UL865/UE866 AT Commands Reference Guide Rev. 11-2006-10-14
|
||||||
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
|
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue