-
Notifications
You must be signed in to change notification settings - Fork 4
/
at_command.h
133 lines (121 loc) · 4.41 KB
/
at_command.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
Copyright (C) 2010 bg <[email protected]>
*/
#ifndef CHAN_QUECTEL_AT_SEND_H_INCLUDED
#define CHAN_QUECTEL_AT_SEND_H_INCLUDED
#include "ast_config.h"
#include "export.h" /* EXPORT_DECL EXPORT_DEF */
#include "dc_config.h" /* call_waiting_t */
#include "mutils.h" /* enum2str_def() ITEMS_OF() */
#define CCWA_CLASS_VOICE 1
#define SMS_INDEX_MAX 256 /* exclusive */
/* AT_COMMANDS_TABLE */
#define AT_CMD_AS_ENUM(cmd, str) CMD_ ## cmd,
#define AT_CMD_AS_STRING(cmd, str) str,
#define AT_COMMANDS_TABLE(_) \
_( USER, "USER'S") \
_( AT, "AT") \
_( AT_A, "at+qpcmv=0;+qpcmv=1,0;a") \
_( AT_CCWA_STATUS, "AT+CCWA?") \
_( AT_CCWA_SET, "AT+CCWA=") \
_( AT_CFUN, "AT+CFUN") \
\
_( AT_CGMI, "AT+CGMI") \
_( AT_CGMM, "AT+CGMM") \
_( AT_CGMR, "AT+CGMR") \
_( AT_CGSN, "AT+CGSN") \
\
_( AT_CHUP, "AT+CHUP") \
_( AT_CIMI, "AT+CIMI") \
_( AT_CVOICE2, "AT+CPCMREG?") \
_( AT_CLIR, "AT+CLIR") \
\
_( AT_CLVL, "AT+CLVL") \
_( AT_CMGD, "AT+CMGD") \
_( AT_CMGF, "AT+CMGF") \
_( AT_CMGR, "AT+CMGR") \
\
_( AT_CMGS, "AT+CMGS") \
_( AT_SMSTEXT, "SMSTEXT") \
_( AT_CNMI, "AT+CNMI") \
_( AT_CNUM, "AT+CNUM") \
\
_( AT_COPS, "AT+COPS?") \
_( AT_COPS_INIT, "AT+COPS=") \
_( AT_CPIN, "AT+CPIN?") \
_( AT_CPMS, "AT+CPMS") \
\
_( AT_CREG, "AT+CEREG?") \
_( AT_CREG_INIT, "AT+CEREG=") \
_( AT_CSCS, "AT+CSCS") \
_( AT_CSQ, "AT+CSQ") \
\
_( AT_CSSN, "AT+CSSN") \
_( AT_CUSD, "AT+CUSD") \
_( AT_CVOICE, "AT+QPCMV?") \
_( AT_D, "AT+CPCMREG=0;D") \
\
_( AT_DDSETEX, "AT+CPCMREG=1") \
_( AT_DDSETEX0, "AT+CPCMREG=0") \
_( AT_DTMF, "AT^DTMF") \
_( AT_E, "ATE") \
\
_( AT_U2DIAG, "AT^U2DIAG") \
_( AT_Z, "ATZ") \
_( AT_CMEE, "AT+CMEE") \
_( AT_CSCA, "AT+CSCA") \
\
_( AT_CHLD_1x, "AT+CHLD=1x") \
_( AT_CHLD_2x, "AT+CHLD=2x") \
_( AT_CHLD_2, "AT+CHLD=2") \
_( AT_CHLD_3, "AT+CHLD=3") \
_( AT_CLCC, "AT+CLCC") \
\
_( AT_QMMS_INIT, "AT+QIDEACT=") \
_( AT_QHTTPURL, "AT+QHTTPURL=") \
_( AT_QHTTPGET, "AT+QHTTPGET=") \
_( AT_QHTTPREAD, "AT+QHTTPREAD=") \
/* AT_COMMANDS_TABLE */
typedef enum {
AT_COMMANDS_TABLE(AT_CMD_AS_ENUM)
} at_cmd_t;
typedef enum {
SUPPRESS_ERROR_DISABLED,
SUPPRESS_ERROR_ENABLED
} at_cmd_suppress_error_t;
/*!
* \brief Get the string representation of the given AT command
* \param cmd -- the command to process
* \return a string describing the given command
*/
INLINE_DECL const char* at_cmd2str (at_cmd_t cmd)
{
static const char * const cmds[] = {
AT_COMMANDS_TABLE(AT_CMD_AS_STRING)
};
return enum2str_def(cmd, cmds, ITEMS_OF(cmds), "UNDEFINED");
}
struct cpvt;
EXPORT_DECL const char *at_cmd2str(at_cmd_t cmd);
EXPORT_DECL int at_enqueue_initialization(struct cpvt *cpvt, at_cmd_t from_command);
EXPORT_DECL int at_enqueue_ping(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_cops(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_sms(struct cpvt *cpvt, const char *number, const char *msg, unsigned validity_min, int report_req, const char *payload, size_t payload_len);
EXPORT_DECL int at_enqueue_ussd(struct cpvt *cpvt, const char *code);
EXPORT_DECL int at_enqueue_dtmf(struct cpvt *cpvt, char digit);
EXPORT_DECL int at_enqueue_set_ccwa(struct cpvt *cpvt, unsigned call_waiting);
EXPORT_DECL int at_enqueue_reset(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_dial(struct cpvt *cpvt, const char *number, int clir);
EXPORT_DECL int at_enqueue_answer(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_user_cmd(struct cpvt *cpvt, const char *input);
EXPORT_DECL void at_retrieve_next_sms(struct cpvt *cpvt, at_cmd_suppress_error_t suppress_error);
EXPORT_DECL int at_enqueue_retrieve_sms(struct cpvt *cpvt, int index, at_cmd_suppress_error_t suppress_error);
EXPORT_DECL int at_enqueue_delete_sms(struct cpvt *cpvt, int index);
EXPORT_DECL int at_enqueue_hangup(struct cpvt *cpvt, int call_idx);
EXPORT_DECL int at_enqueue_volsync(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_clcc(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_activate(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_flip_hold(struct cpvt *cpvt);
EXPORT_DECL int at_enqueue_conference(struct cpvt *cpvt);
EXPORT_DECL void at_hangup_immediality(struct cpvt *cpvt);
#endif /* CHAN_QUECTEL_AT_SEND_H_INCLUDED */