File tree Expand file tree Collapse file tree 2 files changed +8
-38
lines changed Expand file tree Collapse file tree 2 files changed +8
-38
lines changed Original file line number Diff line number Diff line change 2222#define UDP 0
2323#define TCP 1
2424
25- // SIM pin code goes here
26- #ifndef MBED_CONF_APP_SIM_PIN_CODE
27- # define MBED_CONF_APP_SIM_PIN_CODE " 1234"
28- #endif
29-
30- #ifndef MBED_CONF_APP_APN
31- # define MBED_CONF_APP_APN " internet"
32- #endif
33- #ifndef MBED_CONF_APP_USERNAME
34- # define MBED_CONF_APP_USERNAME NULL
35- #endif
36- #ifndef MBED_CONF_APP_PASSWORD
37- # define MBED_CONF_APP_PASSWORD NULL
38- #endif
39-
4025// Number of retries /
4126#define RETRY_COUNT 3
4227
@@ -228,15 +213,11 @@ int main()
228213#else
229214 dot_thread.start (dot_event);
230215#endif // #if MBED_CONF_MBED_TRACE_ENABLE
216+
217+ // sim pin, apn, credentials and possible plmn are taken atuomtically from json when using get_default_instance()
231218 iface = CellularBase::get_default_instance ();
232219 MBED_ASSERT (iface);
233220
234- /* Set Pin code for SIM card */
235- iface->set_sim_pin (MBED_CONF_APP_SIM_PIN_CODE);
236-
237- /* Set network credentials here, e.g., APN */
238- iface->set_credentials (MBED_CONF_APP_APN, MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD);
239-
240221 nsapi_error_t retcode = NSAPI_ERROR_NO_CONNECTION;
241222
242223 /* Attempt to connect to a cellular network */
Original file line number Diff line number Diff line change 11{
22 "config" : {
33 "sock-type" : " TCP" ,
4- "sim-pin-code" : {
5- "help" : " SIM PIN code, set to 0 if none" ,
6- "value" : " \" 1234\" "
7- },
8- "apn" : {
9- "help" : " The APN string to use for this SIM/network, set to 0 if none" ,
10- "value" : " \" internet\" "
11- },
12- "username" : {
13- "help" : " The user name string to use for this APN, set to zero if none" ,
14- "value" : 0
15- },
16- "password" : {
17- "help" : " The password string to use for this APN, set to 0 if none" ,
18- "value" : 0
19- },
204 "echo-server-hostname" : {
215 "help" : " Echo server host name." ,
226 "value" : " \" echo.mbedcloudtesting.com\" "
4226 "platform.stdio-baud-rate" : 115200 ,
4327 "platform.default-serial-baud-rate" : 115200 ,
4428 "platform.stdio-buffered-serial" : true ,
45- "cellular.debug-at" : false
29+ "cellular.debug-at" : false ,
30+ "nsapi.default-cellular-plmn" : 0 ,
31+ "nsapi.default-cellular-sim-pin" : " \" 1234\" " ,
32+ "nsapi.default-cellular-apn" : 0 ,
33+ "nsapi.default-cellular-username" : 0 ,
34+ "nsapi.default-cellular-password" : 0
4635 }
4736 }
4837}
You can’t perform that action at this time.
0 commit comments