Merge pull request #7870 from AriParkkila/cell-cgdata

Cellular: Support for GPRS dial-up
pull/7903/head
Cruz Monrreal 2018-08-27 10:29:44 -05:00 committed by GitHub
commit 7ac4bf4a4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -50,6 +50,7 @@ public:
*/
enum SupportedFeature {
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
};
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
tr_info("Open data channel in PPP mode");
_at.cmd_start("AT+CGDATA=\"PPP\",");
_at.write_int(_cid);
if (is_supported(AT_CGDATA)) {
_at.cmd_start("AT+CGDATA=\"PPP\",");
_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.resp_start("CONNECT", true);