AT command notifications

AT command notifications can be dispatched to registered modules. Modules can register a callback function to receive AT command notifications as raw string. Multiple instances, which can be identified by pointers to contexts, are also supported. Modules can de-register the callback function to stop receiving notifications.

API documentation

Header file: include/modem/at_notif.h
Source file: lib/at_notif/at_notif.c
group at_notif

Public APIs for the AT command notification manager.

Typedefs

typedef void (*at_notif_handler_t)(void *context, const char *response)

Because this driver let multiple threads share the same socket, it must make sure that the correct thread gets the correct data returned from the AT interface. Notifications will be dispatched to handlers registered using the at_notif_register_handler() function. Handlers can be de-registered using the at_notif_deregister_handler() function.

Parameters
  • context – Pointer to context provided by the module which has registered the handler.

  • response – Null terminated string containing the modem message

Functions

int at_notif_init(void)

Initialize AT command notification manager.

Returns

Zero on success, non-zero otherwise.

int at_notif_register_handler(void *context, at_notif_handler_t handler)

Function to register AT command notification handler.

Note

If the same combination of context and handler exists in the memory, then the request will be ignored and command execution will be regarded as finished successfully.

Parameters
  • context – Pointer to context provided by the module which has registered the handler.

  • handler – Pointer to a received notification handler function of type at_notif_handler_t.

Returns 0

If command execution was successful.

Returns -ENOBUFS

If memory cannot be allocated.

Returns -EINVAL

If handler is a NULL pointer.

int at_notif_deregister_handler(void *context, at_notif_handler_t handler)

Function to de-register AT command notification handler.

Parameters
  • context – Pointer to context provided by the module which has registered the handler.

  • handler – Pointer to a received notification handler function of type at_notif_handler_t.

Returns 0

If command execution was successful.

Returns -ENXIO

If the combination of context and handler cannot be found.

Returns -EINVAL

If handler is a NULL pointer.