nRF Connect SDK API 3.1.99
Loading...
Searching...
No Matches
modem_slm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef MODEM_SLM_H_
8#define MODEM_SLM_H_
9
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <stddef.h>
25#include <stdbool.h>
26#include <zephyr/types.h>
27#include <zephyr/kernel.h>
28#include <zephyr/sys/util_macro.h>
29#include <zephyr/toolchain.h>
30
32#define SLM_AT_CMD_RESPONSE_MAX_LEN 2100
33
44
57typedef void (*slm_data_handler_t)(const uint8_t *data, size_t datalen);
58
64typedef void (*slm_ind_handler_t)(void);
65
73
78
88int modem_slm_register_ind(slm_ind_handler_t handler, bool wakeup);
89
100
114int modem_slm_send_cmd(const char *const command, uint32_t timeout);
115
124int modem_slm_send_data(const uint8_t *const data, size_t datalen);
125
131typedef void (*slm_monitor_handler_t)(const char *notif);
132
138 const char *filter;
142 uint8_t paused;
143};
144
146#define MON_ANY NULL
148#define MON_PAUSED 1
150#define MON_ACTIVE 0
151
162#define SLM_MONITOR(name, _filter, _handler, ...) \
163 static void _handler(const char *); \
164 static STRUCT_SECTION_ITERABLE(slm_monitor_entry, name) = { \
165 .filter = _filter, \
166 .handler = _handler, \
167 COND_CODE_1(__VA_ARGS__, (.paused = __VA_ARGS__,), ()) \
168 }
169
177static inline void slm_monitor_pause(struct slm_monitor_entry *mon)
178{
179 mon->paused = MON_PAUSED;
180}
181
189static inline void slm_monitor_resume(struct slm_monitor_entry *mon)
190{
191 mon->paused = MON_ACTIVE;
192}
193
194#ifdef __cplusplus
195}
196#endif
197
200#endif /* MODEM_SLM_H_ */
at_cmd_state
AT command result codes.
Definition modem_slm.h:37
@ AT_CMD_OK
Definition modem_slm.h:38
@ AT_CMD_ERROR_CMS
Definition modem_slm.h:40
@ AT_CMD_ERROR_CME
Definition modem_slm.h:41
@ AT_CMD_ERROR
Definition modem_slm.h:39
@ AT_CMD_PENDING
Definition modem_slm.h:42
void(* slm_ind_handler_t)(void)
Definition modem_slm.h:64
int modem_slm_uninit(void)
Un-initialize Modem SLM library.
int modem_slm_register_ind(slm_ind_handler_t handler, bool wakeup)
Register callback for.
int modem_slm_send_data(const uint8_t *const data, size_t datalen)
Function to send raw data in SLM data mode.
void(* slm_monitor_handler_t)(const char *notif)
SLM monitor callback.
Definition modem_slm.h:131
int modem_slm_power_pin_toggle(void)
Toggle power pin of the nRF91 Series device configured with.
int modem_slm_send_cmd(const char *const command, uint32_t timeout)
Function to send an AT command in SLM command mode.
static void slm_monitor_resume(struct slm_monitor_entry *mon)
Resume monitor.
Definition modem_slm.h:189
int modem_slm_init(slm_data_handler_t handler)
Initialize Modem SLM library.
#define MON_ACTIVE
Definition modem_slm.h:150
#define MON_PAUSED
Definition modem_slm.h:148
static void slm_monitor_pause(struct slm_monitor_entry *mon)
Pause monitor.
Definition modem_slm.h:177
void(* slm_data_handler_t)(const uint8_t *data, size_t datalen)
Definition modem_slm.h:57
const char * filter
Definition modem_slm.h:138
uint8_t paused
Definition modem_slm.h:142
const slm_monitor_handler_t handler
Definition modem_slm.h:140
SLM monitor entry.
Definition modem_slm.h:136