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 22
22
#define UDP 0
23
23
#define TCP 1
24
24
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
-
40
25
// Number of retries /
41
26
#define RETRY_COUNT 3
42
27
@@ -228,15 +213,11 @@ int main()
228
213
#else
229
214
dot_thread.start (dot_event);
230
215
#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()
231
218
iface = CellularBase::get_default_instance ();
232
219
MBED_ASSERT (iface);
233
220
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
-
240
221
nsapi_error_t retcode = NSAPI_ERROR_NO_CONNECTION;
241
222
242
223
/* Attempt to connect to a cellular network */
Original file line number Diff line number Diff line change 1
1
{
2
2
"config" : {
3
3
"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
- },
20
4
"echo-server-hostname" : {
21
5
"help" : " Echo server host name." ,
22
6
"value" : " \" echo.mbedcloudtesting.com\" "
42
26
"platform.stdio-baud-rate" : 115200 ,
43
27
"platform.default-serial-baud-rate" : 115200 ,
44
28
"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
46
35
}
47
36
}
48
37
}
You can’t perform that action at this time.
0 commit comments