Digi XBee(R) ANSI C Host Library
sms.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Digi International Inc.,
3  * All rights not expressly granted are reserved.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
7  * You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
10  * =======================================================================
11  */
12 
20 #ifndef XBEE_SMS_H
21 #define XBEE_SMS_H
22 
23 #include "xbee/platform.h"
24 #include "xbee/device.h"
25 
26 #if !XBEE_CELLULAR_ENABLED
27  #error "XBEE_CELLULAR_ENABLED must be defined as non-zero " \
28  "to use this header."
29 #endif
30 
32 
34 #define XBEE_FRAME_TRANSMIT_SMS 0x1F
35 
37 #define XBEE_FRAME_RECEIVE_SMS 0x9F
38 
39 #define XBEE_SMS_MAX_PHONE_LENGTH 20
40 #define XBEE_SMS_MAX_MESSAGE_LENGTH 160
41 
44 typedef XBEE_PACKED(xbee_frame_transmit_sms_t, {
45  uint8_t frame_type;
46  uint8_t frame_id;
47  uint8_t options;
48  char phone[XBEE_SMS_MAX_PHONE_LENGTH];
50 
52  char message[XBEE_SMS_MAX_MESSAGE_LENGTH];
54 
57 typedef XBEE_PACKED(xbee_frame_receive_sms_t, {
58  uint8_t frame_type;
59  char phone[XBEE_SMS_MAX_PHONE_LENGTH];
61 
63  char message[1];
65 
66 typedef XBEE_PACKED(xbee_header_transmit_sms_t, {
67  uint8_t frame_type;
68  uint8_t frame_id;
69  uint8_t options;
70  char phone[XBEE_SMS_MAX_PHONE_LENGTH];
73 
92 int xbee_sms_send(xbee_dev_t *xbee, const char *phone, const char *message,
93  uint16_t options);
94 
95 // XBEE_SMS_SEND_OPT_xxx values from 0x0001 to 0x0080 reserved for
96 // xbee_frame_transmit_sms_t.options.
97 #define XBEE_SMS_SEND_OPT_NO_STATUS 0x8000
98 
110 int xbee_sms_receive_dump(xbee_dev_t *xbee, const void FAR *raw,
111  uint16_t length, void FAR *context);
112 
114 
115 // If compiling in Dynamic C, automatically #use the appropriate C file.
116 #ifdef __DC__
117  #use "xbee_sms.c"
118 #endif
119 
120 #endif
121 
#define FAR
On platforms with "far" pointers, define to the proper keyword; empty definition if not required...
Definition: platform.h:396
#define XBEE_BEGIN_DECLS
Macro defined to.
Definition: platform.h:41
Common header for Hardware Abstraction Layer.
Format of XBee API frame type 0x9F (XBEE_FRAME_RECEIVE_SMS); received from XBee by host...
Definition: sms.h:64
unsigned short uint16_t
16-bit unsigned integer
Definition: platform_config.h:41
int xbee_sms_send(xbee_dev_t *xbee, const char *phone, const char *message, uint16_t options)
Send an SMS message.
Definition: xbee_sms.c:24
unsigned char uint8_t
8-bit unsigned integer
Definition: platform_config.h:39
int xbee_sms_receive_dump(xbee_dev_t *xbee, const void FAR *raw, uint16_t length, void FAR *context)
Dump received SMS message to stdout.
Definition: xbee_sms.c:55
Format of XBee API frame type 0x1F (XBEE_FRAME_TRANSMIT_SMS); sent from host to XBee.
Definition: sms.h:53
Definition: device.h:361
< XBEE_FRAME_TRANSMIT_SMS (0x1F)
Definition: sms.h:72
#define XBEE_END_DECLS
Macro defined to.
Definition: platform.h:42