nrfxlib API 2.8.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#include <nrf_modem_toolchain.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
26#define NRF_MODEM_AT_ERROR 1
28#define NRF_MODEM_AT_CME_ERROR 2
30#define NRF_MODEM_AT_CMS_ERROR 3
31
40typedef void (*nrf_modem_at_notif_handler_t)(const char *notif);
41
47typedef void (*nrf_modem_at_cfun_handler_t)(int mode);
48
60
69
90__nrf_modem_printf_like(1, 2)
91int nrf_modem_at_printf(const char *fmt, ...);
92
113__nrf_modem_scanf_like(2, 3)
114int nrf_modem_at_scanf(const char *cmd, const char *fmt, ...);
115
137__nrf_modem_printf_like(3, 4)
138int nrf_modem_at_cmd(void *buf, size_t len, const char *fmt, ...);
139
148typedef void (*nrf_modem_at_resp_handler_t)(const char *resp);
149
172__nrf_modem_printf_like(2, 3)
173int nrf_modem_at_cmd_async(nrf_modem_at_resp_handler_t callback, const char *fmt, ...);
174
192typedef int (*nrf_modem_at_cmd_custom_handler_t)(char *buf, size_t len, char *at_cmd);
193
207
224int nrf_modem_at_cmd_custom_set(struct nrf_modem_at_cmd_custom *custom_commands, size_t len);
225
243
254static inline int nrf_modem_at_err_type(int error)
255{
256 return (error & 0x00ff0000) >> 16;
257}
258
267static inline int nrf_modem_at_err(int error)
268{
269 return (error & 0xff00ffff);
270}
271
272#ifdef __cplusplus
273}
274#endif
275
276#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:40
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:254
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:192
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:47
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:267
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:148
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:205
const nrf_modem_at_cmd_custom_handler_t callback
Definition nrf_modem_at.h:203
const char *const cmd
Definition nrf_modem_at.h:201
Custom AT command.
Definition nrf_modem_at.h:199