forked from jstasiak/asterisk-chan-dongle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
at_command.h
171 lines (140 loc) · 3.73 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
Copyright (C) 2010 bg <[email protected]>
*/
#ifndef CHAN_DONGLE_AT_SEND_H_INCLUDED
#define CHAN_DONGLE_AT_SEND_H_INCLUDED
#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
/* magic order !!! keep order of this values like in at_cmd2str()
*/
typedef enum {
CMD_USER = 0,
CMD_AT,
CMD_AT_A,
CMD_AT_CCWA_STATUS,
CMD_AT_CCWA_SET,
CMD_AT_CFUN,
CMD_AT_CGMI,
CMD_AT_CGMM,
CMD_AT_CGMR,
CMD_AT_CGSN,
CMD_AT_CHUP,
CMD_AT_CIMI,
// CMD_AT_CLIP,
CMD_AT_CLIR,
CMD_AT_CLVL,
CMD_AT_CMGD,
CMD_AT_CMGF,
CMD_AT_CMGR,
CMD_AT_CMGS,
CMD_AT_SMSTEXT,
CMD_AT_CNMI,
CMD_AT_CNUM,
CMD_AT_COPS,
CMD_AT_COPS_INIT,
CMD_AT_CPIN,
CMD_AT_CPMS,
CMD_AT_CREG,
CMD_AT_CREG_INIT,
CMD_AT_CSCS,
CMD_AT_CSQ,
CMD_AT_CSSN,
CMD_AT_CUSD,
CMD_AT_CVOICE,
CMD_AT_D,
CMD_AT_DDSETEX,
CMD_AT_DTMF,
CMD_AT_E,
CMD_AT_U2DIAG,
CMD_AT_Z,
CMD_AT_CMEE,
CMD_AT_CSCA,
CMD_AT_CHLD_1x,
CMD_AT_CHLD_2x,
CMD_AT_CHLD_2,
CMD_AT_CHLD_3,
CMD_AT_CLCC
} at_cmd_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)
{
/* magic!!! must be in same order as elements of enums in at_cmd_t */
static const char * const cmds[] = {
"USER'S",
"AT",
"ATA",
"AT+CCWA?",
"AT+CCWA=",
"AT+CFUN",
"AT+CGMI",
"AT+CGMM",
"AT+CGMR",
"AT+CGSN",
"AT+CHUP",
"AT+CIMI",
// "AT+CLIP",
"AT+CLIR",
"AT+CLVL",
"AT+CMGD",
"AT+CMGF",
"AT+CMGR",
"AT+CMGS",
"SMSTEXT",
"AT+CNMI",
"AT+CNUM",
"AT+COPS?",
"AT+COPS=",
"AT+CPIN?",
"AT+CPMS",
"AT+CREG?",
"AT+CREG=",
"AT+CSCS",
"AT+CSQ",
"AT+CSSN",
"AT+CUSD",
"AT^CVOICE",
"ATD",
"AT^DDSETEX",
"AT^DTMF",
"ATE",
"AT^U2DIAG",
"ATZ",
"AT+CMEE",
"AT+CSCA",
"AT+CHLD=1x",
"AT+CHLD=2x",
"AT+CHLD=2",
"AT+CHLD=3",
"AT+CLCC"
};
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_enque_initialization(struct cpvt * cpvt, at_cmd_t from_command);
EXPORT_DECL int at_enque_ping (struct cpvt * cpvt);
EXPORT_DECL int at_enque_cops (struct cpvt * cpvt);
EXPORT_DECL int at_enque_sms (struct cpvt * cpvt, const char * number, const char * msg, unsigned validity_min, int report_req, void ** id);
EXPORT_DECL int at_enque_pdu (struct cpvt * cpvt, const char * pdu, attribute_unused const char *, attribute_unused unsigned, attribute_unused int, void ** id);
EXPORT_DECL int at_enque_ussd (struct cpvt * cpvt, const char * code, attribute_unused const char *, attribute_unused unsigned, attribute_unused int, void ** id);
EXPORT_DECL int at_enque_dtmf (struct cpvt * cpvt, char digit);
EXPORT_DECL int at_enque_set_ccwa (struct cpvt * cpvt, attribute_unused const char * unused1, attribute_unused const char * unused2, unsigned call_waiting);
EXPORT_DECL int at_enque_reset (struct cpvt * cpvt);
EXPORT_DECL int at_enque_dial(struct cpvt * cpvt, const char * number, int clir);
EXPORT_DECL int at_enque_answer(struct cpvt * cpvt);
EXPORT_DECL int at_enque_user_cmd(struct cpvt * cpvt, const char * input);
EXPORT_DECL int at_enque_retrive_sms(struct cpvt * cpvt, int index, int delete);
EXPORT_DECL int at_enque_hangup (struct cpvt * cpvt, int call_idx);
EXPORT_DECL int at_enque_volsync (struct cpvt * cpvt);
EXPORT_DECL int at_enque_clcc (struct cpvt * cpvt);
EXPORT_DECL int at_enque_activate (struct cpvt * cpvt);
EXPORT_DECL int at_enque_flip_hold (struct cpvt * cpvt);
EXPORT_DECL int at_enque_conference (struct cpvt * cpvt);
EXPORT_DECL void at_hangup_immediality(struct cpvt * cpvt);
#endif /* CHAN_DONGLE_AT_SEND_H_INCLUDED */