@@ -383,73 +383,44 @@ class LoRaWANInterface: public LoRaWANBase {
383
383
virtual int16_t receive (uint8_t * data, uint16_t length, uint8_t & port, int & flags);
384
384
385
385
/* * Add application callbacks to the stack.
386
- *
387
- * 'lorawan_app_callbacks' is a structure that holds pointers to the application
388
- * provided methods which are needed to be called in response to certain
389
- * requests. The structure is default constructed to set all pointers to NULL.
390
- * So if the user does not provide the pointer, a response will not be posted.
391
- * However, the 'lorawan_events' callback is mandatory to be provided as it
392
- * contains essential events.
393
- *
394
- * Events that can be posted to user via 'lorawan_events' are:
395
- *
396
- * CONNECTED - When the connection is complete
397
- * DISCONNECTED - When the protocol is shut down in response to disconnect()
398
- * TX_DONE - When a packet is sent
399
- * TX_TIMEOUT, - When stack was unable to send packet in TX window
400
- * TX_ERROR, - A general TX error
401
- * TX_CRYPTO_ERROR, - If MIC fails, or any other crypto relted error
402
- * TX_SCHEDULING_ERROR, - When stack is unable to schedule packet
403
- * RX_DONE, - When there is something to receive
404
- * RX_TIMEOUT, - Not yet mapped
405
- * RX_ERROR - A general RX error
406
- *
407
- * Other responses to certain standard requests are an item for the future.
408
- * For example, a link check request could be sent whenever the device tries
409
- * to send a message and if the network server responds with a link check resposne,
410
- * the stack notifies the application be calling the appropriate method. For example,
411
- * 'link_check_resp' callback could be used to collect a response for a link check
412
- * request MAC command and the result is thus transported to the application
413
- * via callback function provided.
414
- *
415
- * As can be seen from declaration, mbed::Callback<void(uint8_t, uint8_t)> *link_check_resp)
416
- * carries two parameters. First one is Demodulation Margin and the second one
417
- * is number of gateways involved in the path to network server.
418
- *
419
- * An example of using this API with a latch onto 'lorawan_events' could be:
420
- *
421
- * LoRaWANInterface lorawan(radio);
422
- * lorawan_app_callbacks cbs;
423
- * static void my_event_handler();
424
- *
425
- * int main()
426
- * {
427
- * lorawan.initialize(&queue);
428
- * cbs.events = mbed::callback(my_event_handler);
429
- * lorawan.add_app_callbacks(&cbs);
430
- * lorawan.connect();
431
- * }
432
- *
433
- * static void my_event_handler(lora_events_t events)
434
- * {
435
- * switch(events) {
436
- * case CONNECTED:
437
- * //do something
438
- * break;
439
- * case DISCONNECTED:
440
- * //do something
441
- * break;
442
- * case TX_DONE:
443
- * //do something
444
- * break;
445
- * default:
446
- * break;
447
- * }
448
- * }
449
- *
450
- * @param callbacks A pointer to the structure containing application
451
- * callbacks.
452
- */
386
+ *
387
+ * An example of using this API with a latch onto 'lorawan_events' could be:
388
+ *
389
+ * LoRaWANInterface lorawan(radio);
390
+ * lorawan_app_callbacks_t cbs;
391
+ * static void my_event_handler();
392
+ *
393
+ * int main()
394
+ * {
395
+ * lorawan.initialize();
396
+ * cbs.lorawan_events = mbed::callback(my_event_handler);
397
+ * lorawan.add_app_callbacks(&cbs);
398
+ * lorawan.connect();
399
+ * }
400
+ *
401
+ * static void my_event_handler(lora_events_t events)
402
+ * {
403
+ * switch(events) {
404
+ * case CONNECTED:
405
+ * //do something
406
+ * break;
407
+ * case DISCONNECTED:
408
+ * //do something
409
+ * break;
410
+ * case TX_DONE:
411
+ * //do something
412
+ * break;
413
+ * default:
414
+ * break;
415
+ * }
416
+ * }
417
+ *
418
+ * @param callbacks A pointer to the structure containing application
419
+ * callbacks.
420
+ *
421
+ * @return LORAWAN_STATUS_OK on success, a negative error
422
+ * code on failure.
423
+ */
453
424
virtual lorawan_status_t add_app_callbacks (lorawan_app_callbacks_t *callbacks);
454
425
455
426
/* * Change device class
0 commit comments