@@ -29,6 +29,17 @@ GEMALTO_CINTERION::Module GEMALTO_CINTERION::_module;
2929
3030GEMALTO_CINTERION::GEMALTO_CINTERION (FileHandle *fh) : AT_CellularDevice(fh)
3131{
32+ #if defined(MBED_CONF_GEMALTO_CINTERION_ELS61)
33+ init_module_els61 ();
34+ #elif defined(MBED_CONF_GEMALTO_CINTERION_BGS2)
35+ init_module_bgs2 ();
36+ #elif defined(MBED_CONF_GEMALTO_CINTERION_EMS31)
37+ init_module_ems31 ();
38+ #elif defined(MBED_CONF_GEMALTO_CINTERION_EHS5E)
39+ init_module_ehs5e ();
40+ #else
41+ init_module_tx62 ();
42+ #endif
3243}
3344
3445AT_CellularContext *GEMALTO_CINTERION::create_context_impl (ATHandler &at, const char *apn, bool cp_req, bool nonip_req)
@@ -60,35 +71,7 @@ nsapi_error_t GEMALTO_CINTERION::init()
6071 if (err != NSAPI_ERROR_OK) {
6172 return err;
6273 }
63-
64- CellularInformation *information = open_information ();
65- if (!information) {
66- return NSAPI_ERROR_NO_MEMORY;
67- }
68- char model[sizeof (" EHS5-E" ) + 1 ]; // sizeof need to be long enough to hold just the model text
69- nsapi_error_t ret = information->get_model (model, sizeof (model));
70- close_information ();
71- if (ret != NSAPI_ERROR_OK) {
72- tr_error (" Cellular model not found!" );
73- return NSAPI_ERROR_DEVICE_ERROR;
74- }
75- if (memcmp (model, " ELS61" , sizeof (" ELS61" ) - 1 ) == 0 ) {
76- init_module_els61 ();
77- } else if (memcmp (model, " BGS2" , sizeof (" BGS2" ) - 1 ) == 0 ) {
78- init_module_bgs2 ();
79- } else if (memcmp (model, " EMS31" , sizeof (" EMS31" ) - 1 ) == 0 ) {
80- init_module_ems31 ();
81- } else if (memcmp (model, " EHS5-E" , sizeof (" EHS5-E" ) - 1 ) == 0 ) {
82- init_module_ehs5e ();
83- } else if (memcmp (model, " TX62" , sizeof (" TX62" ) - 1 ) == 0 ) {
84- init_module_tx62 ();
85- } else {
86- tr_error (" Cinterion model unsupported %s" , model);
87- return NSAPI_ERROR_UNSUPPORTED;
88- }
89- tr_info (" Cinterion model %s (%d)" , model, _module);
9074 set_at_urcs ();
91-
9275 return NSAPI_ERROR_OK;
9376}
9477
0 commit comments