nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
sms.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 SMS_H_
8#define SMS_H_
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include <zephyr/types.h>
15#include <sys/types.h>
16
36
46
51#define SMS_MAX_PAYLOAD_LEN_CHARS 160
52
57#define SMS_MAX_ADDRESS_LEN_CHARS 20
58
62struct sms_time {
63 uint8_t year;
64 uint8_t month;
65 uint8_t day;
66 uint8_t hour;
67 uint8_t minute;
68 uint8_t second;
69 int8_t timezone;
70};
71
82 uint8_t length;
84 uint8_t type;
85};
86
94 bool present;
96 uint16_t ref_number;
98 uint8_t total_msgs;
100 uint8_t seq_number;
101};
102
112 uint16_t dest_port;
114 uint16_t src_port;
115};
116
133
142
165
167typedef void (*sms_callback_t)(struct sms_data *const data, void *context);
168
189int sms_register_listener(sms_callback_t listener, void *context);
190
199void sms_unregister_listener(int handle);
200
221int sms_send_text(const char *number, const char *text);
222
250int sms_send(const char *number, const uint8_t *data, uint16_t data_len, enum sms_data_type type);
251
254#ifdef __cplusplus
255}
256#endif
257
258#endif /* SMS_H_ */
int sms_register_listener(sms_callback_t listener, void *context)
Register a new listener to SMS library.
void(* sms_callback_t)(struct sms_data *const data, void *context)
SMS listener callback function.
Definition sms.h:167
#define SMS_MAX_ADDRESS_LEN_CHARS
Maximum length of SMS address, i.e., phone number, in characters as specified in 3GPP TS 23....
Definition sms.h:57
#define SMS_MAX_PAYLOAD_LEN_CHARS
Maximum length of SMS in number of characters as specified in 3GPP TS 23.038 Section 4 and Section 6....
Definition sms.h:51
void sms_unregister_listener(int handle)
Unregister a listener.
int sms_send_text(const char *number, const char *text)
Send SMS message as ASCII string with ISO-8859-15 extension.
int sms_send(const char *number, const uint8_t *data, uint16_t data_len, enum sms_data_type type)
Send SMS message in given message type.
sms_type
SMS message type.
Definition sms.h:30
@ SMS_TYPE_DELIVER
SMS-DELIVER message type.
Definition sms.h:32
@ SMS_TYPE_STATUS_REPORT
SMS-STATUS-REPORT message type.
Definition sms.h:34
sms_data_type
SMS data type.
Definition sms.h:40
@ SMS_DATA_TYPE_GSM7BIT
GSM 7 bit Default Alphabet as specified in 3GPP TS 23.038 Section 6.2.
Definition sms.h:44
@ SMS_DATA_TYPE_ASCII
ASCII string with ISO-8859-15 extension.
Definition sms.h:42
uint8_t type
Address type as specified in 3GPP TS 23.040 Section 9.1.2.5.
Definition sms.h:84
uint8_t length
Address length in number of characters.
Definition sms.h:82
char address_str[20+1]
Address in NUL-terminated string format.
Definition sms.h:80
SMS address, i.e., phone number.
Definition sms.h:78
int payload_len
Length of the payload buffer.
Definition sms.h:151
uint8_t payload[160+1]
SMS message payload.
Definition sms.h:163
union sms_header header
SMS header.
Definition sms.h:148
enum sms_type type
Received message type.
Definition sms.h:146
SMS PDU data.
Definition sms.h:144
struct sms_time time
Timestamp.
Definition sms.h:125
struct sms_udh_concat concatenated
Concatenated short message information.
Definition sms.h:131
struct sms_udh_app_port app_port
Application port addressing information.
Definition sms.h:129
struct sms_address originating_address
Originating address, i.e., phone number.
Definition sms.h:127
SMS-DELIVER message header.
Definition sms.h:123
uint8_t year
Year. Last two digits of the year.
Definition sms.h:63
uint8_t hour
Hour.
Definition sms.h:66
uint8_t second
Second.
Definition sms.h:68
uint8_t month
Month.
Definition sms.h:64
int8_t timezone
Timezone in quarters of an hour.
Definition sms.h:69
uint8_t day
Day.
Definition sms.h:65
uint8_t minute
Minute.
Definition sms.h:67
SMS time information specified in 3GPP TS 23.040 Section 9.2.3.11.
Definition sms.h:62
uint16_t src_port
Source port.
Definition sms.h:114
uint16_t dest_port
Destination port.
Definition sms.h:112
bool present
Indicates whether this field is present in the SMS message.
Definition sms.h:110
SMS application port addressing information.
Definition sms.h:108
bool present
Indicates whether this field is present in the SMS message.
Definition sms.h:94
uint8_t total_msgs
Maximum number of short messages in the concatenated short message.
Definition sms.h:98
uint16_t ref_number
Concatenated short message reference number.
Definition sms.h:96
uint8_t seq_number
Sequence number of the current short message.
Definition sms.h:100
SMS concatenated short message information.
Definition sms.h:92
struct sms_deliver_header deliver
Definition sms.h:140
SMS header.
Definition sms.h:139