@@ -226,21 +226,24 @@ class CellularNetwork : public NetworkInterface {
226
226
/* * Does all the needed initializations that can fail
227
227
*
228
228
* @remark must be called immediately after constructor.
229
- * @return zero on success
229
+ * @return NSAPI_ERROR_OK on success
230
+ * NSAPI_ERROR_NO_MEMORY on memory failure
230
231
*/
231
232
virtual nsapi_error_t init () = 0;
232
233
233
234
/* * Request registering to network.
234
235
*
235
236
* @param plmn format is in numeric format or 0 for automatic network registration
236
- * @return zero on success
237
+ * @return NSAPI_ERROR_OK on success
238
+ * NSAPI_ERROR_DEVICE_ERROR on failure
237
239
*/
238
240
virtual nsapi_error_t set_registration (const char *plmn = 0 ) = 0;
239
241
240
242
/* * Get the current network registering mode
241
243
*
242
- * @param mode on successful return contains the current network registering mode
243
- * @return zero on success
244
+ * @param mode on successful return contains the current network registering mode
245
+ * @return NSAPI_ERROR_OK on success
246
+ * NSAPI_ERROR_DEVICE_ERROR on failure
244
247
*/
245
248
virtual nsapi_error_t get_network_registering_mode (NWRegisteringMode &mode) = 0;
246
249
@@ -249,17 +252,21 @@ class CellularNetwork : public NetworkInterface {
249
252
* After successful call network class starts to get information about network changes like
250
253
* registration statue, access technology, cell id...
251
254
*
252
- * @param type RegistrationType to set urc on/off
253
- * @param on Controls are urc' active or not
254
- * @return zero on success
255
+ * @param type RegistrationType to set urc on/off
256
+ * @param on Controls are urc active or not
257
+ * @return NSAPI_ERROR_OK on success
258
+ * NSAPI_ERROR_UNSUPPORTED if the modem does not support RegistrationType
259
+ * NSAPI_ERROR_DEVICE_ERROR on failure
255
260
*/
256
261
virtual nsapi_error_t set_registration_urc (RegistrationType type, bool on) = 0;
257
262
258
263
/* * Gets the network registration status.
259
264
*
260
- * @param type see RegistrationType values
261
- * @param status see RegistrationStatus values
262
- * @return zero on success
265
+ * @param type see RegistrationType values
266
+ * @param status see RegistrationStatus values
267
+ * @return NSAPI_ERROR_OK on success
268
+ * NSAPI_ERROR_UNSUPPORTED if the modem does not support RegistrationType
269
+ * NSAPI_ERROR_DEVICE_ERROR on failure
263
270
*/
264
271
virtual nsapi_error_t get_registration_status (RegistrationType type, RegistrationStatus &status) = 0;
265
272
@@ -268,7 +275,8 @@ class CellularNetwork : public NetworkInterface {
268
275
* @param apn Optional name of the network to connect to
269
276
* @param username Optional username for the APN
270
277
* @param password Optional password fot the APN
271
- * @return 0 on success, negative error code on failure
278
+ * @return NSAPI_ERROR_OK on success
279
+ * NSAPI_ERROR_NO_MEMORY on memory failure
272
280
*/
273
281
virtual nsapi_error_t set_credentials (const char *apn,
274
282
const char *username = 0 , const char *password = 0 ) = 0;
@@ -279,30 +287,34 @@ class CellularNetwork : public NetworkInterface {
279
287
* @param type Authentication type to use
280
288
* @param username Optional username for the APN
281
289
* @param password Optional password fot the APN
282
- * @return 0 on success, negative error code on failure
290
+ * @return NSAPI_ERROR_OK on success
291
+ * NSAPI_ERROR_NO_MEMORY on memory failure
283
292
*/
284
293
virtual nsapi_error_t set_credentials (const char *apn, AuthenticationType type,
285
294
const char *username = 0 , const char *password = 0 ) = 0;
286
295
287
296
/* * Request attach to network.
288
297
*
289
298
* @deprecated Parameter timeout will be deprecated. Use mbed-os/features/cellular/framework/API/CellularDevice.h set_timeout instead.
290
- * @param timeout milliseconds to wait for attach response
291
- * @return zero on success
299
+ * @param timeout milliseconds to wait for attach response
300
+ * @return NSAPI_ERROR_OK on success
301
+ * NSAPI_ERROR_DEVICE_ERROR on failure
292
302
*/
293
303
MBED_DEPRECATED_SINCE (" mbed-os-5.9" , " Parameter timeout will be deprecated. Use mbed-os/features/cellular/framework/API/CellularDevice.h set_timeout instead." )
294
304
virtual nsapi_error_t set_attach (int timeout = 10 * 1000 ) = 0;
295
305
296
306
/* * Request attach status from network.
297
307
*
298
- * @param status see AttachStatus values
299
- * @return zero on success
308
+ * @param status see AttachStatus values
309
+ * @return NSAPI_ERROR_OK on success
310
+ * NSAPI_ERROR_DEVICE_ERROR on failure
300
311
*/
301
312
virtual nsapi_error_t get_attach (AttachStatus &status) = 0;
302
313
303
314
/* * Request detach from a network.
304
315
*
305
- * @return zero on success
316
+ * @return NSAPI_ERROR_OK on success
317
+ * NSAPI_ERROR_DEVICE_ERROR on failure
306
318
*/
307
319
virtual nsapi_error_t detach () = 0;
308
320
@@ -312,45 +324,54 @@ class CellularNetwork : public NetworkInterface {
312
324
* @param reports Additional exception reports at maximum rate reached are allowed to be sent [optional]
313
325
* @param time_unit Uplink time unit with values 0=unrestricted, 1=minute, 2=hour, 3=day, 4=week [optional]
314
326
* @param uplink_rate Maximum number of messages per timeUnit [optional]
315
- * @return zero on success
327
+ * @return NSAPI_ERROR_OK on success
328
+ * NSAPI_ERROR_DEVICE_ERROR on case of failure
316
329
*/
317
330
virtual nsapi_error_t get_rate_control (CellularNetwork::RateControlExceptionReports &reports,
318
331
CellularNetwork::RateControlUplinkTimeUnit &time_unit, int &uplink_rate) = 0;
319
332
320
333
/* * Get backoff timer value
321
334
*
322
335
* @param backoff_timer Backoff timer value associated with PDP APN in seconds
323
- * @return zero on success
336
+ * @return NSAPI_ERROR_OK on success
337
+ * NSAPI_ERROR_PARAMETER if no access point is set or found when activating context
338
+ * NSAPI_ERROR_DEVICE_ERROR on failure
324
339
*/
325
340
virtual nsapi_error_t get_apn_backoff_timer (int &backoff_timer) = 0;
326
341
327
342
/* * Sets radio access technology.
328
343
*
329
- * @param rat Radio access technology
330
- * @return zero on success
344
+ * @param rat Radio access technology
345
+ * @return NSAPI_ERROR_OK on success
346
+ * NSAPI_ERROR_UNSUPPORTED if the given rat is RAT_UNKNOWN or inheriting target class
347
+ * has not implemented method set_access_technology_impl(...)
348
+ * OR return value of the inheriting target class set_access_technology_impl(...)
331
349
*/
332
350
virtual nsapi_error_t set_access_technology (RadioAccessTechnology rat) = 0;
333
351
334
352
/* * Get current radio access technology.
335
353
*
336
- * @param rat Radio access technology
337
- * @return zero on success
354
+ * @param rat Radio access technology
355
+ * @return NSAPI_ERROR_OK
338
356
*/
339
357
virtual nsapi_error_t get_access_technology (RadioAccessTechnology &rat) = 0;
340
358
341
359
/* * Scans for operators module can reach.
342
360
*
343
- * @param operators Container of reachable operators and their access technologies
344
- * @param ops_count Number of found operators
345
- * @return zero on success
361
+ * @param operators Container of reachable operators and their access technologies
362
+ * @param ops_count Number of found operators
363
+ * @return NSAPI_ERROR_OK on success
364
+ * NSAPI_ERROR_NO_MEMORY on memory failure
365
+ * NSAPI_ERROR_DEVICE_ERROR on other failures
346
366
*/
347
367
virtual nsapi_error_t scan_plmn (operList_t &operators, int &ops_count) = 0;
348
368
349
369
/* * Set CIoT optimizations.
350
370
*
351
371
* @param supported_opt Supported CIoT EPS optimizations.
352
372
* @param preferred_opt Preferred CIoT EPS optimizations.
353
- * @return zero on success
373
+ * @return NSAPI_ERROR_OK on success
374
+ * NSAPI_ERROR_DEVICE_ERROR on failure
354
375
*/
355
376
virtual nsapi_error_t set_ciot_optimization_config (Supported_UE_Opt supported_opt,
356
377
Preferred_UE_Opt preferred_opt) = 0;
@@ -359,14 +380,20 @@ class CellularNetwork : public NetworkInterface {
359
380
*
360
381
* @param supported_opt Supported CIoT EPS optimizations.
361
382
* @param preferred_opt Preferred CIoT EPS optimizations.
362
- * @return zero on success
383
+ * @return NSAPI_ERROR_OK on success
384
+ * NSAPI_ERROR_DEVICE_ERROR on failure
363
385
*/
364
386
virtual nsapi_error_t get_ciot_optimization_config (Supported_UE_Opt &supported_opt,
365
387
Preferred_UE_Opt &preferred_opt) = 0;
366
388
367
389
/* * Start the interface. Attempts to connect to a cellular network.
368
390
*
369
- * @return 0 on success, negative error code on failure
391
+ * @return NSAPI_ERROR_OK on success
392
+ * NSAPI_ERROR_NO_CONNECTION if fails to find suitable context to activate or activation failed (if not already activated)
393
+ * NSAPI_ERROR_UNSUPPORTED if NetworkStack was not found
394
+ * NSAPI_ERROR_AUTH_FAILURE if password and username were provided and authentication to network failed
395
+ * Also if PPP mode
396
+ * NSAPI_ERROR_DEVICE_ERROR on failure and check more error from nsapi_ppp_connect(...)
370
397
*/
371
398
virtual nsapi_error_t connect () = 0;
372
399
@@ -375,15 +402,24 @@ class CellularNetwork : public NetworkInterface {
375
402
* @param apn Optional name of the network to connect to
376
403
* @param username Optional username for your APN
377
404
* @param password Optional password for your APN
378
- * @return 0 on success, negative error code on failure
405
+ * @return NSAPI_ERROR_OK on success
406
+ * NSAPI_ERROR_NO_CONNECTION if fails to find suitable context to activate or activation failed (if not already activated)
407
+ * NSAPI_ERROR_UNSUPPORTED if NetworkStack was not found
408
+ * NSAPI_ERROR_AUTH_FAILURE if password and username were provided and authentication to network failed
409
+ * NSAPI_ERROR_NO_MEMORY on memory failure
410
+ * Also if PPP mode
411
+ * NSAPI_ERROR_DEVICE_ERROR on failure and check more error from nsapi_ppp_connect(...)
379
412
*/
380
413
virtual nsapi_error_t connect (const char *apn,
381
414
const char *username = 0 , const char *password = 0 ) = 0;
382
415
383
416
/* * Finds the correct PDP context and activates it. If correct PDP context is not found, one is created.
384
417
* Given APN (or not given) and stack type (IPv4/IPv6/dual) are influencing when finding the PDP context.
385
418
*
386
- * @return zero on success
419
+ * @return NSAPI_ERROR_OK on success
420
+ * NSAPI_ERROR_NO_CONNECTION if fails to find suitable context to activate or activation failed (if not already activated)
421
+ * NSAPI_ERROR_UNSUPPORTED if NetworkStack was not found
422
+ * NSAPI_ERROR_AUTH_FAILURE if password and username were provided and authentication to network failed
387
423
*/
388
424
virtual nsapi_error_t activate_context () = 0;
389
425
@@ -392,7 +428,8 @@ class CellularNetwork : public NetworkInterface {
392
428
*
393
429
* @param stack_type the stack type to be used.
394
430
*
395
- * @return NSAPI_ERROR_OK on success
431
+ * @return NSAPI_ERROR_OK on success
432
+ * NSAPI_ERROR_PARAMETER if modem does not support the given stack_type
396
433
*/
397
434
virtual nsapi_error_t set_stack_type (nsapi_ip_stack_t stack_type) = 0;
398
435
@@ -406,35 +443,39 @@ class CellularNetwork : public NetworkInterface {
406
443
/* * Get the relevant information for an active non secondary PDP context.
407
444
*
408
445
* @remark optional params are not updated if not received from network.
409
- * @param params_list reference to linked list which is filled on successful call
410
- * @return 0 on success, negative error code on failure
446
+ * @param params_list reference to linked list, which is filled on successful call
447
+ * @return NSAPI_ERROR_OK on success
448
+ * NSAPI_ERROR_NO_MEMORY on memory failure
449
+ * NSAPI_ERROR_DEVICE_ERROR on other failures
411
450
*/
412
451
virtual nsapi_error_t get_pdpcontext_params (pdpContextList_t ¶ms_list) = 0;
413
452
414
453
/* * Get extended signal quality parameters.
415
454
*
416
- * @param rxlev signal strength level
417
- * @param ber bit error rate
418
- * @param rscp signal code power
419
- * @param ecno ratio of the received energy per PN chip to the total received power spectral density
420
- * @param rsrq signal received quality
421
- * @param rsrp signal received power
422
- * @return NSAPI_ERROR_OK on success, negative error code on failure
455
+ * @param rxlev signal strength level
456
+ * @param ber bit error rate
457
+ * @param rscp signal code power
458
+ * @param ecno ratio of the received energy per PN chip to the total received power spectral density
459
+ * @param rsrq signal received quality
460
+ * @param rsrp signal received power
461
+ * @return NSAPI_ERROR_OK on success
462
+ * NSAPI_ERROR_DEVICE_ERROR on other failures
423
463
*/
424
464
virtual nsapi_error_t get_extended_signal_quality (int &rxlev, int &ber, int &rscp, int &ecno, int &rsrq, int &rsrp) = 0;
425
465
426
466
/* * Get signal quality parameters.
427
467
*
428
- * @param rssi signal strength level
429
- * @param ber bit error rate
430
- * @return NSAPI_ERROR_OK on success, negative error code on failure
468
+ * @param rssi signal strength level
469
+ * @param ber bit error rate
470
+ * @return NSAPI_ERROR_OK on success
471
+ * NSAPI_ERROR_DEVICE_ERROR on other failures
431
472
*/
432
473
virtual nsapi_error_t get_signal_quality (int &rssi, int &ber) = 0;
433
474
434
475
/* * Get cell id.
435
476
*
436
- * @param cell_id cell id
437
- * @return NSAPI_ERROR_OK on success, negative error code on failure
477
+ * @param cell_id cell ID
478
+ * @return NSAPI_ERROR_OK
438
479
*/
439
480
virtual nsapi_error_t get_cell_id (int &cell_id) = 0;
440
481
@@ -445,9 +486,10 @@ class CellularNetwork : public NetworkInterface {
445
486
446
487
/* * Get the operator parameters.
447
488
*
448
- * @param format format of the operator field
449
- * @param operator_params applicable operator param fields filled
450
- * @return NSAPI_ERROR_OK on success, negative error code on failure
489
+ * @param format format of the operator field
490
+ * @param operator_params applicable operator param fields filled
491
+ * @return NSAPI_ERROR_OK on success
492
+ * NSAPI_ERROR_DEVICE_ERROR on case of other failures
451
493
*/
452
494
virtual nsapi_error_t get_operator_params (int &format, operator_t &operator_params) = 0;
453
495
@@ -470,14 +512,17 @@ class CellularNetwork : public NetworkInterface {
470
512
/* * Set blocking status of connect() which by default should be blocking
471
513
*
472
514
* @param blocking true if connect is blocking
473
- * @return 0 on success, negative error code on failure
515
+ * @return NSAPI_ERROR_OK
516
+ * if PPP mode check errors from nsapi_ppp_set_blocking(...)
474
517
*/
475
518
virtual nsapi_error_t set_blocking (bool blocking) = 0;
476
519
477
520
/* * Read operator names
478
521
*
479
- * @param op_names on successful return will contain linked list of operator names.
480
- * @return zero on success
522
+ * @param op_names on successful return contains linked list of operator names.
523
+ * @return NSAPI_ERROR_OK on success
524
+ * NSAPI_ERROR_NO_MEMORY on memory failure
525
+ * NSAPI_ERROR_DEVICE_ERROR on other failures
481
526
*/
482
527
virtual nsapi_error_t get_operator_names (operator_names_list &op_names) = 0;
483
528
};
0 commit comments