Cellular: Support for GPRS dial-up

pull/7870/head
Ari Parkkila 2018-08-23 02:37:47 -07:00
parent f5fb3c1911
commit d208706fd6
2 changed files with 10 additions and 2 deletions

View File

@ -50,6 +50,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>#
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);

View File

@ -381,8 +381,15 @@ nsapi_error_t AT_CellularNetwork::open_data_channel()
{ {
#if NSAPI_PPP_AVAILABLE #if NSAPI_PPP_AVAILABLE
tr_info("Open data channel in PPP mode"); tr_info("Open data channel in PPP mode");
if (is_supported(AT_CGDATA)) {
_at.cmd_start("AT+CGDATA=\"PPP\","); _at.cmd_start("AT+CGDATA=\"PPP\",");
_at.write_int(_cid); _at.write_int(_cid);
} else {
MBED_ASSERT(_cid >= 0 && _cid <= 99);
char cmd_buf[sizeof("ATD*99***xx#")];
std::sprintf(cmd_buf, "ATD*99***%d#", _cid);
_at.cmd_start(cmd_buf);
}
_at.cmd_stop(); _at.cmd_stop();
_at.resp_start("CONNECT", true); _at.resp_start("CONNECT", true);