Cellular: Added support for the Gemalto/EMS31 cellular module

pull/7677/head
Ari Parkkila 2018-08-17 01:16:02 -07:00
parent a14ac31f68
commit 9d0e3d8797
4 changed files with 19 additions and 3 deletions

View File

@ -49,6 +49,9 @@ bool GEMALTO_CINTERION_CellularNetwork::get_modem_stack_type(nsapi_ip_stack_t re
bool GEMALTO_CINTERION_CellularNetwork::has_registration(RegistrationType reg_type)
{
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelEMS31) {
return (reg_type == C_EREG);
}
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelBGS2) {
return (reg_type == C_REG || reg_type == C_GREG);
}

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
#include <stdlib.h>
#include <cstdlib>
#include "GEMALTO_CINTERION_CellularStack.h"
#include "GEMALTO_CINTERION_Module.h"
#include "CellularLog.h"
@ -176,7 +176,6 @@ nsapi_error_t GEMALTO_CINTERION_CellularStack::socket_open_defer(CellularSocket
_at.resp_start();
_at.resp_stop();
_at.cmd_start("AT^SISO=");
_at.write_int(socket->id);
_at.cmd_stop();
@ -483,6 +482,11 @@ nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(Cell
// setup internet connection profile for sockets
bool GEMALTO_CINTERION_CellularStack::create_connection_profile()
{
if (GEMALTO_CINTERION_Module::get_model() == GEMALTO_CINTERION_Module::ModelEMS31) {
// EMS31 connection has only DNS settings and there is no need to modify those here for now
return true;
}
char conParamType[12];
std::sprintf(conParamType, "GPRS%d", (_stack_type == IPV4_STACK) ? 0 : 6);
_at.cmd_start("AT^SICS?");

View File

@ -29,12 +29,17 @@ static const AT_CellularBase::SupportedFeature unsupported_features_els61[] = {
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
};
// unsupported features as per EMS31-US_ATC_V4.9.5
// unsupported features as per BGS2-W_ATC_V00.100
static const AT_CellularBase::SupportedFeature unsupported_features_bgs2[] = {
AT_CellularBase::AT_CGSN_WITH_TYPE,
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
};
// unsupported features as per EMS31-US_ATC_V4.9.5
static const AT_CellularBase::SupportedFeature unsupported_features_ems31[] = {
AT_CellularBase::SUPPORTED_FEATURE_END_MARK
};
GEMALTO_CINTERION_Module::Model GEMALTO_CINTERION_Module::_model;
nsapi_error_t GEMALTO_CINTERION_Module::detect_model(const char *model)
@ -46,6 +51,9 @@ nsapi_error_t GEMALTO_CINTERION_Module::detect_model(const char *model)
} else if (memcmp(model, "BGS2", sizeof("BGS2") - 1) == 0) {
_model = ModelBGS2;
unsupported_features = unsupported_features_bgs2;
} else if (memcmp(model, "EMS31", sizeof("EMS31") - 1) == 0) {
_model = ModelEMS31;
unsupported_features = unsupported_features_ems31;
} else {
tr_error("Cinterion model unsupported %s", model);
return NSAPI_ERROR_UNSUPPORTED;

View File

@ -33,6 +33,7 @@ public:
ModelUnknown = 0,
ModelELS61,
ModelBGS2,
ModelEMS31,
};
static nsapi_error_t detect_model(const char *model);
static Model get_model();