nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
slm_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef SLM_UTIL_
8#define SLM_UTIL_
9
15#include "slm_trap_macros.h"
16#include <modem/at_parser.h>
17#include <modem/lte_lc.h>
18#include <zephyr/logging/log.h>
19#include <zephyr/net/socket.h>
20#include <stdbool.h>
21#include <hal/nrf_gpio.h>
22
23extern struct k_work_q slm_work_q; /* SLM's work queue. */
24
27
30
32FUNC_NORETURN void slm_reset(void);
33
34void slm_enter_idle(void);
35void slm_enter_sleep(void);
37
39int slm_indicate(void);
40
44int slm_util_at_printf(const char *fmt, ...);
45
49int slm_util_at_scanf(const char *cmd, const char *fmt, ...);
50
58int slm_util_at_cmd_no_intercept(char *buf, size_t len, const char *at_cmd);
59
68bool slm_util_casecmp(const char *str1, const char *str2);
69
78bool slm_util_hexstr_check(const uint8_t *data, uint16_t data_len);
79
91int slm_util_htoa(const uint8_t *hex, uint16_t hex_len, char *ascii, uint16_t ascii_len);
92
104int slm_util_atoh(const char *ascii, uint16_t ascii_len, uint8_t *hex, uint16_t hex_len);
105
122int util_string_get(struct at_parser *parser, size_t index, char *value, size_t *len);
123
136int util_string_to_float_get(struct at_parser *parser, size_t index, float *value);
137
150int util_string_to_double_get(struct at_parser *parser, size_t index, double *value);
151
159void util_get_ip_addr(int cid, char addr4[INET_ADDRSTRLEN], char addr6[INET6_ADDRSTRLEN]);
160
171int util_str_to_int(const char *str, int base, int *output);
172
188int util_resolve_host(int cid, const char *host, uint16_t port, int family, struct sockaddr *sa);
189
200int util_get_peer_addr(struct sockaddr *peer, char addr[static INET6_ADDRSTRLEN], uint16_t *port);
203#endif /* SLM_UTIL_ */
lte_lc_func_mode
Definition lte_lc.h:153
bool slm_is_modem_functional_mode(enum lte_lc_func_mode mode)
int util_resolve_host(int cid, const char *host, uint16_t port, int family, struct sockaddr *sa)
Resolve remote host by host name or IP address.
int util_get_peer_addr(struct sockaddr *peer, char addr[static INET6_ADDRSTRLEN], uint16_t *port)
Get peer IP address and port in printable format.
int slm_util_at_scanf(const char *cmd, const char *fmt,...)
void slm_enter_idle(void)
bool slm_util_hexstr_check(const uint8_t *data, uint16_t data_len)
Detect hexdecimal string data type.
int slm_util_at_cmd_no_intercept(char *buf, size_t len, const char *at_cmd)
int slm_power_off_modem(void)
Puts the modem in minimal function mode.
struct k_work_q slm_work_q
FUNC_NORETURN void slm_reset(void)
Performs a reset of the SiP.
int slm_util_htoa(const uint8_t *hex, uint16_t hex_len, char *ascii, uint16_t ascii_len)
Encode hex array to hexdecimal string (ASCII text)
int slm_indicate(void)
Temporarily sets the indicate pin high.
void util_get_ip_addr(int cid, char addr4[INET_ADDRSTRLEN], char addr6[INET6_ADDRSTRLEN])
use AT command to get IPv4 and IPv6 addresses for specified PDN
int slm_util_atoh(const char *ascii, uint16_t ascii_len, uint8_t *hex, uint16_t hex_len)
Decode hexdecimal string (ASCII text) to hex array.
bool slm_util_casecmp(const char *str1, const char *str2)
Compare string ignoring case.
int util_string_to_float_get(struct at_parser *parser, size_t index, float *value)
Get float value from string value input in AT command.
int util_string_get(struct at_parser *parser, size_t index, char *value, size_t *len)
Get string value from AT command with length check.
int slm_util_at_printf(const char *fmt,...)
int util_string_to_double_get(struct at_parser *parser, size_t index, double *value)
Get double value from string value input in AT command.
void slm_enter_sleep(void)
void slm_enter_shutdown(void)
int util_str_to_int(const char *str, int base, int *output)
convert string to integer
AT parser.
Definition at_parser.h:45
Set of parser variables needed for parser framework to operate.
Definition parser.h:55