nrfxlib API 2.7.99
Loading...
Searching...
No Matches
nrf_modem_at.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef NRF_MODEM_AT_H__
15#define NRF_MODEM_AT_H__
16
17#include <stddef.h>
18#include <stdbool.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
25#define NRF_MODEM_AT_ERROR 1
27#define NRF_MODEM_AT_CME_ERROR 2
29#define NRF_MODEM_AT_CMS_ERROR 3
30
39typedef void (*nrf_modem_at_notif_handler_t)(const char *notif);
40
46typedef void (*nrf_modem_at_cfun_handler_t)(int mode);
47
59
68
89int nrf_modem_at_printf(const char *fmt, ...);
90
111int nrf_modem_at_scanf(const char *cmd, const char *fmt, ...);
112
134int nrf_modem_at_cmd(void *buf, size_t len, const char *fmt, ...);
135
144typedef void (*nrf_modem_at_resp_handler_t)(const char *resp);
145
168int nrf_modem_at_cmd_async(nrf_modem_at_resp_handler_t callback, const char *fmt, ...);
169
187typedef int (*nrf_modem_at_cmd_custom_handler_t)(char *buf, size_t len, char *at_cmd);
188
196 const char * const cmd;
201};
202
219int nrf_modem_at_cmd_custom_set(struct nrf_modem_at_cmd_custom *custom_commands, size_t len);
220
238
249static inline int nrf_modem_at_err_type(int error)
250{
251 return (error & 0x00ff0000) >> 16;
252}
253
262static inline int nrf_modem_at_err(int error)
263{
264 return (error & 0xff00ffff);
265}
266
267#ifdef __cplusplus
268}
269#endif
270
271#endif /* NRF_MODEM_AT_H__ */
int nrf_modem_at_sem_timeout_set(int timeout_ms)
Configure how long to wait for ongoing AT commands to complete when sending AT commands.
int nrf_modem_at_scanf(const char *cmd, const char *fmt,...)
Send an AT command to the modem and read the formatted response into the supplied argument list.
void(* nrf_modem_at_notif_handler_t)(const char *notif)
AT Notification handler prototype.
Definition: nrf_modem_at.h:39
static int nrf_modem_at_err_type(int error)
Return the error type represented by the return value of nrf_modem_at_printf and nrf_modem_at_cmd.
Definition: nrf_modem_at.h:249
int(* nrf_modem_at_cmd_custom_handler_t)(char *buf, size_t len, char *at_cmd)
AT command handler prototype.
Definition: nrf_modem_at.h:187
int nrf_modem_at_notif_handler_set(nrf_modem_at_notif_handler_t callback)
Set a handler function for AT notifications.
void(* nrf_modem_at_cfun_handler_t)(int mode)
AT CFUN handler prototype.
Definition: nrf_modem_at.h:46
void nrf_modem_at_cfun_handler_set(nrf_modem_at_cfun_handler_t handler)
Set a handler function for CFUN AT commands.
int nrf_modem_at_cmd(void *buf, size_t len, const char *fmt,...)
Send a formatted AT command to the modem and receive the response into the supplied buffer.
static int nrf_modem_at_err(int error)
Retrieve the specific CME or CMS error from the return value of a nrf_modem_at_printf or nrf_modem_at...
Definition: nrf_modem_at.h:262
int nrf_modem_at_printf(const char *fmt,...)
Send a formatted AT command to the modem.
void(* nrf_modem_at_resp_handler_t)(const char *resp)
AT response handler prototype.
Definition: nrf_modem_at.h:144
int nrf_modem_at_cmd_async(nrf_modem_at_resp_handler_t callback, const char *fmt,...)
Send a formatted AT command to the modem and receive the response asynchronously via a callback.
int nrf_modem_at_cmd_custom_set(struct nrf_modem_at_cmd_custom *custom_commands, size_t len)
Set a list of custom AT commands that are implemented in the application.
size_t cmd_strlen
Definition: nrf_modem_at.h:200
const nrf_modem_at_cmd_custom_handler_t callback
Definition: nrf_modem_at.h:198
const char *const cmd
Definition: nrf_modem_at.h:196
Custom AT command.
Definition: nrf_modem_at.h:194