comparison spandsp-0.0.6pre17/src/at_interpreter.c @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents
children
comparison
equal deleted inserted replaced
3:c6c5a16ce2f2 4:26cd8f1ef0b1
1 /*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * at_interpreter.c - AT command interpreter to V.251, V.252, V.253, T.31 and the 3GPP specs.
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Special thanks to Lee Howard <faxguy@howardsilvan.com>
9 * for his great work debugging and polishing this code.
10 *
11 * Copyright (C) 2004, 2005, 2006 Steve Underwood
12 *
13 * All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 2.1,
17 * as published by the Free Software Foundation.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 *
28 * $Id: at_interpreter.c,v 1.42.4.1 2009/12/23 14:18:32 steveu Exp $
29 */
30
31 /*! \file */
32
33 #if defined(HAVE_CONFIG_H)
34 #include "config.h"
35 #endif
36
37 #if defined(__sun)
38 #define __EXTENSIONS__
39 #endif
40
41 #include <inttypes.h>
42 #include <stdlib.h>
43 #include <stdio.h>
44 #include <fcntl.h>
45 #include <memory.h>
46 #include <string.h>
47 #include <ctype.h>
48 #include <assert.h>
49
50 #include "spandsp/telephony.h"
51 #include "spandsp/logging.h"
52 #include "spandsp/queue.h"
53 #include "spandsp/power_meter.h"
54 #include "spandsp/complex.h"
55 #include "spandsp/tone_generate.h"
56 #include "spandsp/async.h"
57 #include "spandsp/hdlc.h"
58 #include "spandsp/fsk.h"
59 #include "spandsp/super_tone_rx.h"
60 #include "spandsp/fax_modems.h"
61
62 #include "spandsp/at_interpreter.h"
63
64 #include "spandsp/private/logging.h"
65 #include "spandsp/private/at_interpreter.h"
66
67 #define MANUFACTURER "www.soft-switch.org"
68 #define SERIAL_NUMBER "42"
69 #define GLOBAL_OBJECT_IDENTITY "42"
70
71 enum
72 {
73 ASCII_RESULT_CODES = 1,
74 NUMERIC_RESULT_CODES,
75 NO_RESULT_CODES
76 };
77
78 static at_profile_t profiles[3] =
79 {
80 {
81 #if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
82 /*.echo =*/ TRUE,
83 /*.verbose =*/ TRUE,
84 /*.result_code_format =*/ ASCII_RESULT_CODES,
85 /*.pulse_dial =*/ FALSE,
86 /*.double_escape =*/ FALSE,
87 /*.adaptive_receive =*/ FALSE,
88 /*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
89 #else
90 .echo = TRUE,
91 .verbose = TRUE,
92 .result_code_format = ASCII_RESULT_CODES,
93 .pulse_dial = FALSE,
94 .double_escape = FALSE,
95 .adaptive_receive = FALSE,
96 .s_regs[0] = 0,
97 .s_regs[3] = '\r',
98 .s_regs[4] = '\n',
99 .s_regs[5] = '\b',
100 .s_regs[6] = 1,
101 .s_regs[7] = 60,
102 .s_regs[8] = 5,
103 .s_regs[10] = 0
104 #endif
105 }
106 };
107
108 typedef const char *(*at_cmd_service_t)(at_state_t *s, const char *cmd);
109
110 static const char *manufacturer = MANUFACTURER;
111 static const char *model = PACKAGE;
112 static const char *revision = VERSION;
113
114 #define ETX 0x03
115 #define DLE 0x10
116 #define SUB 0x1A
117
118 static const char *at_response_codes[] =
119 {
120 "OK",
121 "CONNECT",
122 "RING",
123 "NO CARRIER",
124 "ERROR",
125 "???",
126 "NO DIALTONE",
127 "BUSY",
128 "NO ANSWER",
129 "+FCERROR",
130 "+FRH:3"
131 };
132
133 SPAN_DECLARE(void) at_set_at_rx_mode(at_state_t *s, int new_mode)
134 {
135 /* The use of a DTE timeout is mode dependent. Set the timeout appropriately in
136 the modem. */
137 switch (new_mode)
138 {
139 case AT_MODE_HDLC:
140 case AT_MODE_STUFFED:
141 at_modem_control(s, s->dte_inactivity_timeout*1000, (void *) (intptr_t) s->dte_inactivity_timeout);
142 break;
143 default:
144 at_modem_control(s, AT_MODEM_CONTROL_DTE_TIMEOUT, NULL);
145 break;
146 }
147 s->at_rx_mode = new_mode;
148 }
149 /*- End of function --------------------------------------------------------*/
150
151 SPAN_DECLARE(void) at_put_response(at_state_t *s, const char *t)
152 {
153 uint8_t buf[3];
154
155 buf[0] = s->p.s_regs[3];
156 buf[1] = s->p.s_regs[4];
157 buf[2] = '\0';
158 if (s->p.result_code_format == ASCII_RESULT_CODES)
159 s->at_tx_handler(s, s->at_tx_user_data, buf, 2);
160 s->at_tx_handler(s, s->at_tx_user_data, (uint8_t *) t, strlen(t));
161 s->at_tx_handler(s, s->at_tx_user_data, buf, 2);
162 }
163 /*- End of function --------------------------------------------------------*/
164
165 SPAN_DECLARE(void) at_put_numeric_response(at_state_t *s, int val)
166 {
167 char buf[20];
168
169 snprintf(buf, sizeof(buf), "%d", val);
170 at_put_response(s, buf);
171 }
172 /*- End of function --------------------------------------------------------*/
173
174 SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
175 {
176 uint8_t buf[20];
177
178 span_log(&s->logging, SPAN_LOG_FLOW, "Sending AT response code %s\n", at_response_codes[code]);
179 switch (s->p.result_code_format)
180 {
181 case ASCII_RESULT_CODES:
182 at_put_response(s, at_response_codes[code]);
183 break;
184 case NUMERIC_RESULT_CODES:
185 snprintf((char *) buf, sizeof(buf), "%d%c", code, s->p.s_regs[3]);
186 s->at_tx_handler(s, s->at_tx_user_data, buf, strlen((char *) buf));
187 break;
188 default:
189 /* No result codes */
190 break;
191 }
192 }
193 /*- End of function --------------------------------------------------------*/
194
195 static int answer_call(at_state_t *s)
196 {
197 if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0)
198 return FALSE;
199 /* Answering should now be in progress. No AT response should be
200 issued at this point. */
201 s->do_hangup = FALSE;
202 return TRUE;
203 }
204 /*- End of function --------------------------------------------------------*/
205
206 SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
207 {
208 span_log(&s->logging, SPAN_LOG_FLOW, "Call event %d received\n", event);
209 switch (event)
210 {
211 case AT_CALL_EVENT_ALERTING:
212 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 1);
213 if (s->display_call_info && !s->call_info_displayed)
214 at_display_call_info(s);
215 at_put_response_code(s, AT_RESPONSE_CODE_RING);
216 if ((++s->rings_indicated) >= s->p.s_regs[0] && s->p.s_regs[0])
217 {
218 /* The modem is set to auto-answer now */
219 answer_call(s);
220 }
221 break;
222 case AT_CALL_EVENT_ANSWERED:
223 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
224 if (s->fclass_mode == 0)
225 {
226 /* Normal data modem connection */
227 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
228 /* TODO: */
229 }
230 else
231 {
232 /* FAX modem connection */
233 at_set_at_rx_mode(s, AT_MODE_DELIVERY);
234 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CED_TONE);
235 }
236 break;
237 case AT_CALL_EVENT_CONNECTED:
238 span_log(&s->logging, SPAN_LOG_FLOW, "Dial call - connected. FCLASS=%d\n", s->fclass_mode);
239 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
240 if (s->fclass_mode == 0)
241 {
242 /* Normal data modem connection */
243 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
244 /* TODO: */
245 }
246 else
247 {
248 /* FAX modem connection */
249 at_set_at_rx_mode(s, AT_MODE_DELIVERY);
250 if (s->silent_dial)
251 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE);
252 else
253 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE);
254 s->dte_is_waiting = TRUE;
255 }
256 break;
257 case AT_CALL_EVENT_BUSY:
258 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
259 at_put_response_code(s, AT_RESPONSE_CODE_BUSY);
260 break;
261 case AT_CALL_EVENT_NO_DIALTONE:
262 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
263 at_put_response_code(s, AT_RESPONSE_CODE_NO_DIALTONE);
264 break;
265 case AT_CALL_EVENT_NO_ANSWER:
266 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
267 at_put_response_code(s, AT_RESPONSE_CODE_NO_ANSWER);
268 break;
269 case AT_CALL_EVENT_HANGUP:
270 span_log(&s->logging, SPAN_LOG_FLOW, "Hangup... at_rx_mode %d\n", s->at_rx_mode);
271 at_modem_control(s, AT_MODEM_CONTROL_ONHOOK, NULL);
272 if (s->dte_is_waiting)
273 {
274 if (s->ok_is_pending)
275 {
276 at_put_response_code(s, AT_RESPONSE_CODE_OK);
277 s->ok_is_pending = FALSE;
278 }
279 else
280 {
281 at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
282 }
283 s->dte_is_waiting = FALSE;
284 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
285 }
286 else if (s->fclass_mode && s->rx_signal_present)
287 {
288 s->rx_data[s->rx_data_bytes++] = DLE;
289 s->rx_data[s->rx_data_bytes++] = ETX;
290 s->at_tx_handler(s, s->at_tx_user_data, s->rx_data, s->rx_data_bytes);
291 s->rx_data_bytes = 0;
292 }
293 if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND)
294 at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
295 s->rx_signal_present = FALSE;
296 at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
297 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
298 break;
299 default:
300 span_log(&s->logging, SPAN_LOG_WARNING, "Invalid call event %d received.\n", event);
301 break;
302 }
303 }
304 /*- End of function --------------------------------------------------------*/
305
306 SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
307 {
308 at_call_id_t *call_id;
309 at_call_id_t *next;
310
311 for (call_id = s->call_id; call_id; call_id = next)
312 {
313 next = call_id->next;
314 free(call_id);
315 }
316 s->call_id = NULL;
317 s->rings_indicated = 0;
318 s->call_info_displayed = FALSE;
319 }
320 /*- End of function --------------------------------------------------------*/
321
322 SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *value)
323 {
324 at_call_id_t *new_call_id;
325 at_call_id_t *call_id;
326
327 /* TODO: We should really not merely ignore a failure to malloc */
328 if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
329 return;
330 call_id = s->call_id;
331 /* If these strdups fail its pretty harmless. We just appear to not
332 have the relevant field. */
333 new_call_id->id = (id) ? strdup(id) : NULL;
334 new_call_id->value = (value) ? strdup(value) : NULL;
335 new_call_id->next = NULL;
336
337 if (call_id)
338 {
339 while (call_id->next)
340 call_id = call_id->next;
341 call_id->next = new_call_id;
342 }
343 else
344 {
345 s->call_id = new_call_id;
346 }
347 }
348 /*- End of function --------------------------------------------------------*/
349
350 SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
351 {
352 char buf[132 + 1];
353 at_call_id_t *call_id = s->call_id;
354
355 while (call_id)
356 {
357 snprintf(buf, sizeof(buf), "%s=%s",
358 call_id->id ? call_id->id : "NULL", call_id->value ? call_id->value : "<NONE>");
359 at_put_response(s, buf);
360 call_id = call_id->next;
361 }
362 s->call_info_displayed = TRUE;
363 }
364 /*- End of function --------------------------------------------------------*/
365
366 static int parse_num(const char **s, int max_value)
367 {
368 int i;
369
370 /* The spec. says no digits is valid, and should be treated as zero. */
371 i = 0;
372 while (isdigit(**s))
373 {
374 i = i*10 + ((**s) - '0');
375 (*s)++;
376 }
377 if (i > max_value)
378 i = -1;
379 return i;
380 }
381 /*- End of function --------------------------------------------------------*/
382
383 static int parse_hex_num(const char **s, int max_value)
384 {
385 int i;
386
387 /* The spec. says a hex value is always 2 digits, and the alpha digits are
388 upper case. */
389 i = 0;
390 if (isdigit(**s))
391 i = **s - '0';
392 else if (**s >= 'A' && **s <= 'F')
393 i = **s - 'A';
394 else
395 return -1;
396 (*s)++;
397
398 if (isdigit(**s))
399 i = (i << 4) | (**s - '0');
400 else if (**s >= 'A' && **s <= 'F')
401 i = (i << 4) | (**s - 'A');
402 else
403 return -1;
404 (*s)++;
405 if (i > max_value)
406 i = -1;
407 return i;
408 }
409 /*- End of function --------------------------------------------------------*/
410
411 static int match_element(const char **variant, const char *variants)
412 {
413 int i;
414 size_t len;
415 char const *s;
416 char const *t;
417
418 s = variants;
419 for (i = 0; *s; i++)
420 {
421 if ((t = strchr(s, ',')))
422 len = t - s;
423 else
424 len = strlen(s);
425 if (len == (int) strlen(*variant) && memcmp(*variant, s, len) == 0)
426 {
427 *variant += len;
428 return i;
429 }
430 s += len;
431 if (*s == ',')
432 s++;
433 }
434 return -1;
435 }
436 /*- End of function --------------------------------------------------------*/
437
438 static int parse_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
439 {
440 char buf[100];
441 int val;
442
443 switch (*(*t)++)
444 {
445 case '=':
446 switch (**t)
447 {
448 case '?':
449 /* Show possible values */
450 (*t)++;
451 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
452 at_put_response(s, buf);
453 break;
454 default:
455 /* Set value */
456 if ((val = parse_num(t, max_value)) < 0)
457 return FALSE;
458 if (target)
459 *target = val;
460 break;
461 }
462 break;
463 case '?':
464 /* Show current value */
465 val = (target) ? *target : 0;
466 snprintf(buf, sizeof(buf), "%s%d", (prefix) ? prefix : "", val);
467 at_put_response(s, buf);
468 break;
469 default:
470 return FALSE;
471 }
472 return TRUE;
473 }
474 /*- End of function --------------------------------------------------------*/
475
476 static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_value1, int *target2, int max_value2, const char *prefix, const char *def)
477 {
478 char buf[100];
479 int val1;
480 int val2;
481
482 switch (*(*t)++)
483 {
484 case '=':
485 switch (**t)
486 {
487 case '?':
488 /* Show possible values */
489 (*t)++;
490 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
491 at_put_response(s, buf);
492 break;
493 default:
494 /* Set value */
495 if ((val1 = parse_num(t, max_value1)) < 0)
496 return FALSE;
497 if (target1)
498 *target1 = val1;
499 if (**t == ',')
500 {
501 (*t)++;
502 if ((val2 = parse_num(t, max_value2)) < 0)
503 return FALSE;
504 if (target2)
505 *target2 = val2;
506 }
507 break;
508 }
509 break;
510 case '?':
511 /* Show current value */
512 val1 = (target1) ? *target1 : 0;
513 val2 = (target2) ? *target2 : 0;
514 snprintf(buf, sizeof(buf), "%s%d,%d", (prefix) ? prefix : "", val1, val2);
515 at_put_response(s, buf);
516 break;
517 default:
518 return FALSE;
519 }
520 return TRUE;
521 }
522 /*- End of function --------------------------------------------------------*/
523
524 static int parse_n_out(at_state_t *s,
525 const char **t,
526 int *targets[],
527 const int max_values[],
528 int entries,
529 const char *prefix,
530 const char *def)
531 {
532 char buf[100];
533 int val;
534 int len;
535 int i;
536
537 switch (*(*t)++)
538 {
539 case '=':
540 switch (**t)
541 {
542 case '?':
543 /* Show possible values */
544 (*t)++;
545 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
546 at_put_response(s, buf);
547 break;
548 default:
549 /* Set value */
550 for (i = 0; i < entries; i++)
551 {
552 if ((val = parse_num(t, max_values[i])) < 0)
553 return FALSE;
554 if (targets[i])
555 *targets[i] = val;
556 if (**t != ',')
557 break;
558 (*t)++;
559 }
560 break;
561 }
562 break;
563 case '?':
564 /* Show current value */
565 len = snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : "");
566 for (i = 0; i < entries; i++)
567 {
568 if (i > 0)
569 len += snprintf(&buf[len], sizeof(buf) - len, ",");
570 val = (targets[i]) ? *targets[i] : 0;
571 len += snprintf(&buf[len], sizeof(buf) - len, "%d", val);
572 }
573 at_put_response(s, buf);
574 break;
575 default:
576 return FALSE;
577 }
578 return TRUE;
579 }
580 /*- End of function --------------------------------------------------------*/
581
582 static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
583 {
584 char buf[100];
585 int val;
586
587 switch (*(*t)++)
588 {
589 case '=':
590 switch (**t)
591 {
592 case '?':
593 /* Show possible values */
594 (*t)++;
595 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
596 at_put_response(s, buf);
597 break;
598 default:
599 /* Set value */
600 if ((val = parse_hex_num(t, max_value)) < 0)
601 return FALSE;
602 if (target)
603 *target = val;
604 break;
605 }
606 break;
607 case '?':
608 /* Show current value */
609 val = (target) ? *target : 0;
610 snprintf(buf, sizeof(buf), "%s%02X", (prefix) ? prefix : "", val);
611 at_put_response(s, buf);
612 break;
613 default:
614 return FALSE;
615 }
616 return TRUE;
617 }
618 /*- End of function --------------------------------------------------------*/
619
620 static int parse_string_list_out(at_state_t *s, const char **t, int *target, int max_value, const char *prefix, const char *def)
621 {
622 char buf[100];
623 int val;
624 size_t len;
625 char *tmp;
626
627 switch (*(*t)++)
628 {
629 case '=':
630 switch (**t)
631 {
632 case '?':
633 /* Show possible values */
634 (*t)++;
635 snprintf(buf, sizeof(buf), "%s%s", (prefix) ? prefix : "", def);
636 at_put_response(s, buf);
637 break;
638 default:
639 /* Set value */
640 if ((val = match_element(t, def)) < 0)
641 return FALSE;
642 if (target)
643 *target = val;
644 break;
645 }
646 break;
647 case '?':
648 /* Show current index value from def */
649 val = (target) ? *target : 0;
650 while (val-- && (def = strchr(def, ',')))
651 def++;
652 if ((tmp = strchr(def, ',')))
653 len = tmp - def;
654 else
655 len = strlen(def);
656 snprintf(buf, sizeof(buf), "%s%.*s", (prefix) ? prefix : "", (int) len, def);
657 at_put_response(s, buf);
658 break;
659 default:
660 return FALSE;
661 }
662 return TRUE;
663 }
664 /*- End of function --------------------------------------------------------*/
665
666 static int parse_string_out(at_state_t *s, const char **t, char **target, const char *prefix)
667 {
668 char buf[100];
669
670 switch (*(*t)++)
671 {
672 case '=':
673 switch (**t)
674 {
675 case '?':
676 /* Show possible values */
677 (*t)++;
678 snprintf(buf, sizeof(buf), "%s", (prefix) ? prefix : "");
679 at_put_response(s, buf);
680 break;
681 default:
682 /* Set value */
683 if (*target)
684 free(*target);
685 /* If this strdup fails, it should be harmless */
686 *target = strdup(*t);
687 break;
688 }
689 break;
690 case '?':
691 /* Show current index value */
692 at_put_response(s, (*target) ? *target : "");
693 break;
694 default:
695 return FALSE;
696 }
697 while (*t)
698 t++;
699 return TRUE;
700 }
701 /*- End of function --------------------------------------------------------*/
702
703 static const char *s_reg_handler(at_state_t *s, const char *t, int reg)
704 {
705 int val;
706 int b;
707 char buf[4];
708
709 /* Set or get an S register */
710 switch (*t++)
711 {
712 case '=':
713 switch (*t)
714 {
715 case '?':
716 t++;
717 snprintf(buf, sizeof(buf), "%3.3d", 0);
718 at_put_response(s, buf);
719 break;
720 default:
721 if ((val = parse_num(&t, 255)) < 0)
722 return NULL;
723 s->p.s_regs[reg] = (uint8_t) val;
724 break;
725 }
726 break;
727 case '?':
728 snprintf(buf, sizeof(buf), "%3.3d", s->p.s_regs[reg]);
729 at_put_response(s, buf);
730 break;
731 case '.':
732 if ((b = parse_num(&t, 7)) < 0)
733 return NULL;
734 switch (*t++)
735 {
736 case '=':
737 switch (*t)
738 {
739 case '?':
740 t++;
741 at_put_numeric_response(s, 0);
742 break;
743 default:
744 if ((val = parse_num(&t, 1)) < 0)
745 return NULL;
746 if (val)
747 s->p.s_regs[reg] |= (1 << b);
748 else
749 s->p.s_regs[reg] &= ~(1 << b);
750 break;
751 }
752 break;
753 case '?':
754 at_put_numeric_response(s, (int) ((s->p.s_regs[reg] >> b) & 1));
755 break;
756 default:
757 return NULL;
758 }
759 break;
760 default:
761 return NULL;
762 }
763 return t;
764 }
765 /*- End of function --------------------------------------------------------*/
766
767 static int process_class1_cmd(at_state_t *s, const char **t)
768 {
769 int val;
770 int operation;
771 int direction;
772 int result;
773 const char *allowed;
774
775 direction = (*(*t + 2) == 'T');
776 operation = *(*t + 3);
777 /* Step past the "+Fxx" */
778 *t += 4;
779 switch (operation)
780 {
781 case 'S':
782 allowed = "0-255";
783 break;
784 case 'H':
785 allowed = "3";
786 break;
787 default:
788 allowed = "24,48,72,73,74,96,97,98,121,122,145,146";
789 break;
790 }
791
792 val = -1;
793 if (!parse_out(s, t, &val, 255, NULL, allowed))
794 return TRUE;
795 if (val < 0)
796 {
797 /* It was just a query */
798 return TRUE;
799 }
800 /* All class 1 FAX commands are supposed to give an ERROR response, if the phone
801 is on-hook. */
802 if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
803 return FALSE;
804
805 result = TRUE;
806 if (s->class1_handler)
807 result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
808 switch (result)
809 {
810 case 0:
811 /* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
812 *t = (const char *) -1;
813 return TRUE;
814 case -1:
815 return FALSE;
816 }
817 return TRUE;
818 }
819 /*- End of function --------------------------------------------------------*/
820
821 static const char *at_cmd_dummy(at_state_t *s, const char *t)
822 {
823 /* Dummy routine to absorb delimiting characters from a command string */
824 return t + 1;
825 }
826 /*- End of function --------------------------------------------------------*/
827
828 static const char *at_cmd_A(at_state_t *s, const char *t)
829 {
830 /* V.250 6.3.5 - Answer (abortable) */
831 t += 1;
832 if (!answer_call(s))
833 return NULL;
834 return (const char *) -1;
835 }
836 /*- End of function --------------------------------------------------------*/
837
838 static const char *at_cmd_D(at_state_t *s, const char *t)
839 {
840 int ok;
841 char *u;
842 const char *w;
843 char num[100 + 1];
844 char ch;
845
846 /* V.250 6.3.1 - Dial (abortable) */
847 at_reset_call_info(s);
848 s->do_hangup = FALSE;
849 s->silent_dial = FALSE;
850 t += 1;
851 ok = FALSE;
852 /* There are a numbers of options in a dial command string.
853 Many are completely irrelevant in this application. */
854 w = t;
855 u = num;
856 for ( ; (ch = *t); t++)
857 {
858 if (isdigit(ch))
859 {
860 /* V.250 6.3.1.1 Basic digit set */
861 *u++ = ch;
862 }
863 else
864 {
865 switch (ch)
866 {
867 case 'A':
868 case 'B':
869 case 'C':
870 case 'D':
871 case '*':
872 case '#':
873 /* V.250 6.3.1.1 Full DTMF repertoire */
874 if (!s->p.pulse_dial)
875 *u++ = ch;
876 break;
877 case ' ':
878 case '-':
879 /* Ignore spaces and dashes */
880 /* This is not a standards based thing. It just improves
881 compatibility with some other modems. */
882 break;
883 case '+':
884 /* V.250 6.3.1.1 International access code */
885 /* TODO: */
886 break;
887 case ',':
888 /* V.250 6.3.1.2 Pause */
889 /* Pass these through to the application to handle. */
890 *u++ = ch;
891 break;
892 case 'T':
893 /* V.250 6.3.1.3 Tone dial */
894 s->p.pulse_dial = FALSE;
895 break;
896 case 'P':
897 /* V.250 6.3.1.4 Pulse dial */
898 s->p.pulse_dial = TRUE;
899 break;
900 case '!':
901 /* V.250 6.3.1.5 Hook flash, register recall */
902 /* TODO: */
903 break;
904 case 'W':
905 /* V.250 6.3.1.6 Wait for dial tone */
906 /* TODO: */
907 break;
908 case '@':
909 /* V.250 6.3.1.7 Wait for quiet answer */
910 s->silent_dial = TRUE;
911 break;
912 case 'S':
913 /* V.250 6.3.1.8 Invoke stored string */
914 /* S=<location> */
915 /* TODO: */
916 break;
917 case 'G':
918 case 'g':
919 /* GSM07.07 6.2 - Control the CUG supplementary service for this call */
920 /* TODO: */
921 break;
922 case 'I':
923 case 'i':
924 /* GSM07.07 6.2 - Override Calling Line Identification Restriction (CLIR) */
925 /* TODO: */
926 break;
927 case ';':
928 /* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
929 /* TODO: */
930 break;
931 case '>':
932 /* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
933 default value for this call */
934 /* TODO: */
935 break;
936 default:
937 return NULL;
938 }
939 }
940 }
941 *u = '\0';
942 if ((ok = at_modem_control(s, AT_MODEM_CONTROL_CALL, num)) < 0)
943 return NULL;
944 /* Dialing should now be in progress. No AT response should be
945 issued at this point. */
946 return (const char *) -1;
947 }
948 /*- End of function --------------------------------------------------------*/
949
950 static const char *at_cmd_E(at_state_t *s, const char *t)
951 {
952 int val;
953
954 /* V.250 6.2.4 - Command echo */
955 t += 1;
956 if ((val = parse_num(&t, 1)) < 0)
957 return NULL;
958 s->p.echo = val;
959 return t;
960 }
961 /*- End of function --------------------------------------------------------*/
962
963 static const char *at_cmd_H(at_state_t *s, const char *t)
964 {
965 int val;
966
967 /* V.250 6.3.6 - Hook control */
968 t += 1;
969 if ((val = parse_num(&t, 1)) < 0)
970 return NULL;
971 if (val)
972 {
973 /* Take the receiver off-hook, effectively busying-out the modem. */
974 if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND)
975 return NULL;
976 at_modem_control(s, AT_MODEM_CONTROL_OFFHOOK, NULL);
977 at_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND);
978 return t;
979 }
980 at_reset_call_info(s);
981 if (s->at_rx_mode != AT_MODE_ONHOOK_COMMAND && s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND)
982 {
983 /* Push out the last of the audio (probably by sending a short silence). */
984 at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
985 s->do_hangup = TRUE;
986 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
987 return (const char *) -1;
988 }
989 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL);
990 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
991 return t;
992 }
993 /*- End of function --------------------------------------------------------*/
994
995 static const char *at_cmd_I(at_state_t *s, const char *t)
996 {
997 int val;
998
999 /* V.250 6.1.3 - Request identification information */
1000 /* N.B. The information supplied in response to an ATIx command is very
1001 variable. It was widely used in different ways before the AT command
1002 set was standardised by the ITU. */
1003 t += 1;
1004 switch (val = parse_num(&t, 255))
1005 {
1006 case 0:
1007 at_put_response(s, model);
1008 break;
1009 case 3:
1010 at_put_response(s, manufacturer);
1011 break;
1012 default:
1013 return NULL;
1014 }
1015 return t;
1016 }
1017 /*- End of function --------------------------------------------------------*/
1018
1019 static const char *at_cmd_L(at_state_t *s, const char *t)
1020 {
1021 int val;
1022
1023 /* V.250 6.3.13 - Monitor speaker loudness */
1024 /* Just absorb this command, as we have no speaker */
1025 t += 1;
1026 if ((val = parse_num(&t, 255)) < 0)
1027 return NULL;
1028 s->speaker_volume = val;
1029 return t;
1030 }
1031 /*- End of function --------------------------------------------------------*/
1032
1033 static const char *at_cmd_M(at_state_t *s, const char *t)
1034 {
1035 int val;
1036
1037 /* V.250 6.3.14 - Monitor speaker mode */
1038 /* Just absorb this command, as we have no speaker */
1039 t += 1;
1040 if ((val = parse_num(&t, 255)) < 0)
1041 return NULL;
1042 s->speaker_mode = val;
1043 return t;
1044 }
1045 /*- End of function --------------------------------------------------------*/
1046
1047 static const char *at_cmd_O(at_state_t *s, const char *t)
1048 {
1049 int val;
1050
1051 /* V.250 6.3.7 - Return to online data state */
1052 t += 1;
1053 if ((val = parse_num(&t, 1)) < 0)
1054 return NULL;
1055 if (val == 0)
1056 {
1057 at_set_at_rx_mode(s, AT_MODE_CONNECTED);
1058 at_put_response_code(s, AT_RESPONSE_CODE_CONNECT);
1059 }
1060 return t;
1061 }
1062 /*- End of function --------------------------------------------------------*/
1063
1064 static const char *at_cmd_P(at_state_t *s, const char *t)
1065 {
1066 /* V.250 6.3.3 - Select pulse dialling (command) */
1067 t += 1;
1068 s->p.pulse_dial = TRUE;
1069 return t;
1070 }
1071 /*- End of function --------------------------------------------------------*/
1072
1073 static const char *at_cmd_Q(at_state_t *s, const char *t)
1074 {
1075 int val;
1076
1077 /* V.250 6.2.5 - Result code suppression */
1078 t += 1;
1079 if ((val = parse_num(&t, 1)) < 0)
1080 return NULL;
1081 switch (val)
1082 {
1083 case 0:
1084 s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES;
1085 break;
1086 case 1:
1087 s->p.result_code_format = NO_RESULT_CODES;
1088 break;
1089 }
1090 return t;
1091 }
1092 /*- End of function --------------------------------------------------------*/
1093
1094 static const char *at_cmd_S0(at_state_t *s, const char *t)
1095 {
1096 /* V.250 6.3.8 - Automatic answer */
1097 t += 2;
1098 return s_reg_handler(s, t, 0);
1099 }
1100 /*- End of function --------------------------------------------------------*/
1101
1102 static const char *at_cmd_S10(at_state_t *s, const char *t)
1103 {
1104 /* V.250 6.3.12 - Automatic disconnect delay */
1105 t += 3;
1106 return s_reg_handler(s, t, 10);
1107 }
1108 /*- End of function --------------------------------------------------------*/
1109
1110 static const char *at_cmd_S3(at_state_t *s, const char *t)
1111 {
1112 /* V.250 6.2.1 - Command line termination character */
1113 t += 2;
1114 return s_reg_handler(s, t, 3);
1115 }
1116 /*- End of function --------------------------------------------------------*/
1117
1118 static const char *at_cmd_S4(at_state_t *s, const char *t)
1119 {
1120 /* V.250 6.2.2 - Response formatting character */
1121 t += 2;
1122 return s_reg_handler(s, t, 4);
1123 }
1124 /*- End of function --------------------------------------------------------*/
1125
1126 static const char *at_cmd_S5(at_state_t *s, const char *t)
1127 {
1128 /* V.250 6.2.3 - Command line editing character */
1129 t += 2;
1130 return s_reg_handler(s, t, 5);
1131 }
1132 /*- End of function --------------------------------------------------------*/
1133
1134 static const char *at_cmd_S6(at_state_t *s, const char *t)
1135 {
1136 /* V.250 6.3.9 - Pause before blind dialling */
1137 t += 2;
1138 return s_reg_handler(s, t, 6);
1139 }
1140 /*- End of function --------------------------------------------------------*/
1141
1142 static const char *at_cmd_S7(at_state_t *s, const char *t)
1143 {
1144 /* V.250 6.3.10 - Connection completion timeout */
1145 t += 2;
1146 return s_reg_handler(s, t, 7);
1147 }
1148 /*- End of function --------------------------------------------------------*/
1149
1150 static const char *at_cmd_S8(at_state_t *s, const char *t)
1151 {
1152 /* V.250 6.3.11 - Comma dial modifier time */
1153 t += 2;
1154 return s_reg_handler(s, t, 8);
1155 }
1156 /*- End of function --------------------------------------------------------*/
1157
1158 static const char *at_cmd_T(at_state_t *s, const char *t)
1159 {
1160 /* V.250 6.3.2 - Select tone dialling (command) */
1161 t += 1;
1162 s->p.pulse_dial = FALSE;
1163 return t;
1164 }
1165 /*- End of function --------------------------------------------------------*/
1166
1167 static const char *at_cmd_V(at_state_t *s, const char *t)
1168 {
1169 int val;
1170
1171 /* V.250 6.2.6 - DCE response format */
1172 t += 1;
1173 if ((val = parse_num(&t, 1)) < 0)
1174 return NULL;
1175 s->p.verbose = val;
1176 if (s->p.result_code_format != NO_RESULT_CODES)
1177 s->p.result_code_format = (s->p.verbose) ? ASCII_RESULT_CODES : NUMERIC_RESULT_CODES;
1178 return t;
1179 }
1180 /*- End of function --------------------------------------------------------*/
1181
1182 static const char *at_cmd_X(at_state_t *s, const char *t)
1183 {
1184 int val;
1185
1186 /* V.250 6.2.7 - Result code selection and call progress monitoring control */
1187 /* 0 CONNECT result code is given upon entering online data state.
1188 Dial tone and busy detection are disabled.
1189 1 CONNECT <text> result code is given upon entering online data state.
1190 Dial tone and busy detection are disabled.
1191 2 CONNECT <text> result code is given upon entering online data state.
1192 Dial tone detection is enabled, and busy detection is disabled.
1193 3 CONNECT <text> result code is given upon entering online data state.
1194 Dial tone detection is disabled, and busy detection is enabled.
1195 4 CONNECT <text> result code is given upon entering online data state.
1196 Dial tone and busy detection are both enabled. */
1197 t += 1;
1198 if ((val = parse_num(&t, 4)) < 0)
1199 return NULL;
1200 s->result_code_mode = val;
1201 return t;
1202 }
1203 /*- End of function --------------------------------------------------------*/
1204
1205 static const char *at_cmd_Z(at_state_t *s, const char *t)
1206 {
1207 int val;
1208
1209 /* V.250 6.1.1 - Reset to default configuration */
1210 t += 1;
1211 if ((val = parse_num(&t, sizeof(profiles)/sizeof(profiles[0]) - 1)) < 0)
1212 return NULL;
1213 /* Just make sure we are on hook */
1214 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL);
1215 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
1216 s->p = profiles[val];
1217 at_reset_call_info(s);
1218 return t;
1219 }
1220 /*- End of function --------------------------------------------------------*/
1221
1222 static const char *at_cmd_amp_C(at_state_t *s, const char *t)
1223 {
1224 int val;
1225
1226 /* V.250 6.2.8 - Circuit 109 (received line signal detector) behaviour */
1227 /* We have no RLSD pin, so just absorb this. */
1228 t += 2;
1229 if ((val = parse_num(&t, 1)) < 0)
1230 return NULL;
1231 s->rlsd_behaviour = val;
1232 return t;
1233 }
1234 /*- End of function --------------------------------------------------------*/
1235
1236 static const char *at_cmd_amp_D(at_state_t *s, const char *t)
1237 {
1238 int val;
1239
1240 /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
1241 t += 2;
1242 if ((val = parse_num(&t, 2)) < 0)
1243 return NULL;
1244 /* TODO: We have no DTR pin, but we need this to get into online
1245 command state. */
1246 s->dtr_behaviour = val;
1247 return t;
1248 }
1249 /*- End of function --------------------------------------------------------*/
1250
1251 static const char *at_cmd_amp_F(at_state_t *s, const char *t)
1252 {
1253 t += 2;
1254
1255 /* V.250 6.1.2 - Set to factory-defined configuration */
1256 /* Just make sure we are on hook */
1257 at_modem_control(s, AT_MODEM_CONTROL_HANGUP, NULL);
1258 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
1259 s->p = profiles[0];
1260 return t;
1261 }
1262 /*- End of function --------------------------------------------------------*/
1263
1264 static const char *at_cmd_plus_A8A(at_state_t *s, const char *t)
1265 {
1266 /* V.251 6.3 - V.8 calling tone indication */
1267 return t;
1268 }
1269 /*- End of function --------------------------------------------------------*/
1270
1271 static const char *at_cmd_plus_A8C(at_state_t *s, const char *t)
1272 {
1273 /* V.251 6.2 - V.8 answer signal indication */
1274 return t;
1275 }
1276 /*- End of function --------------------------------------------------------*/
1277
1278 static const char *at_cmd_plus_A8E(at_state_t *s, const char *t)
1279 {
1280 int val;
1281
1282 /* V.251 5.1 - V.8 and V.8bis operation controls */
1283 /* Syntax: +A8E=<v8o>,<v8a>,<v8cf>[,<v8b>][,<cfrange>][,<protrange>] */
1284 /* <v8o>=0 Disable V.8 origination negotiation
1285 <v8o>=1 Enable DCE-controlled V.8 origination negotiation
1286 <v8o>=2 Enable DTE-controlled V.8 origination negotiation, send V.8 CI only
1287 <v8o>=3 Enable DTE-controlled V.8 origination negotiation, send 1100Hz CNG only
1288 <v8o>=4 Enable DTE-controlled V.8 origination negotiation, send 1300Hz CT only
1289 <v8o>=5 Enable DTE-controlled V.8 origination negotiation, send no tones
1290 <v8o>=6 Enable DCE-controlled V.8 origination negotiation, issue +A8x indications
1291 <v8a>=0 Disable V.8 answer negotiation
1292 <v8a>=1 Enable DCE-controlled V.8 answer negotiation
1293 <v8a>=2 Enable DTE-controlled V.8 answer negotiation, send ANSam
1294 <v8a>=3 Enable DTE-controlled V.8 answer negotiation, send no signal
1295 <v8a>=4 Disable DTE-controlled V.8 answer negotiation, send ANS
1296 <v8a>=5 Enable DCE-controlled V.8 answer negotiation, issue +A8x indications
1297 <v8cf>=X..Y Set the V.8 CI signal call function to the hexadecimal octet value X..Y
1298 <v8b>=0 Disable V.8bis negotiation
1299 <v8b>=1 Enable DCE-controlled V.8bis negotiation
1300 <v8b>=2 Enable DTE-controlled V.8bis negotiation
1301 <cfrange>="<string of values>" Set to alternative list of call function "option bit"
1302 values that the answering DCE shall accept from the caller
1303 <protrange>="<string of values>" Set to alternative list of protocol "option bit" values that
1304 the answering DCE shall accept from the caller
1305 */
1306 /* TODO: */
1307 t += 4;
1308 if (!parse_out(s, &t, &val, 6, "+A8E:", "(0-6),(0-5),(00-FF)"))
1309 return NULL;
1310 if (*t != ',')
1311 return t;
1312 if ((val = parse_num(&t, 5)) < 0)
1313 return NULL;
1314 if (*t != ',')
1315 return t;
1316 return t;
1317 }
1318 /*- End of function --------------------------------------------------------*/
1319
1320 static const char *at_cmd_plus_A8I(at_state_t *s, const char *t)
1321 {
1322 /* V.251 6.1 - V.8 CI signal indication */
1323 return t;
1324 }
1325 /*- End of function --------------------------------------------------------*/
1326
1327 static const char *at_cmd_plus_A8J(at_state_t *s, const char *t)
1328 {
1329 /* V.251 6.4 - V.8 negotiation complete */
1330 return t;
1331 }
1332 /*- End of function --------------------------------------------------------*/
1333
1334 static const char *at_cmd_plus_A8M(at_state_t *s, const char *t)
1335 {
1336 /* V.251 5.2 - Send V.8 menu signals */
1337 /* Syntax: +A8M=<hexadecimal coded CM or JM octet string> */
1338 /* TODO: */
1339 t += 4;
1340 return t;
1341 }
1342 /*- End of function --------------------------------------------------------*/
1343
1344 static const char *at_cmd_plus_A8R(at_state_t *s, const char *t)
1345 {
1346 /* V.251 6.6 - V.8bis signal and message reporting */
1347 return t;
1348 }
1349 /*- End of function --------------------------------------------------------*/
1350
1351 static const char *at_cmd_plus_A8T(at_state_t *s, const char *t)
1352 {
1353 int val;
1354
1355 /* V.251 5.3 - Send V.8bis signal and/or message(s) */
1356 /* Syntax: +A8T=<signal>[,<1st message>][,<2nd message>][,<sig_en>][,<msg_en>][,<supp_delay>] */
1357 /* <signal>=0 None
1358 <signal>=1 Initiating Mre
1359 <signal>=2 Initiating MRd
1360 <signal>=3 Initiating CRe, low power
1361 <signal>=4 Initiating CRe, high power
1362 <signal>=5 Initiating CRd
1363 <signal>=6 Initiating Esi
1364 <signal>=7 Responding MRd, low power
1365 <signal>=8 Responding MRd, high power
1366 <signal>=9 Responding CRd
1367 <signal>=10 Responding Esr
1368 */
1369 /* TODO: */
1370 t += 4;
1371 if (!parse_out(s, &t, &val, 10, "+A8T:", "(0-10)"))
1372 return NULL;
1373 s->v8bis_signal = val;
1374 if (*t != ',')
1375 return t;
1376 if ((val = parse_num(&t, 255)) < 0)
1377 return NULL;
1378 s->v8bis_1st_message = val;
1379 if (*t != ',')
1380 return t;
1381 if ((val = parse_num(&t, 255)) < 0)
1382 return NULL;
1383 s->v8bis_2nd_message = val;
1384 if (*t != ',')
1385 return t;
1386 if ((val = parse_num(&t, 255)) < 0)
1387 return NULL;
1388 s->v8bis_sig_en = val;
1389 if (*t != ',')
1390 return t;
1391 if ((val = parse_num(&t, 255)) < 0)
1392 return NULL;
1393 s->v8bis_msg_en = val;
1394 if (*t != ',')
1395 return t;
1396 if ((val = parse_num(&t, 255)) < 0)
1397 return NULL;
1398 s->v8bis_supp_delay = val;
1399 return t;
1400 }
1401 /*- End of function --------------------------------------------------------*/
1402
1403 static const char *at_cmd_plus_ASTO(at_state_t *s, const char *t)
1404 {
1405 /* V.250 6.3.15 - Store telephone number */
1406 /* TODO: */
1407 t += 5;
1408 if (!parse_out(s, &t, NULL, 1, "+ASTO:", ""))
1409 return NULL;
1410 return t;
1411 }
1412 /*- End of function --------------------------------------------------------*/
1413
1414 static const char *at_cmd_plus_CAAP(at_state_t *s, const char *t)
1415 {
1416 /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */
1417 /* TODO: */
1418 t += 5;
1419 if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+CAAP:", ""))
1420 return NULL;
1421 return t;
1422 }
1423 /*- End of function --------------------------------------------------------*/
1424
1425 static const char *at_cmd_plus_CACM(at_state_t *s, const char *t)
1426 {
1427 /* 3GPP TS 27.007 8.25 - Accumulated call meter */
1428 /* TODO: */
1429 t += 5;
1430 if (!parse_out(s, &t, NULL, 1, "+CACM:", ""))
1431 return NULL;
1432 return t;
1433 }
1434 /*- End of function --------------------------------------------------------*/
1435
1436 static const char *at_cmd_plus_CACSP(at_state_t *s, const char *t)
1437 {
1438 /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */
1439 /* TODO: */
1440 t += 6;
1441 if (!parse_out(s, &t, NULL, 1, "+CACSP:", ""))
1442 return NULL;
1443 return t;
1444 }
1445 /*- End of function --------------------------------------------------------*/
1446
1447 static const char *at_cmd_plus_CAD(at_state_t *s, const char *t)
1448 {
1449 /* IS-99 5.6.3 - Query analogue or digital service */
1450 /* TODO: */
1451 t += 4;
1452 return t;
1453 }
1454 /*- End of function --------------------------------------------------------*/
1455
1456 static const char *at_cmd_plus_CAEMLPP(at_state_t *s, const char *t)
1457 {
1458 /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */
1459 /* TODO: */
1460 t += 8;
1461 if (!parse_out(s, &t, NULL, 1, "+CAEMLPP:", ""))
1462 return NULL;
1463 return t;
1464 }
1465 /*- End of function --------------------------------------------------------*/
1466
1467 static const char *at_cmd_plus_CAHLD(at_state_t *s, const char *t)
1468 {
1469 /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */
1470 /* TODO: */
1471 t += 6;
1472 if (!parse_out(s, &t, NULL, 1, "+CAHLD:", ""))
1473 return NULL;
1474 return t;
1475 }
1476 /*- End of function --------------------------------------------------------*/
1477
1478 static const char *at_cmd_plus_CAJOIN(at_state_t *s, const char *t)
1479 {
1480 /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */
1481 /* TODO: */
1482 t += 7;
1483 if (!parse_out(s, &t, NULL, 1, "+CAJOIN:", ""))
1484 return NULL;
1485 return t;
1486 }
1487 /*- End of function --------------------------------------------------------*/
1488
1489 static const char *at_cmd_plus_CALA(at_state_t *s, const char *t)
1490 {
1491 /* 3GPP TS 27.007 8.16 - Alarm */
1492 /* TODO: */
1493 t += 5;
1494 if (!parse_out(s, &t, NULL, 1, "+CALA:", ""))
1495 return NULL;
1496 return t;
1497 }
1498 /*- End of function --------------------------------------------------------*/
1499
1500 static const char *at_cmd_plus_CALCC(at_state_t *s, const char *t)
1501 {
1502 /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */
1503 /* TODO: */
1504 t += 6;
1505 if (!parse_out(s, &t, NULL, 1, "+CALCC:", ""))
1506 return NULL;
1507 return t;
1508 }
1509 /*- End of function --------------------------------------------------------*/
1510
1511 static const char *at_cmd_plus_CALD(at_state_t *s, const char *t)
1512 {
1513 /* 3GPP TS 27.007 8.38 - Delete alarm */
1514 /* TODO: */
1515 t += 5;
1516 if (!parse_out(s, &t, NULL, 1, "+CALD:", ""))
1517 return NULL;
1518 return t;
1519 }
1520 /*- End of function --------------------------------------------------------*/
1521
1522 static const char *at_cmd_plus_CALM(at_state_t *s, const char *t)
1523 {
1524 /* 3GPP TS 27.007 8.20 - Alert sound mode */
1525 /* TODO: */
1526 t += 5;
1527 if (!parse_out(s, &t, NULL, 1, "+CALM:", ""))
1528 return NULL;
1529 return t;
1530 }
1531 /*- End of function --------------------------------------------------------*/
1532
1533 static const char *at_cmd_plus_CAMM(at_state_t *s, const char *t)
1534 {
1535 /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */
1536 /* TODO: */
1537 t += 5;
1538 if (!parse_out(s, &t, NULL, 1, "+CAMM:", ""))
1539 return NULL;
1540 return t;
1541 }
1542 /*- End of function --------------------------------------------------------*/
1543
1544 static const char *at_cmd_plus_CANCHEV(at_state_t *s, const char *t)
1545 {
1546 /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */
1547 /* TODO: */
1548 t += 8;
1549 if (!parse_out(s, &t, NULL, 1, "+CANCHEV:", ""))
1550 return NULL;
1551 return t;
1552 }
1553 /*- End of function --------------------------------------------------------*/
1554
1555 static const char *at_cmd_plus_CAOC(at_state_t *s, const char *t)
1556 {
1557 /* 3GPP TS 27.007 7.16 - Advice of Charge */
1558 /* TODO: */
1559 t += 5;
1560 if (!parse_out(s, &t, NULL, 1, "+CAOC:", ""))
1561 return NULL;
1562 return t;
1563 }
1564 /*- End of function --------------------------------------------------------*/
1565
1566 static const char *at_cmd_plus_CAPD(at_state_t *s, const char *t)
1567 {
1568 /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */
1569 /* TODO: */
1570 t += 5;
1571 if (!parse_out(s, &t, NULL, 1, "+CAPD:", ""))
1572 return NULL;
1573 return t;
1574 }
1575 /*- End of function --------------------------------------------------------*/
1576
1577 static const char *at_cmd_plus_CAPTT(at_state_t *s, const char *t)
1578 {
1579 /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */
1580 /* TODO: */
1581 t += 6;
1582 if (!parse_out(s, &t, NULL, 1, "+CAPTT:", ""))
1583 return NULL;
1584 return t;
1585 }
1586 /*- End of function --------------------------------------------------------*/
1587
1588 static const char *at_cmd_plus_CAREJ(at_state_t *s, const char *t)
1589 {
1590 /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */
1591 /* TODO: */
1592 t += 6;
1593 if (!parse_out(s, &t, NULL, 1, "+CAREJ:", ""))
1594 return NULL;
1595 return t;
1596 }
1597 /*- End of function --------------------------------------------------------*/
1598
1599 static const char *at_cmd_plus_CAULEV(at_state_t *s, const char *t)
1600 {
1601 /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */
1602 /* TODO: */
1603 t += 7;
1604 if (!parse_out(s, &t, NULL, 1, "+CAULEV:", ""))
1605 return NULL;
1606 return t;
1607 }
1608 /*- End of function --------------------------------------------------------*/
1609
1610 static const char *at_cmd_plus_CBC(at_state_t *s, const char *t)
1611 {
1612 /* 3GPP TS 27.007 8.4 - Battery charge */
1613 /* TODO: */
1614 t += 4;
1615 if (!parse_out(s, &t, NULL, 1, "+CBC:", ""))
1616 return NULL;
1617 return t;
1618 }
1619 /*- End of function --------------------------------------------------------*/
1620
1621 static const char *at_cmd_plus_CBCS(at_state_t *s, const char *t)
1622 {
1623 /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */
1624 /* TODO: */
1625 t += 5;
1626 if (!parse_out(s, &t, NULL, 1, "+CBCS:", ""))
1627 return NULL;
1628 return t;
1629 }
1630 /*- End of function --------------------------------------------------------*/
1631
1632 static const char *at_cmd_plus_CBIP(at_state_t *s, const char *t)
1633 {
1634 /* IS-99 5.6 - Base station IP address */
1635 /* TODO: */
1636 t += 5;
1637 return t;
1638 }
1639 /*- End of function --------------------------------------------------------*/
1640
1641 static const char *at_cmd_plus_CBST(at_state_t *s, const char *t)
1642 {
1643 /* 3GPP TS 27.007 6.7 - Select bearer service type */
1644 /* TODO: */
1645 t += 5;
1646 if (!parse_out(s, &t, NULL, 1, "+CBST:", ""))
1647 return NULL;
1648 return t;
1649 }
1650 /*- End of function --------------------------------------------------------*/
1651
1652 static const char *at_cmd_plus_CCFC(at_state_t *s, const char *t)
1653 {
1654 /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */
1655 /* TODO: */
1656 t += 5;
1657 if (!parse_out(s, &t, NULL, 1, "+CCFC:", ""))
1658 return NULL;
1659 return t;
1660 }
1661 /*- End of function --------------------------------------------------------*/
1662
1663 static const char *at_cmd_plus_CCLK(at_state_t *s, const char *t)
1664 {
1665 /* 3GPP TS 27.007 8.15 - Clock */
1666 /* TODO: */
1667 t += 5;
1668 if (!parse_out(s, &t, NULL, 1, "+CCLK:", ""))
1669 return NULL;
1670 return t;
1671 }
1672 /*- End of function --------------------------------------------------------*/
1673
1674 static const char *at_cmd_plus_CCS(at_state_t *s, const char *t)
1675 {
1676 /* IS-135 4.1.22 - Compression status */
1677 /* TODO: */
1678 t += 4;
1679 return t;
1680 }
1681 /*- End of function --------------------------------------------------------*/
1682
1683 static const char *at_cmd_plus_CCUG(at_state_t *s, const char *t)
1684 {
1685 /* 3GPP TS 27.007 7.10 - Closed user group */
1686 /* TODO: */
1687 t += 5;
1688 if (!parse_out(s, &t, NULL, 1, "+CCUG:", ""))
1689 return NULL;
1690 return t;
1691 }
1692 /*- End of function --------------------------------------------------------*/
1693
1694 static const char *at_cmd_plus_CCWA(at_state_t *s, const char *t)
1695 {
1696 /* 3GPP TS 27.007 7.12 - Call waiting */
1697 /* TODO: */
1698 t += 5;
1699 if (!parse_out(s, &t, NULL, 1, "+CCWA:", ""))
1700 return NULL;
1701 return t;
1702 }
1703 /*- End of function --------------------------------------------------------*/
1704
1705 static const char *at_cmd_plus_CCWE(at_state_t *s, const char *t)
1706 {
1707 /* 3GPP TS 27.007 8.28 - Call Meter maximum event */
1708 /* TODO: */
1709 t += 5;
1710 if (!parse_out(s, &t, NULL, 1, "+CCWE:", ""))
1711 return NULL;
1712 return t;
1713 }
1714 /*- End of function --------------------------------------------------------*/
1715
1716 static const char *at_cmd_plus_CDIP(at_state_t *s, const char *t)
1717 {
1718 /* 3GPP TS 27.007 7.9 - Called line identification presentation */
1719 /* TODO: */
1720 t += 5;
1721 if (!parse_out(s, &t, NULL, 1, "+CDIP:", ""))
1722 return NULL;
1723 return t;
1724 }
1725 /*- End of function --------------------------------------------------------*/
1726
1727 static const char *at_cmd_plus_CDIS(at_state_t *s, const char *t)
1728 {
1729 /* 3GPP TS 27.007 8.8 - Display control */
1730 /* TODO: */
1731 t += 5;
1732 if (!parse_out(s, &t, NULL, 1, "+CDIS:", ""))
1733 return NULL;
1734 return t;
1735 }
1736 /*- End of function --------------------------------------------------------*/
1737
1738 static const char *at_cmd_plus_CDV(at_state_t *s, const char *t)
1739 {
1740 /* IS-99 5.6 - Dial command for voice call */
1741 /* TODO: */
1742 t += 4;
1743 return t;
1744 }
1745 /*- End of function --------------------------------------------------------*/
1746
1747 static const char *at_cmd_plus_CEER(at_state_t *s, const char *t)
1748 {
1749 /* 3GPP TS 27.007 6.10 - Extended error report */
1750 /* TODO: */
1751 t += 5;
1752 if (!parse_out(s, &t, NULL, 1, "+CEER:", ""))
1753 return NULL;
1754 return t;
1755 }
1756 /*- End of function --------------------------------------------------------*/
1757
1758 static const char *at_cmd_plus_CESP(at_state_t *s, const char *t)
1759 {
1760 /* GSM07.05 3.2.4 - Enter SMS block mode protocol */
1761 /* TODO: */
1762 t += 5;
1763 return t;
1764 }
1765 /*- End of function --------------------------------------------------------*/
1766
1767 static const char *at_cmd_plus_CFCS(at_state_t *s, const char *t)
1768 {
1769 /* 3GPP TS 27.007 7.24 - Fast call setup conditions */
1770 /* TODO: */
1771 t += 5;
1772 if (!parse_out(s, &t, NULL, 1, "+CFCS:", ""))
1773 return NULL;
1774 return t;
1775 }
1776 /*- End of function --------------------------------------------------------*/
1777
1778 static const char *at_cmd_plus_CFG(at_state_t *s, const char *t)
1779 {
1780 /* IS-99 5.6 - Configuration string */
1781 /* TODO: */
1782 t += 4;
1783 return t;
1784 }
1785 /*- End of function --------------------------------------------------------*/
1786
1787 static const char *at_cmd_plus_CFUN(at_state_t *s, const char *t)
1788 {
1789 /* 3GPP TS 27.007 8.2 - Set phone functionality */
1790 /* TODO: */
1791 t += 5;
1792 if (!parse_out(s, &t, NULL, 1, "+CFUN:", ""))
1793 return NULL;
1794 return t;
1795 }
1796 /*- End of function --------------------------------------------------------*/
1797
1798 static const char *at_cmd_plus_CGACT(at_state_t *s, const char *t)
1799 {
1800 /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */
1801 /* TODO: */
1802 t += 6;
1803 if (!parse_out(s, &t, NULL, 1, "+CGACT:", ""))
1804 return NULL;
1805 return t;
1806 }
1807 /*- End of function --------------------------------------------------------*/
1808
1809 static const char *at_cmd_plus_CGANS(at_state_t *s, const char *t)
1810 {
1811 /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */
1812 /* TODO: */
1813 t += 6;
1814 if (!parse_out(s, &t, NULL, 1, "+CGANS:", ""))
1815 return NULL;
1816 return t;
1817 }
1818 /*- End of function --------------------------------------------------------*/
1819
1820 static const char *at_cmd_plus_CGATT(at_state_t *s, const char *t)
1821 {
1822 /* 3GPP TS 27.007 10.1.9 - PS attach or detach */
1823 /* TODO: */
1824 t += 6;
1825 if (!parse_out(s, &t, NULL, 1, "+CGATT:", ""))
1826 return NULL;
1827 return t;
1828 }
1829 /*- End of function --------------------------------------------------------*/
1830
1831 static const char *at_cmd_plus_CGAUTO(at_state_t *s, const char *t)
1832 {
1833 /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */
1834 /* TODO: */
1835 t += 7;
1836 if (!parse_out(s, &t, NULL, 1, "+CGAUTO:", ""))
1837 return NULL;
1838 return t;
1839 }
1840 /*- End of function --------------------------------------------------------*/
1841
1842 static const char *at_cmd_plus_CGCAP(at_state_t *s, const char *t)
1843 {
1844 /* IS-99 5.6 - Request complete capabilities list */
1845 /* TODO: */
1846 t += 6;
1847 return t;
1848 }
1849 /*- End of function --------------------------------------------------------*/
1850
1851 static const char *at_cmd_plus_CGCLASS(at_state_t *s, const char *t)
1852 {
1853 /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */
1854 /* TODO: */
1855 t += 8;
1856 if (!parse_out(s, &t, NULL, 1, "+CGCLASS:", ""))
1857 return NULL;
1858 return t;
1859 }
1860 /*- End of function --------------------------------------------------------*/
1861
1862 static const char *at_cmd_plus_CGCLOSP(at_state_t *s, const char *t)
1863 {
1864 /* 3GPP TS 27.007 10.1.13 - Configure local Octet Stream PAD parameters (Obsolete) */
1865 /* TODO: */
1866 t += 8;
1867 if (!parse_out(s, &t, NULL, 1, "+CGCLOSP:", ""))
1868 return NULL;
1869 return t;
1870 }
1871 /*- End of function --------------------------------------------------------*/
1872
1873 static const char *at_cmd_plus_CGCLPAD(at_state_t *s, const char *t)
1874 {
1875 /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */
1876 /* TODO: */
1877 t += 8;
1878 if (!parse_out(s, &t, NULL, 1, "+CGCLPAD:", ""))
1879 return NULL;
1880 return t;
1881 }
1882 /*- End of function --------------------------------------------------------*/
1883
1884 static const char *at_cmd_plus_CGCMOD(at_state_t *s, const char *t)
1885 {
1886 /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */
1887 /* TODO: */
1888 t += 7;
1889 if (!parse_out(s, &t, NULL, 1, "+CGCMOD:", ""))
1890 return NULL;
1891 return t;
1892 }
1893 /*- End of function --------------------------------------------------------*/
1894
1895 static const char *at_cmd_plus_CGCS(at_state_t *s, const char *t)
1896 {
1897 /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */
1898 /* TODO: */
1899 t += 5;
1900 if (!parse_out(s, &t, NULL, 1, "+CGCS:", ""))
1901 return NULL;
1902 return t;
1903 }
1904 /*- End of function --------------------------------------------------------*/
1905
1906 static const char *at_cmd_plus_CGDATA(at_state_t *s, const char *t)
1907 {
1908 /* 3GPP TS 27.007 10.1.12 - Enter data state */
1909 /* TODO: */
1910 t += 7;
1911 if (!parse_out(s, &t, NULL, 1, "+CGDATA:", ""))
1912 return NULL;
1913 return t;
1914 }
1915 /*- End of function --------------------------------------------------------*/
1916
1917 static const char *at_cmd_plus_CGDCONT(at_state_t *s, const char *t)
1918 {
1919 /* 3GPP TS 27.007 10.1.1 - Define PDP Context */
1920 /* TODO: */
1921 t += 8;
1922 if (!parse_out(s, &t, NULL, 1, "+CGDCONT:", ""))
1923 return NULL;
1924 return t;
1925 }
1926 /*- End of function --------------------------------------------------------*/
1927
1928 static const char *at_cmd_plus_CGDSCONT(at_state_t *s, const char *t)
1929 {
1930 /* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */
1931 /* TODO: */
1932 t += 9;
1933 if (!parse_out(s, &t, NULL, 1, "+CGDSCONT:", ""))
1934 return NULL;
1935 return t;
1936 }
1937 /*- End of function --------------------------------------------------------*/
1938
1939 static const char *at_cmd_plus_CGEQMIN(at_state_t *s, const char *t)
1940 {
1941 /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */
1942 /* TODO: */
1943 t += 8;
1944 if (!parse_out(s, &t, NULL, 1, "+CGEQMIN:", ""))
1945 return NULL;
1946 return t;
1947 }
1948 /*- End of function --------------------------------------------------------*/
1949
1950 static const char *at_cmd_plus_CGEQNEG(at_state_t *s, const char *t)
1951 {
1952 /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */
1953 /* TODO: */
1954 t += 8;
1955 if (!parse_out(s, &t, NULL, 1, "+CGEQNEG:", ""))
1956 return NULL;
1957 return t;
1958 }
1959 /*- End of function --------------------------------------------------------*/
1960
1961 static const char *at_cmd_plus_CGEQREQ(at_state_t *s, const char *t)
1962 {
1963 /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */
1964 /* TODO: */
1965 t += 8;
1966 if (!parse_out(s, &t, NULL, 1, "+CGEQREQ:", ""))
1967 return NULL;
1968 return t;
1969 }
1970 /*- End of function --------------------------------------------------------*/
1971
1972 static const char *at_cmd_plus_CGEREP(at_state_t *s, const char *t)
1973 {
1974 /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */
1975 /* TODO: */
1976 t += 7;
1977 if (!parse_out(s, &t, NULL, 1, "+CGEREP:", ""))
1978 return NULL;
1979 return t;
1980 }
1981 /*- End of function --------------------------------------------------------*/
1982
1983 static const char *at_cmd_plus_CGMI(at_state_t *s, const char *t)
1984 {
1985 /* 3GPP TS 27.007 5.1 - Request manufacturer identification */
1986 /* TODO: */
1987 t += 5;
1988 if (!parse_out(s, &t, NULL, 1, "+CGMI:", ""))
1989 return NULL;
1990 return t;
1991 }
1992 /*- End of function --------------------------------------------------------*/
1993
1994 static const char *at_cmd_plus_CGMM(at_state_t *s, const char *t)
1995 {
1996 /* 3GPP TS 27.007 5.2 - Request model identification */
1997 /* TODO: */
1998 t += 5;
1999 if (!parse_out(s, &t, NULL, 1, "+CGMM:", ""))
2000 return NULL;
2001 return t;
2002 }
2003 /*- End of function --------------------------------------------------------*/
2004
2005 static const char *at_cmd_plus_CGMR(at_state_t *s, const char *t)
2006 {
2007 /* 3GPP TS 27.007 5.3 - Request revision identification */
2008 /* TODO: */
2009 t += 5;
2010 if (!parse_out(s, &t, NULL, 1, "+CGMR:", ""))
2011 return NULL;
2012 return t;
2013 }
2014 /*- End of function --------------------------------------------------------*/
2015
2016 static const char *at_cmd_plus_CGOI(at_state_t *s, const char *t)
2017 {
2018 /* IS-99 5.6 - Request global object identification */
2019 /* TODO: */
2020 t += 5;
2021 return t;
2022 }
2023 /*- End of function --------------------------------------------------------*/
2024
2025 static const char *at_cmd_plus_CGPADDR(at_state_t *s, const char *t)
2026 {
2027 /* 3GPP TS 27.007 10.1.14 - Show PDP address */
2028 /* TODO: */
2029 t += 8;
2030 if (!parse_out(s, &t, NULL, 1, "+CGPADDR:", ""))
2031 return NULL;
2032 return t;
2033 }
2034 /*- End of function --------------------------------------------------------*/
2035
2036 static const char *at_cmd_plus_CGQMIN(at_state_t *s, const char *t)
2037 {
2038 /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */
2039 /* TODO: */
2040 t += 7;
2041 if (!parse_out(s, &t, NULL, 1, "+CGQMIN:", ""))
2042 return NULL;
2043 return t;
2044 }
2045 /*- End of function --------------------------------------------------------*/
2046
2047 static const char *at_cmd_plus_CGQREQ(at_state_t *s, const char *t)
2048 {
2049 /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */
2050 /* TODO: */
2051 t += 7;
2052 if (!parse_out(s, &t, NULL, 1, "+CGQREQ:", ""))
2053 return NULL;
2054 return t;
2055 }
2056 /*- End of function --------------------------------------------------------*/
2057
2058 static const char *at_cmd_plus_CGREG(at_state_t *s, const char *t)
2059 {
2060 /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */
2061 /* TODO: */
2062 t += 6;
2063 if (!parse_out(s, &t, NULL, 1, "+CGREG:", ""))
2064 return NULL;
2065 return t;
2066 }
2067 /*- End of function --------------------------------------------------------*/
2068
2069 static const char *at_cmd_plus_CGSMS(at_state_t *s, const char *t)
2070 {
2071 /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */
2072 /* TODO: */
2073 t += 6;
2074 if (!parse_out(s, &t, NULL, 1, "+CGSMS:", ""))
2075 return NULL;
2076 return t;
2077 }
2078 /*- End of function --------------------------------------------------------*/
2079
2080 static const char *at_cmd_plus_CGSN(at_state_t *s, const char *t)
2081 {
2082 /* 3GPP TS 27.007 5.4 - Request product serial number identification */
2083 /* TODO: */
2084 t += 5;
2085 if (!parse_out(s, &t, NULL, 1, "+CGSN:", ""))
2086 return NULL;
2087 return t;
2088 }
2089 /*- End of function --------------------------------------------------------*/
2090
2091 static const char *at_cmd_plus_CGTFT(at_state_t *s, const char *t)
2092 {
2093 /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */
2094 /* TODO: */
2095 t += 6;
2096 if (!parse_out(s, &t, NULL, 1, "+CGTFT:", ""))
2097 return NULL;
2098 return t;
2099 }
2100 /*- End of function --------------------------------------------------------*/
2101
2102 static const char *at_cmd_plus_CHLD(at_state_t *s, const char *t)
2103 {
2104 /* 3GPP TS 27.007 7.13 - Call related supplementary services */
2105 /* TODO: */
2106 t += 5;
2107 if (!parse_out(s, &t, NULL, 1, "+CHLD:", ""))
2108 return NULL;
2109 return t;
2110 }
2111 /*- End of function --------------------------------------------------------*/
2112
2113 static const char *at_cmd_plus_CHSA(at_state_t *s, const char *t)
2114 {
2115 /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */
2116 /* TODO: */
2117 t += 5;
2118 if (!parse_out(s, &t, NULL, 1, "+CHSA:", ""))
2119 return NULL;
2120 return t;
2121 }
2122 /*- End of function --------------------------------------------------------*/
2123
2124 static const char *at_cmd_plus_CHSC(at_state_t *s, const char *t)
2125 {
2126 /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */
2127 /* TODO: */
2128 t += 5;
2129 if (!parse_out(s, &t, NULL, 1, "+CHSC:", ""))
2130 return NULL;
2131 return t;
2132 }
2133 /*- End of function --------------------------------------------------------*/
2134
2135 static const char *at_cmd_plus_CHSD(at_state_t *s, const char *t)
2136 {
2137 /* 3GPP TS 27.007 6.12 - HSCSD device parameters */
2138 /* TODO: */
2139 t += 5;
2140 if (!parse_out(s, &t, NULL, 1, "+CHSD:", ""))
2141 return NULL;
2142 return t;
2143 }
2144 /*- End of function --------------------------------------------------------*/
2145
2146 static const char *at_cmd_plus_CHSN(at_state_t *s, const char *t)
2147 {
2148 /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */
2149 /* TODO: */
2150 t += 5;
2151 if (!parse_out(s, &t, NULL, 1, "+CHSN:", ""))
2152 return NULL;
2153 return t;
2154 }
2155 /*- End of function --------------------------------------------------------*/
2156
2157 static const char *at_cmd_plus_CHSR(at_state_t *s, const char *t)
2158 {
2159 /* 3GPP TS 27.007 6.16 - HSCSD parameters report */
2160 /* TODO: */
2161 t += 5;
2162 if (!parse_out(s, &t, NULL, 1, "+CHSR:", ""))
2163 return NULL;
2164 return t;
2165 }
2166 /*- End of function --------------------------------------------------------*/
2167
2168 static const char *at_cmd_plus_CHST(at_state_t *s, const char *t)
2169 {
2170 /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */
2171 /* TODO: */
2172 t += 5;
2173 if (!parse_out(s, &t, NULL, 1, "+CHST:", ""))
2174 return NULL;
2175 return t;
2176 }
2177 /*- End of function --------------------------------------------------------*/
2178
2179 static const char *at_cmd_plus_CHSU(at_state_t *s, const char *t)
2180 {
2181 /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */
2182 /* TODO: */
2183 t += 5;
2184 if (!parse_out(s, &t, NULL, 1, "+CHSU:", ""))
2185 return NULL;
2186 return t;
2187 }
2188 /*- End of function --------------------------------------------------------*/
2189
2190 static const char *at_cmd_plus_CHUP(at_state_t *s, const char *t)
2191 {
2192 /* 3GPP TS 27.007 6.5 - Hangup call */
2193 /* TODO: */
2194 t += 5;
2195 if (!parse_out(s, &t, NULL, 1, "+CHUP:", ""))
2196 return NULL;
2197 return t;
2198 }
2199 /*- End of function --------------------------------------------------------*/
2200
2201 static const char *at_cmd_plus_CHV(at_state_t *s, const char *t)
2202 {
2203 /* IS-99 5.6 - Hang-up voice */
2204 /* TODO: */
2205 t += 4;
2206 return t;
2207 }
2208 /*- End of function --------------------------------------------------------*/
2209
2210 static const char *at_cmd_plus_CIMI(at_state_t *s, const char *t)
2211 {
2212 /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */
2213 /* TODO: */
2214 t += 5;
2215 if (!parse_out(s, &t, NULL, 1, "+CIMI:", ""))
2216 return NULL;
2217 return t;
2218 }
2219 /*- End of function --------------------------------------------------------*/
2220
2221 static const char *at_cmd_plus_CIND(at_state_t *s, const char *t)
2222 {
2223 /* 3GPP TS 27.007 8.9 - Indicator control */
2224 /* TODO: */
2225 t += 5;
2226 if (!parse_out(s, &t, NULL, 1, "+CIND:", ""))
2227 return NULL;
2228 return t;
2229 }
2230 /*- End of function --------------------------------------------------------*/
2231
2232 static const char *at_cmd_plus_CIT(at_state_t *s, const char *t)
2233 {
2234 /* IS-99 5.6 - Command state inactivity timer */
2235 /* TODO: */
2236 t += 4;
2237 return t;
2238 }
2239 /*- End of function --------------------------------------------------------*/
2240
2241 static const char *at_cmd_plus_CKPD(at_state_t *s, const char *t)
2242 {
2243 /* 3GPP TS 27.007 8.7 - Keypad control */
2244 /* TODO: */
2245 t += 5;
2246 if (!parse_out(s, &t, NULL, 1, "+CKPD:", ""))
2247 return NULL;
2248 return t;
2249 }
2250 /*- End of function --------------------------------------------------------*/
2251
2252 static const char *at_cmd_plus_CLAC(at_state_t *s, const char *t)
2253 {
2254 /* 3GPP TS 27.007 8.37 - List all available AT commands */
2255 /* TODO: */
2256 t += 5;
2257 if (!parse_out(s, &t, NULL, 1, "+CLAC:", ""))
2258 return NULL;
2259 return t;
2260 }
2261 /*- End of function --------------------------------------------------------*/
2262
2263 static const char *at_cmd_plus_CLAE(at_state_t *s, const char *t)
2264 {
2265 /* 3GPP TS 27.007 8.31 - Language Event */
2266 /* TODO: */
2267 t += 5;
2268 if (!parse_out(s, &t, NULL, 1, "+CLAE:", ""))
2269 return NULL;
2270 return t;
2271 }
2272 /*- End of function --------------------------------------------------------*/
2273
2274 static const char *at_cmd_plus_CLAN(at_state_t *s, const char *t)
2275 {
2276 /* 3GPP TS 27.007 8.30 - Set Language */
2277 /* TODO: */
2278 t += 5;
2279 if (!parse_out(s, &t, NULL, 1, "+CLAN:", ""))
2280 return NULL;
2281 return t;
2282 }
2283 /*- End of function --------------------------------------------------------*/
2284
2285 static const char *at_cmd_plus_CLCC(at_state_t *s, const char *t)
2286 {
2287 /* 3GPP TS 27.007 7.18 - List current calls */
2288 /* TODO: */
2289 t += 5;
2290 if (!parse_out(s, &t, NULL, 1, "+CLCC:", ""))
2291 return NULL;
2292 return t;
2293 }
2294 /*- End of function --------------------------------------------------------*/
2295
2296 static const char *at_cmd_plus_CLCK(at_state_t *s, const char *t)
2297 {
2298 /* 3GPP TS 27.007 7.4 - Facility lock */
2299 /* TODO: */
2300 t += 5;
2301 if (!parse_out(s, &t, NULL, 1, "+CLCK:", ""))
2302 return NULL;
2303 return t;
2304 }
2305 /*- End of function --------------------------------------------------------*/
2306
2307 static const char *at_cmd_plus_CLIP(at_state_t *s, const char *t)
2308 {
2309 /* 3GPP TS 27.007 7.6 - Calling line identification presentation */
2310 /* TODO: */
2311 t += 5;
2312 if (!parse_out(s, &t, NULL, 1, "+CLIP:", ""))
2313 return NULL;
2314 return t;
2315 }
2316 /*- End of function --------------------------------------------------------*/
2317
2318 static const char *at_cmd_plus_CLIR(at_state_t *s, const char *t)
2319 {
2320 /* 3GPP TS 27.007 7.7 - Calling line identification restriction */
2321 /* TODO: */
2322 t += 5;
2323 if (!parse_out(s, &t, NULL, 1, "+CLIR:", ""))
2324 return NULL;
2325 return t;
2326 }
2327 /*- End of function --------------------------------------------------------*/
2328
2329 static const char *at_cmd_plus_CLVL(at_state_t *s, const char *t)
2330 {
2331 /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */
2332 /* TODO: */
2333 t += 5;
2334 if (!parse_out(s, &t, NULL, 1, "+CLVL:", ""))
2335 return NULL;
2336 return t;
2337 }
2338 /*- End of function --------------------------------------------------------*/
2339
2340 static const char *at_cmd_plus_CMAR(at_state_t *s, const char *t)
2341 {
2342 /* 3GPP TS 27.007 8.36 - Master Reset */
2343 /* TODO: */
2344 t += 5;
2345 if (!parse_out(s, &t, NULL, 1, "+CMAR:", ""))
2346 return NULL;
2347 return t;
2348 }
2349 /*- End of function --------------------------------------------------------*/
2350
2351 static const char *at_cmd_plus_CMEC(at_state_t *s, const char *t)
2352 {
2353 /* 3GPP TS 27.007 8.6 - Mobile Termination control mode */
2354 /* TODO: */
2355 t += 5;
2356 if (!parse_out(s, &t, NULL, 1, "+CMEC:", ""))
2357 return NULL;
2358 return t;
2359 }
2360 /*- End of function --------------------------------------------------------*/
2361
2362 static const char *at_cmd_plus_CMEE(at_state_t *s, const char *t)
2363 {
2364 /* GSM07.07 9.1 - Report mobile equipment error */
2365 /* TODO: */
2366 t += 5;
2367 return t;
2368 }
2369 /*- End of function --------------------------------------------------------*/
2370
2371 static const char *at_cmd_plus_CMER(at_state_t *s, const char *t)
2372 {
2373 /* 3GPP TS 27.007 8.10 - Mobile Termination event reporting */
2374 /* TODO: */
2375 t += 5;
2376 if (!parse_out(s, &t, NULL, 1, "+CMER:", ""))
2377 return NULL;
2378 return t;
2379 }
2380 /*- End of function --------------------------------------------------------*/
2381
2382 static const char *at_cmd_plus_CMGC(at_state_t *s, const char *t)
2383 {
2384 /* GSM07.05 3.5.5/4.5 - Send command */
2385 /* TODO: */
2386 t += 5;
2387 return t;
2388 }
2389 /*- End of function --------------------------------------------------------*/
2390
2391 static const char *at_cmd_plus_CMGD(at_state_t *s, const char *t)
2392 {
2393 /* GSM07.05 3.5.4 - Delete message */
2394 /* TODO: */
2395 t += 5;
2396 return t;
2397 }
2398 /*- End of function --------------------------------------------------------*/
2399
2400 static const char *at_cmd_plus_CMGF(at_state_t *s, const char *t)
2401 {
2402 /* GSM07.05 3.2.3 - Message Format */
2403 /* TODO: */
2404 t += 5;
2405 return t;
2406 }
2407 /*- End of function --------------------------------------------------------*/
2408
2409 static const char *at_cmd_plus_CMGL(at_state_t *s, const char *t)
2410 {
2411 /* GSM07.05 3.4.2/4.1 - List messages */
2412 /* TODO: */
2413 t += 5;
2414 return t;
2415 }
2416 /*- End of function --------------------------------------------------------*/
2417
2418 static const char *at_cmd_plus_CMGR(at_state_t *s, const char *t)
2419 {
2420 /* GSM07.05 3.4.3/4.2 - Read message */
2421 /* TODO: */
2422 t += 5;
2423 return t;
2424 }
2425 /*- End of function --------------------------------------------------------*/
2426
2427 static const char *at_cmd_plus_CMGS(at_state_t *s, const char *t)
2428 {
2429 /* GSM07.05 3.5.1/4.3 - Send message */
2430 /* TODO: */
2431 t += 5;
2432 return t;
2433 }
2434 /*- End of function --------------------------------------------------------*/
2435
2436 static const char *at_cmd_plus_CMGW(at_state_t *s, const char *t)
2437 {
2438 /* GSM07.05 3.5.3/4.4 - Write message to memory */
2439 /* TODO: */
2440 t += 5;
2441 return t;
2442 }
2443 /*- End of function --------------------------------------------------------*/
2444
2445 static const char *at_cmd_plus_CMIP(at_state_t *s, const char *t)
2446 {
2447 /* IS-99 5.6 - Mobile station IP address */
2448 /* TODO: */
2449 t += 5;
2450 return t;
2451 }
2452 /*- End of function --------------------------------------------------------*/
2453
2454 static const char *at_cmd_plus_CMM(at_state_t *s, const char *t)
2455 {
2456 /* IS-135 4.1.23 - Menu map */
2457 /* TODO: */
2458 t += 4;
2459 return t;
2460 }
2461 /*- End of function --------------------------------------------------------*/
2462
2463 static const char *at_cmd_plus_CMMS(at_state_t *s, const char *t)
2464 {
2465 /* GSM07.05 3.5.6 - More messages to send */
2466 /* TODO: */
2467 t += 5;
2468 return t;
2469 }
2470 /*- End of function --------------------------------------------------------*/
2471
2472 static const char *at_cmd_plus_CMOD(at_state_t *s, const char *t)
2473 {
2474 /* 3GPP TS 27.007 6.4 - Call mode */
2475 /* TODO: */
2476 t += 5;
2477 if (!parse_out(s, &t, NULL, 1, "+CMOD:", ""))
2478 return NULL;
2479 return t;
2480 }
2481 /*- End of function --------------------------------------------------------*/
2482
2483 static const char *at_cmd_plus_CMSS(at_state_t *s, const char *t)
2484 {
2485 /* GSM07.05 3.5.2/4.7 - Send message from storage */
2486 /* TODO: */
2487 t += 5;
2488 return t;
2489 }
2490 /*- End of function --------------------------------------------------------*/
2491
2492 static const char *at_cmd_plus_CMUT(at_state_t *s, const char *t)
2493 {
2494 /* 3GPP TS 27.007 8.24 - Mute control */
2495 /* TODO: */
2496 t += 5;
2497 if (!parse_out(s, &t, NULL, 1, "+CMUT:", ""))
2498 return NULL;
2499 return t;
2500 }
2501 /*- End of function --------------------------------------------------------*/
2502
2503 static const char *at_cmd_plus_CNMA(at_state_t *s, const char *t)
2504 {
2505 /* GSM07.05 3.4.4/4.6 - New message acknowledgement to terminal adapter */
2506 /* TODO: */
2507 t += 5;
2508 return t;
2509 }
2510 /*- End of function --------------------------------------------------------*/
2511
2512 static const char *at_cmd_plus_CNMI(at_state_t *s, const char *t)
2513 {
2514 /* GSM07.05 3.4.1 - New message indications to terminal equipment */
2515 /* TODO: */
2516 t += 5;
2517 return t;
2518 }
2519 /*- End of function --------------------------------------------------------*/
2520
2521 static const char *at_cmd_plus_CMUX(at_state_t *s, const char *t)
2522 {
2523 /* 3GPP TS 27.007 5.7 - Multiplexing mode */
2524 /* TODO: */
2525 t += 5;
2526 if (!parse_out(s, &t, NULL, 1, "+CMUX:", ""))
2527 return NULL;
2528 return t;
2529 }
2530 /*- End of function --------------------------------------------------------*/
2531
2532 static const char *at_cmd_plus_CNUM(at_state_t *s, const char *t)
2533 {
2534 /* 3GPP TS 27.007 7.1 - Subscriber number */
2535 /* TODO: */
2536 t += 5;
2537 if (!parse_out(s, &t, NULL, 1, "+CNUM:", ""))
2538 return NULL;
2539 return t;
2540 }
2541 /*- End of function --------------------------------------------------------*/
2542
2543 static const char *at_cmd_plus_COLP(at_state_t *s, const char *t)
2544 {
2545 /* 3GPP TS 27.007 7.8 - Connected line identification presentation */
2546 /* TODO: */
2547 t += 5;
2548 if (!parse_out(s, &t, NULL, 1, "+COLP:", ""))
2549 return NULL;
2550 return t;
2551 }
2552 /*- End of function --------------------------------------------------------*/
2553
2554 static const char *at_cmd_plus_COPN(at_state_t *s, const char *t)
2555 {
2556 /* 3GPP TS 27.007 7.21 - Read operator names */
2557 /* TODO: */
2558 t += 5;
2559 if (!parse_out(s, &t, NULL, 1, "+COPN:", ""))
2560 return NULL;
2561 return t;
2562 }
2563 /*- End of function --------------------------------------------------------*/
2564
2565 static const char *at_cmd_plus_COPS(at_state_t *s, const char *t)
2566 {
2567 /* 3GPP TS 27.007 7.3 - PLMN selection */
2568 /* TODO: */
2569 t += 5;
2570 if (!parse_out(s, &t, NULL, 1, "+COPS:", ""))
2571 return NULL;
2572 return t;
2573 }
2574 /*- End of function --------------------------------------------------------*/
2575
2576 static const char *at_cmd_plus_COS(at_state_t *s, const char *t)
2577 {
2578 /* IS-135 4.1.24 - Originating service */
2579 /* TODO: */
2580 t += 4;
2581 return t;
2582 }
2583 /*- End of function --------------------------------------------------------*/
2584
2585 static const char *at_cmd_plus_COTDI(at_state_t *s, const char *t)
2586 {
2587 /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */
2588 /* TODO: */
2589 t += 6;
2590 if (!parse_out(s, &t, NULL, 1, "+COTDI:", ""))
2591 return NULL;
2592 return t;
2593 }
2594 /*- End of function --------------------------------------------------------*/
2595
2596 static const char *at_cmd_plus_CPAS(at_state_t *s, const char *t)
2597 {
2598 /* 3GPP TS 27.007 8.1 - Phone activity status */
2599 /* TODO: */
2600 t += 5;
2601 if (!parse_out(s, &t, NULL, 1, "+CPAS:", ""))
2602 return NULL;
2603 return t;
2604 }
2605 /*- End of function --------------------------------------------------------*/
2606
2607 static const char *at_cmd_plus_CPBF(at_state_t *s, const char *t)
2608 {
2609 /* 3GPP TS 27.007 8.13 - Find phonebook entries */
2610 /* TODO: */
2611 t += 5;
2612 if (!parse_out(s, &t, NULL, 1, "+CPBF:", ""))
2613 return NULL;
2614 return t;
2615 }
2616 /*- End of function --------------------------------------------------------*/
2617
2618 static const char *at_cmd_plus_CPBR(at_state_t *s, const char *t)
2619 {
2620 /* 3GPP TS 27.007 8.12 - Read phonebook entries */
2621 /* TODO: */
2622 t += 5;
2623 if (!parse_out(s, &t, NULL, 1, "+CPBR:", ""))
2624 return NULL;
2625 return t;
2626 }
2627 /*- End of function --------------------------------------------------------*/
2628
2629 static const char *at_cmd_plus_CPBS(at_state_t *s, const char *t)
2630 {
2631 /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */
2632 /* TODO: */
2633 t += 5;
2634 if (!parse_out(s, &t, NULL, 1, "+CPBS:", ""))
2635 return NULL;
2636 return t;
2637 }
2638 /*- End of function --------------------------------------------------------*/
2639
2640 static const char *at_cmd_plus_CPBW(at_state_t *s, const char *t)
2641 {
2642 /* 3GPP TS 27.007 8.14 - Write phonebook entry */
2643 /* TODO: */
2644 t += 5;
2645 if (!parse_out(s, &t, NULL, 1, "+CPBW:", ""))
2646 return NULL;
2647 return t;
2648 }
2649 /*- End of function --------------------------------------------------------*/
2650
2651 static const char *at_cmd_plus_CPIN(at_state_t *s, const char *t)
2652 {
2653 /* 3GPP TS 27.007 8.3 - Enter PIN */
2654 /* TODO: */
2655 t += 5;
2656 if (!parse_out(s, &t, NULL, 1, "+CPIN:", ""))
2657 return NULL;
2658 return t;
2659 }
2660 /*- End of function --------------------------------------------------------*/
2661
2662 static const char *at_cmd_plus_CPLS(at_state_t *s, const char *t)
2663 {
2664 /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */
2665 /* TODO: */
2666 t += 5;
2667 if (!parse_out(s, &t, NULL, 1, "+CPLS:", ""))
2668 return NULL;
2669 return t;
2670 }
2671 /*- End of function --------------------------------------------------------*/
2672
2673 static const char *at_cmd_plus_CPMS(at_state_t *s, const char *t)
2674 {
2675 /* GSM07.05 3.2.2 - Preferred message storage */
2676 /* TODO: */
2677 t += 5;
2678 return t;
2679 }
2680 /*- End of function --------------------------------------------------------*/
2681
2682 static const char *at_cmd_plus_CPOL(at_state_t *s, const char *t)
2683 {
2684 /* 3GPP TS 27.007 7.19 - Preferred PLMN list */
2685 /* TODO: */
2686 t += 5;
2687 if (!parse_out(s, &t, NULL, 1, "+CPOL:", ""))
2688 return NULL;
2689 return t;
2690 }
2691 /*- End of function --------------------------------------------------------*/
2692
2693 static const char *at_cmd_plus_CPPS(at_state_t *s, const char *t)
2694 {
2695 /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */
2696 /* TODO: */
2697 t += 5;
2698 if (!parse_out(s, &t, NULL, 1, "+CPPS:", ""))
2699 return NULL;
2700 return t;
2701 }
2702 /*- End of function --------------------------------------------------------*/
2703
2704 static const char *at_cmd_plus_CPROT(at_state_t *s, const char *t)
2705 {
2706 /* 3GPP TS 27.007 8.42 - Enter protocol mode */
2707 /* TODO: */
2708 t += 6;
2709 if (!parse_out(s, &t, NULL, 1, "+CPROT:", ""))
2710 return NULL;
2711 return t;
2712 }
2713 /*- End of function --------------------------------------------------------*/
2714
2715 static const char *at_cmd_plus_CPUC(at_state_t *s, const char *t)
2716 {
2717 /* 3GPP TS 27.007 8.27 - Price per unit and currency table */
2718 /* TODO: */
2719 t += 5;
2720 if (!parse_out(s, &t, NULL, 1, "+CPUC:", ""))
2721 return NULL;
2722 return t;
2723 }
2724 /*- End of function --------------------------------------------------------*/
2725
2726 static const char *at_cmd_plus_CPWC(at_state_t *s, const char *t)
2727 {
2728 /* 3GPP TS 27.007 8.29 - Power class */
2729 /* TODO: */
2730 t += 5;
2731 if (!parse_out(s, &t, NULL, 1, "+CPWC:", ""))
2732 return NULL;
2733 return t;
2734 }
2735 /*- End of function --------------------------------------------------------*/
2736
2737 static const char *at_cmd_plus_CPWD(at_state_t *s, const char *t)
2738 {
2739 /* 3GPP TS 27.007 7.5 - Change password */
2740 /* TODO: */
2741 t += 5;
2742 if (!parse_out(s, &t, NULL, 1, "+CPWD:", ""))
2743 return NULL;
2744 return t;
2745 }
2746 /*- End of function --------------------------------------------------------*/
2747
2748 static const char *at_cmd_plus_CQD(at_state_t *s, const char *t)
2749 {
2750 /* IS-135 4.1.25 - Query disconnect timer */
2751 /* TODO: */
2752 t += 4;
2753 return t;
2754 }
2755 /*- End of function --------------------------------------------------------*/
2756
2757 static const char *at_cmd_plus_CR(at_state_t *s, const char *t)
2758 {
2759 /* 3GPP TS 27.007 6.9 - Service reporting control */
2760 /* TODO: */
2761 t += 3;
2762 if (!parse_out(s, &t, NULL, 1, "+CR:", ""))
2763 return NULL;
2764 return t;
2765 }
2766 /*- End of function --------------------------------------------------------*/
2767
2768 static const char *at_cmd_plus_CRC(at_state_t *s, const char *t)
2769 {
2770 /* 3GPP TS 27.007 6.11 - Cellular result codes */
2771 /* TODO: */
2772 t += 4;
2773 if (!parse_out(s, &t, NULL, 1, "+CRC:", ""))
2774 return NULL;
2775 return t;
2776 }
2777 /*- End of function --------------------------------------------------------*/
2778
2779 static const char *at_cmd_plus_CREG(at_state_t *s, const char *t)
2780 {
2781 /* 3GPP TS 27.007 7.2 - Network registration */
2782 /* TODO: */
2783 t += 5;
2784 if (!parse_out(s, &t, NULL, 1, "+CREG:", ""))
2785 return NULL;
2786 return t;
2787 }
2788 /*- End of function --------------------------------------------------------*/
2789
2790 static const char *at_cmd_plus_CRES(at_state_t *s, const char *t)
2791 {
2792 /* GSM07.05 3.3.6 - Restore Settings */
2793 /* TODO: */
2794 t += 5;
2795 if (!parse_out(s, &t, NULL, 1, "+CRLP:", ""))
2796 return NULL;
2797 return t;
2798 }
2799 /*- End of function --------------------------------------------------------*/
2800
2801 static const char *at_cmd_plus_CRLP(at_state_t *s, const char *t)
2802 {
2803 /* 3GPP TS 27.007 6.8 - Radio link protocol */
2804 /* TODO: */
2805 t += 5;
2806 if (!parse_out(s, &t, NULL, 1, "+CRLP:", ""))
2807 return NULL;
2808 return t;
2809 }
2810 /*- End of function --------------------------------------------------------*/
2811
2812 static const char *at_cmd_plus_CRM(at_state_t *s, const char *t)
2813 {
2814 /* IS-99 5.6 - Set rm interface protocol */
2815 /* TODO: */
2816 t += 4;
2817 return t;
2818 }
2819 /*- End of function --------------------------------------------------------*/
2820
2821 static const char *at_cmd_plus_CRMC(at_state_t *s, const char *t)
2822 {
2823 /* 3GPP TS 27.007 8.34 - Ring Melody Control */
2824 /* TODO: */
2825 t += 5;
2826 if (!parse_out(s, &t, NULL, 1, "+CRMC:", ""))
2827 return NULL;
2828 return t;
2829 }
2830 /*- End of function --------------------------------------------------------*/
2831
2832 static const char *at_cmd_plus_CRMP(at_state_t *s, const char *t)
2833 {
2834 /* 3GPP TS 27.007 8.35 - Ring Melody Playback */
2835 /* TODO: */
2836 t += 5;
2837 if (!parse_out(s, &t, NULL, 1, "+CRMP:", ""))
2838 return NULL;
2839 return t;
2840 }
2841 /*- End of function --------------------------------------------------------*/
2842
2843 static const char *at_cmd_plus_CRSL(at_state_t *s, const char *t)
2844 {
2845 /* 3GPP TS 27.007 8.21 - Ringer sound level */
2846 /* TODO: */
2847 t += 5;
2848 if (!parse_out(s, &t, NULL, 1, "+CRSL:", ""))
2849 return NULL;
2850 return t;
2851 }
2852 /*- End of function --------------------------------------------------------*/
2853
2854 static const char *at_cmd_plus_CRSM(at_state_t *s, const char *t)
2855 {
2856 /* 3GPP TS 27.007 8.18 - Restricted SIM access */
2857 /* TODO: */
2858 t += 5;
2859 if (!parse_out(s, &t, NULL, 1, "+CRSM:", ""))
2860 return NULL;
2861 return t;
2862 }
2863 /*- End of function --------------------------------------------------------*/
2864
2865 static const char *at_cmd_plus_CSAS(at_state_t *s, const char *t)
2866 {
2867 /* GSM07.05 3.3.5 - Save settings */
2868 /* TODO: */
2869 t += 5;
2870 return t;
2871 }
2872 /*- End of function --------------------------------------------------------*/
2873
2874 static const char *at_cmd_plus_CSCA(at_state_t *s, const char *t)
2875 {
2876 /* GSM07.05 3.3.1 - Service centre address */
2877 /* TODO: */
2878 t += 5;
2879 return t;
2880 }
2881 /*- End of function --------------------------------------------------------*/
2882
2883 static const char *at_cmd_plus_CSCB(at_state_t *s, const char *t)
2884 {
2885 /* GSM07.05 3.3.4 - Select cell broadcast message types */
2886 /* TODO: */
2887 t += 5;
2888 return t;
2889 }
2890 /*- End of function --------------------------------------------------------*/
2891
2892 static const char *at_cmd_plus_CSCC(at_state_t *s, const char *t)
2893 {
2894 /* 3GPP TS 27.007 8.19 - Secure control command */
2895 /* TODO: */
2896 t += 5;
2897 if (!parse_out(s, &t, NULL, 1, "+CSCC:", ""))
2898 return NULL;
2899 return t;
2900 }
2901 /*- End of function --------------------------------------------------------*/
2902
2903 static const char *at_cmd_plus_CSCS(at_state_t *s, const char *t)
2904 {
2905 /* 3GPP TS 27.007 5.5 - Select TE character set */
2906 /* TODO: */
2907 t += 5;
2908 if (!parse_out(s, &t, NULL, 1, "+CSCS:", ""))
2909 return NULL;
2910 return t;
2911 }
2912 /*- End of function --------------------------------------------------------*/
2913
2914 static const char *at_cmd_plus_CSDF(at_state_t *s, const char *t)
2915 {
2916 /* 3GPP TS 27.007 6.22 - Settings date format */
2917 /* TODO: */
2918 t += 5;
2919 if (!parse_out(s, &t, NULL, 1, "+CSDF:", ""))
2920 return NULL;
2921 return t;
2922 }
2923 /*- End of function --------------------------------------------------------*/
2924
2925 static const char *at_cmd_plus_CSDH(at_state_t *s, const char *t)
2926 {
2927 /* GSM07.05 3.3.3 - Show text mode parameters */
2928 /* TODO: */
2929 t += 5;
2930 return t;
2931 }
2932 /*- End of function --------------------------------------------------------*/
2933
2934 static const char *at_cmd_plus_CSGT(at_state_t *s, const char *t)
2935 {
2936 /* 3GPP TS 27.007 8.32 - Set Greeting Text */
2937 /* TODO: */
2938 t += 5;
2939 if (!parse_out(s, &t, NULL, 1, "+CSGT:", ""))
2940 return NULL;
2941 return t;
2942 }
2943 /*- End of function --------------------------------------------------------*/
2944
2945 static const char *at_cmd_plus_CSIL(at_state_t *s, const char *t)
2946 {
2947 /* 3GPP TS 27.007 6.23 - Silence Command */
2948 /* TODO: */
2949 t += 5;
2950 if (!parse_out(s, &t, NULL, 1, "+CSIL:", ""))
2951 return NULL;
2952 return t;
2953 }
2954 /*- End of function --------------------------------------------------------*/
2955
2956 static const char *at_cmd_plus_CSIM(at_state_t *s, const char *t)
2957 {
2958 /* 3GPP TS 27.007 8.17 - Generic SIM access */
2959 /* TODO: */
2960 t += 5;
2961 if (!parse_out(s, &t, NULL, 1, "+CSIM:", ""))
2962 return NULL;
2963 return t;
2964 }
2965 /*- End of function --------------------------------------------------------*/
2966
2967 static const char *at_cmd_plus_CSMP(at_state_t *s, const char *t)
2968 {
2969 /* GSM07.05 3.3.2 - Set text mode parameters */
2970 /* TODO: */
2971 t += 5;
2972 return t;
2973 }
2974 /*- End of function --------------------------------------------------------*/
2975
2976 static const char *at_cmd_plus_CSMS(at_state_t *s, const char *t)
2977 {
2978 /* GSM07.05 3.2.1 - Select Message Service */
2979 /* TODO: */
2980 t += 5;
2981 return t;
2982 }
2983 /*- End of function --------------------------------------------------------*/
2984
2985 static const char *at_cmd_plus_CSNS(at_state_t *s, const char *t)
2986 {
2987 /* 3GPP TS 27.007 6.19 - Single numbering scheme */
2988 /* TODO: */
2989 t += 5;
2990 if (!parse_out(s, &t, NULL, 1, "+CSNS:", ""))
2991 return NULL;
2992 return t;
2993 }
2994 /*- End of function --------------------------------------------------------*/
2995
2996 static const char *at_cmd_plus_CSQ(at_state_t *s, const char *t)
2997 {
2998 /* 3GPP TS 27.007 8.5 - Signal quality */
2999 /* TODO: */
3000 t += 4;
3001 if (!parse_out(s, &t, NULL, 1, "+CSQ:", ""))
3002 return NULL;
3003 return t;
3004 }
3005 /*- End of function --------------------------------------------------------*/
3006
3007 static const char *at_cmd_plus_CSS(at_state_t *s, const char *t)
3008 {
3009 /* IS-135 4.1.28 - Serving system identification */
3010 /* TODO: */
3011 t += 4;
3012 return t;
3013 }
3014 /*- End of function --------------------------------------------------------*/
3015
3016 static const char *at_cmd_plus_CSSN(at_state_t *s, const char *t)
3017 {
3018 /* 3GPP TS 27.007 7.17 - Supplementary service notifications */
3019 /* TODO: */
3020 t += 5;
3021 if (!parse_out(s, &t, NULL, 1, "+CSSN:", ""))
3022 return NULL;
3023 return t;
3024 }
3025 /*- End of function --------------------------------------------------------*/
3026
3027 static const char *at_cmd_plus_CSTA(at_state_t *s, const char *t)
3028 {
3029 /* 3GPP TS 27.007 6.1 - Select type of address */
3030 /* TODO: */
3031 t += 5;
3032 if (!parse_out(s, &t, NULL, 1, "+CSTA:", ""))
3033 return NULL;
3034 return t;
3035 }
3036 /*- End of function --------------------------------------------------------*/
3037
3038 static const char *at_cmd_plus_CSTF(at_state_t *s, const char *t)
3039 {
3040 /* 3GPP TS 27.007 6.24 - Settings time format */
3041 /* TODO: */
3042 t += 5;
3043 if (!parse_out(s, &t, NULL, 1, "+CSTF:", ""))
3044 return NULL;
3045 return t;
3046 }
3047 /*- End of function --------------------------------------------------------*/
3048
3049 static const char *at_cmd_plus_CSVM(at_state_t *s, const char *t)
3050 {
3051 /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */
3052 /* TODO: */
3053 t += 5;
3054 if (!parse_out(s, &t, NULL, 1, "+CSVM:", ""))
3055 return NULL;
3056 return t;
3057 }
3058 /*- End of function --------------------------------------------------------*/
3059
3060 static const char *at_cmd_plus_CTA(at_state_t *s, const char *t)
3061 {
3062 /* IS-135 4.1.29 - MT-Terminated async. Data calls */
3063 /* TODO: */
3064 t += 4;
3065 return t;
3066 }
3067 /*- End of function --------------------------------------------------------*/
3068
3069 static const char *at_cmd_plus_CTF(at_state_t *s, const char *t)
3070 {
3071 /* IS-135 4.1.30 - MT-Terminated FAX calls */
3072 /* TODO: */
3073 t += 4;
3074 return t;
3075 }
3076 /*- End of function --------------------------------------------------------*/
3077
3078 static const char *at_cmd_plus_CTFR(at_state_t *s, const char *t)
3079 {
3080 /* 3GPP TS 27.007 7.14 - Call deflection */
3081 /* TODO: */
3082 t += 5;
3083 if (!parse_out(s, &t, NULL, 1, "+CTFR:", ""))
3084 return NULL;
3085 return t;
3086 }
3087 /*- End of function --------------------------------------------------------*/
3088
3089 static const char *at_cmd_plus_CTZR(at_state_t *s, const char *t)
3090 {
3091 /* 3GPP TS 27.007 8.41 - Time Zone Reporting */
3092 /* TODO: */
3093 t += 5;
3094 if (!parse_out(s, &t, NULL, 1, "+CTZR:", ""))
3095 return NULL;
3096 return t;
3097 }
3098 /*- End of function --------------------------------------------------------*/
3099
3100 static const char *at_cmd_plus_CTZU(at_state_t *s, const char *t)
3101 {
3102 /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */
3103 /* TODO: */
3104 t += 5;
3105 if (!parse_out(s, &t, NULL, 1, "+CTZU:", ""))
3106 return NULL;
3107 return t;
3108 }
3109 /*- End of function --------------------------------------------------------*/
3110
3111 static const char *at_cmd_plus_CUSD(at_state_t *s, const char *t)
3112 {
3113 /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */
3114 /* TODO: */
3115 t += 5;
3116 if (!parse_out(s, &t, NULL, 1, "+CUSD:", ""))
3117 return NULL;
3118 return t;
3119 }
3120 /*- End of function --------------------------------------------------------*/
3121
3122 static const char *at_cmd_plus_CUUS1(at_state_t *s, const char *t)
3123 {
3124 /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */
3125 /* TODO: */
3126 t += 6;
3127 if (!parse_out(s, &t, NULL, 1, "+CUUS1:", ""))
3128 return NULL;
3129 return t;
3130 }
3131 /*- End of function --------------------------------------------------------*/
3132
3133 static const char *at_cmd_plus_CV120(at_state_t *s, const char *t)
3134 {
3135 /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */
3136 /* TODO: */
3137 t += 6;
3138 if (!parse_out(s, &t, NULL, 1, "+CV120:", ""))
3139 return NULL;
3140 return t;
3141 }
3142 /*- End of function --------------------------------------------------------*/
3143
3144 static const char *at_cmd_plus_CVHU(at_state_t *s, const char *t)
3145 {
3146 /* 3GPP TS 27.007 6.20 - Voice Hangup Control */
3147 /* TODO: */
3148 t += 5;
3149 if (!parse_out(s, &t, NULL, 1, "+CVHU:", ""))
3150 return NULL;
3151 return t;
3152 }
3153 /*- End of function --------------------------------------------------------*/
3154
3155 static const char *at_cmd_plus_CVIB(at_state_t *s, const char *t)
3156 {
3157 /* 3GPP TS 27.007 8.22 - Vibrator mode */
3158 /* TODO: */
3159 t += 5;
3160 if (!parse_out(s, &t, NULL, 1, "+CVIB:", ""))
3161 return NULL;
3162 return t;
3163 }
3164 /*- End of function --------------------------------------------------------*/
3165
3166 static const char *at_cmd_plus_CXT(at_state_t *s, const char *t)
3167 {
3168 /* IS-99 5.6 - Cellular extension */
3169 /* TODO: */
3170 t += 4;
3171 return t;
3172 }
3173 /*- End of function --------------------------------------------------------*/
3174
3175 static const char *at_cmd_plus_DR(at_state_t *s, const char *t)
3176 {
3177 /* V.250 6.6.2 - Data compression reporting */
3178 /* TODO: */
3179 t += 3;
3180 if (!parse_out(s, &t, NULL, 1, "+DR:", ""))
3181 return NULL;
3182 return t;
3183 }
3184 /*- End of function --------------------------------------------------------*/
3185
3186 static const char *at_cmd_plus_DS(at_state_t *s, const char *t)
3187 {
3188 /* V.250 6.6.1 - Data compression */
3189 /* TODO: */
3190 t += 3;
3191 if (!parse_out(s, &t, NULL, 1, "+DS:", ""))
3192 return NULL;
3193 return t;
3194 }
3195 /*- End of function --------------------------------------------------------*/
3196
3197 static const char *at_cmd_plus_DS44(at_state_t *s, const char *t)
3198 {
3199 /* V.250 6.6.2 - V.44 data compression */
3200 /* TODO: */
3201 t += 5;
3202 return t;
3203 }
3204 /*- End of function --------------------------------------------------------*/
3205
3206 static const char *at_cmd_plus_EB(at_state_t *s, const char *t)
3207 {
3208 /* V.250 6.5.2 - Break handling in error control operation */
3209 /* TODO: */
3210 t += 3;
3211 if (!parse_out(s, &t, NULL, 1, "+EB:", ""))
3212 return NULL;
3213 return t;
3214 }
3215 /*- End of function --------------------------------------------------------*/
3216
3217 static const char *at_cmd_plus_EFCS(at_state_t *s, const char *t)
3218 {
3219 /* V.250 6.5.4 - 32-bit frame check sequence */
3220 /* TODO: */
3221 t += 5;
3222 if (!parse_out(s, &t, NULL, 2, "+EFCS:", "(0-2)"))
3223 return NULL;
3224 return t;
3225 }
3226 /*- End of function --------------------------------------------------------*/
3227
3228 static const char *at_cmd_plus_EFRAM(at_state_t *s, const char *t)
3229 {
3230 /* V.250 6.5.8 - Frame length */
3231 /* TODO: */
3232 t += 6;
3233 if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+EFRAM:", "(1-65535),(1-65535)"))
3234 return NULL;
3235 return t;
3236 }
3237 /*- End of function --------------------------------------------------------*/
3238
3239 static const char *at_cmd_plus_ER(at_state_t *s, const char *t)
3240 {
3241 /* V.250 6.5.5 - Error control reporting */
3242 /* 0 Error control reporting disabled (no +ER intermediate result code transmitted)
3243 1 Error control reporting enabled (+ER intermediate result code transmitted) */
3244 /* TODO: */
3245 t += 3;
3246 if (!parse_out(s, &t, NULL, 1, "+ER:", "(0,1)"))
3247 return NULL;
3248 return t;
3249 }
3250 /*- End of function --------------------------------------------------------*/
3251
3252 static const char *at_cmd_plus_ES(at_state_t *s, const char *t)
3253 {
3254 static const int maxes[3] =
3255 {
3256 7, 4, 9
3257 };
3258 int *locations[3];
3259
3260 /* V.250 6.5.1 - Error control selection */
3261
3262 /* orig_rqst
3263 0: Direct mode
3264 1: Initiate call with Buffered mode only
3265 2: Initiate V.42 without Detection Phase. If Rec. V.8 is in use, this is a request to disable V.42 Detection Phase
3266 3: Initiate V.42 with Detection Phase
3267 4: Initiate Altemative Protocol
3268 5: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
3269 is delivered. V.24 circuits 113 and 115 are activated when Data State is entered
3270 6: Initiate Synchronous Access Mode when connection is completed, and Data State is entered
3271 7: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered
3272
3273 orig_fbk
3274 0: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
3275 DTE-DCE data rate and use V.14 buffered mode with flow control during non-error-control operation
3276 1: Error control optional (either LAPM or Alternative acceptable); if error control not established, change
3277 DTE-DCE data rate to match line rate and use Direct mode
3278 2: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
3279 3: Error control required (only LAPM acceptable); if error control not established, disconnect
3280 4: Error control required (only Altemative protocol acceptable); if error control not established, disconnect
3281
3282 ans_fbk
3283 0: Direct mode
3284 1: Error control disabled, use Buffered mode
3285 2: Error control optional (either LAPM or Alternative acceptable); if error control not established, maintain
3286 DTE-DCE data rate and use local buffering and flow control during non-error-control operation
3287 3: Error control optional (either LAPM or Alternative acceptable); if error control not established, change
3288 DTE-DCE data rate to match line rate and use Direct mode
3289 4: Error control required (either LAPM or Alternative acceptable); if error control not established, disconnect
3290 5: Error control required (only LAPM acceptable); if error control not established, disconnect
3291 6: Error control required (only Alternative protocol acceptable); if error control not established, disconnect
3292 7: Initiate Synchronous Mode when connection is completed, immediately after the entire CONNECT result code
3293 is delivered. V.24 cicuits 113 and 115 are activated when Data State is entered
3294 8: Initiate Synchronous Access Mode when connection is completed, and Data State is entered
3295 9: Initiate Frame Tunnelling Mode when connection is completed, and Data State is entered */
3296
3297 /* TODO: */
3298 t += 3;
3299 locations[0] = NULL;
3300 locations[1] = NULL;
3301 locations[2] = NULL;
3302 if (!parse_n_out(s, &t, locations, maxes, 3, "+ES:", "(0-7),(0-4),(0-9)"))
3303 return NULL;
3304 return t;
3305 }
3306 /*- End of function --------------------------------------------------------*/
3307
3308 static const char *at_cmd_plus_ESA(at_state_t *s, const char *t)
3309 {
3310 static const int maxes[8] =
3311 {
3312 2, 1, 1, 1, 2, 1, 255, 255
3313 };
3314 int *locations[8];
3315 int i;
3316
3317 /* V.80 8.2 - Synchronous access mode configuration */
3318 /* TODO: */
3319 t += 4;
3320 for (i = 0; i < 8; i++)
3321 locations[i] = NULL;
3322 if (!parse_n_out(s, &t, locations, maxes, 8, "+ESA:", "(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)"))
3323 return NULL;
3324 return t;
3325 }
3326 /*- End of function --------------------------------------------------------*/
3327
3328 static const char *at_cmd_plus_ESR(at_state_t *s, const char *t)
3329 {
3330 /* V.250 6.5.3 - Selective repeat */
3331 /* TODO: */
3332 t += 4;
3333 return t;
3334 }
3335 /*- End of function --------------------------------------------------------*/
3336
3337 static const char *at_cmd_plus_ETBM(at_state_t *s, const char *t)
3338 {
3339 /* V.250 6.5.6 - Call termination buffer management */
3340 /* TODO: */
3341 t += 5;
3342 if (!parse_2_out(s, &t, NULL, 2, NULL, 2, "+ETBM:", "(0-2),(0-2),(0-30)"))
3343 return NULL;
3344 return t;
3345 }
3346 /*- End of function --------------------------------------------------------*/
3347
3348 static const char *at_cmd_plus_EWIND(at_state_t *s, const char *t)
3349 {
3350 /* V.250 6.5.7 - Window size */
3351 /* TODO: */
3352 t += 6;
3353 if (!parse_2_out(s, &t, &s->rx_window, 127, &s->tx_window, 127, "+EWIND:", "(1-127),(1-127)"))
3354 return NULL;
3355 return t;
3356 }
3357 /*- End of function --------------------------------------------------------*/
3358
3359 static const char *at_cmd_plus_F34(at_state_t *s, const char *t)
3360 {
3361 static const int maxes[5] =
3362 {
3363 14, 14, 2, 14, 14
3364 };
3365 int *locations[5];
3366 int i;
3367
3368 /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
3369 /* Syntax: +F34=[<maxp>][,[<minp>][,<prefc>][,<maxp2>][,<minp2]] */
3370 /* TODO */
3371 t += 4;
3372 for (i = 0; i < 5; i++)
3373 locations[i] = NULL;
3374 if (!parse_n_out(s, &t, locations, maxes, 5, "+F34:", "(0-14),(0-14),(0-2),(0-14),(0-14)"))
3375 return NULL;
3376 return t;
3377 }
3378 /*- End of function --------------------------------------------------------*/
3379
3380 static const char *at_cmd_plus_FAA(at_state_t *s, const char *t)
3381 {
3382 /* T.32 8.5.2.5 - Adaptive answer parameter */
3383 /* TODO */
3384 t += 4;
3385 return t;
3386 }
3387 /*- End of function --------------------------------------------------------*/
3388
3389 static const char *at_cmd_plus_FAP(at_state_t *s, const char *t)
3390 {
3391 /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */
3392 /* TODO */
3393 t += 4;
3394 return t;
3395 }
3396 /*- End of function --------------------------------------------------------*/
3397
3398 static const char *at_cmd_plus_FAR(at_state_t *s, const char *t)
3399 {
3400 /* T.31 8.5.1 - Adaptive reception control */
3401 t += 4;
3402 if (!parse_out(s, &t, &s->p.adaptive_receive, 1, NULL, "0,1"))
3403 return NULL;
3404 return t;
3405 }
3406 /*- End of function --------------------------------------------------------*/
3407
3408 static const char *at_cmd_plus_FBO(at_state_t *s, const char *t)
3409 {
3410 /* T.32 8.5.3.4 - Phase C data bit order */
3411 /* TODO */
3412 t += 4;
3413 return t;
3414 }
3415 /*- End of function --------------------------------------------------------*/
3416
3417 static const char *at_cmd_plus_FBS(at_state_t *s, const char *t)
3418 {
3419 /* T.32 8.5.3.2 - Buffer Size, read only parameter */
3420 /* TODO */
3421 t += 4;
3422 return t;
3423 }
3424 /*- End of function --------------------------------------------------------*/
3425
3426 static const char *at_cmd_plus_FBU(at_state_t *s, const char *t)
3427 {
3428 /* T.32 8.5.1.10 - HDLC Frame Reporting parameter */
3429 /* TODO */
3430 t += 4;
3431 return t;
3432 }
3433 /*- End of function --------------------------------------------------------*/
3434
3435 static const char *at_cmd_plus_FCC(at_state_t *s, const char *t)
3436 {
3437 /* T.32 8.5.1.1 - DCE capabilities parameters */
3438 /* TODO */
3439 t += 4;
3440 return t;
3441 }
3442 /*- End of function --------------------------------------------------------*/
3443
3444 static const char *at_cmd_plus_FCL(at_state_t *s, const char *t)
3445 {
3446 /* T.31 8.5.2 - Carrier loss timeout */
3447 t += 4;
3448 if (!parse_out(s, &t, &s->carrier_loss_timeout, 255, NULL, "(0-255)"))
3449 return NULL;
3450 return t;
3451 }
3452 /*- End of function --------------------------------------------------------*/
3453
3454 static const char *at_cmd_plus_FCLASS(at_state_t *s, const char *t)
3455 {
3456 /* T.31 8.2 - Capabilities identification and control */
3457 t += 7;
3458 /* T.31 says the reply string should be "0,1.0", however making
3459 it "0,1,1.0" makes things compatible with a lot more software
3460 that may be expecting a pre-T.31 modem. */
3461 if (!parse_string_list_out(s, &t, &s->fclass_mode, 1, NULL, "0,1,1.0"))
3462 return NULL;
3463 return t;
3464 }
3465 /*- End of function --------------------------------------------------------*/
3466
3467 static const char *at_cmd_plus_FCQ(at_state_t *s, const char *t)
3468 {
3469 /* T.32 8.5.2.3 - Copy quality checking parameter */
3470 /* TODO */
3471 t += 4;
3472 return t;
3473 }
3474 /*- End of function --------------------------------------------------------*/
3475
3476 static const char *at_cmd_plus_FCR(at_state_t *s, const char *t)
3477 {
3478 /* T.32 8.5.1.9 - Capability to receive parameter */
3479 /* TODO */
3480 t += 4;
3481 return t;
3482 }
3483 /*- End of function --------------------------------------------------------*/
3484
3485 static const char *at_cmd_plus_FCS(at_state_t *s, const char *t)
3486 {
3487 /* T.32 8.5.1.3 - Current Session Results parameters */
3488 /* TODO */
3489 t += 4;
3490 return t;
3491 }
3492 /*- End of function --------------------------------------------------------*/
3493
3494 static const char *at_cmd_plus_FCT(at_state_t *s, const char *t)
3495 {
3496 /* T.32 8.5.2.6 - DTE phase C timeout parameter */
3497 /* TODO */
3498 t += 4;
3499 return t;
3500 }
3501 /*- End of function --------------------------------------------------------*/
3502
3503 static const char *at_cmd_plus_FDD(at_state_t *s, const char *t)
3504 {
3505 /* T.31 8.5.3 - Double escape character replacement */
3506 t += 4;
3507 if (!parse_out(s, &t, &s->p.double_escape, 1, NULL, "(0,1)"))
3508 return NULL;
3509 return t;
3510 }
3511 /*- End of function --------------------------------------------------------*/
3512
3513 static const char *at_cmd_plus_FDR(at_state_t *s, const char *t)
3514 {
3515 /* T.32 8.3.4 - Data reception command */
3516 /* TODO */
3517 t += 4;
3518 return t;
3519 }
3520 /*- End of function --------------------------------------------------------*/
3521
3522 static const char *at_cmd_plus_FDT(at_state_t *s, const char *t)
3523 {
3524 /* T.32 8.3.3 - Data transmission command */
3525 /* TODO */
3526 t += 4;
3527 return t;
3528 }
3529 /*- End of function --------------------------------------------------------*/
3530
3531 static const char *at_cmd_plus_FEA(at_state_t *s, const char *t)
3532 {
3533 /* T.32 8.5.3.5 - Phase C received EOL alignment parameter */
3534 /* TODO */
3535 t += 4;
3536 return t;
3537 }
3538 /*- End of function --------------------------------------------------------*/
3539
3540 static const char *at_cmd_plus_FFC(at_state_t *s, const char *t)
3541 {
3542 /* T.32 8.5.3.6 - Format conversion parameter */
3543 /* TODO */
3544 t += 4;
3545 return t;
3546 }
3547 /*- End of function --------------------------------------------------------*/
3548
3549 static const char *at_cmd_plus_FFD(at_state_t *s, const char *t)
3550 {
3551 /* T.32 8.5.1.14 - File diagnostic message parameter */
3552 /* TODO */
3553 t += 4;
3554 return t;
3555 }
3556 /*- End of function --------------------------------------------------------*/
3557
3558 static const char *at_cmd_plus_FHS(at_state_t *s, const char *t)
3559 {
3560 /* T.32 8.5.2.7 - Call termination status parameter */
3561 /* TODO */
3562 t += 4;
3563 return t;
3564 }
3565 /*- End of function --------------------------------------------------------*/
3566
3567 static const char *at_cmd_plus_FIE(at_state_t *s, const char *t)
3568 {
3569 /* T.32 8.5.2.1 - Procedure interrupt enable parameter */
3570 /* TODO */
3571 t += 4;
3572 return t;
3573 }
3574 /*- End of function --------------------------------------------------------*/
3575
3576 static const char *at_cmd_plus_FIP(at_state_t *s, const char *t)
3577 {
3578 /* T.32 8.3.6 - Initialize Facsimile Parameters */
3579 t += 4;
3580 return t;
3581 }
3582 /*- End of function --------------------------------------------------------*/
3583
3584 static const char *at_cmd_plus_FIS(at_state_t *s, const char *t)
3585 {
3586 /* T.32 8.5.1.2 - Current session parameters */
3587 /* TODO */
3588 t += 4;
3589 return t;
3590 }
3591 /*- End of function --------------------------------------------------------*/
3592
3593 static const char *at_cmd_plus_FIT(at_state_t *s, const char *t)
3594 {
3595 /* T.31 8.5.4 - DTE inactivity timeout */
3596 t += 4;
3597 if (!parse_2_out(s, &t, &s->dte_inactivity_timeout, 255, &s->dte_inactivity_action, 1, "+FIT:", "(0-255),(0-1)"))
3598 return NULL;
3599 return t;
3600 }
3601 /*- End of function --------------------------------------------------------*/
3602
3603 static const char *at_cmd_plus_FKS(at_state_t *s, const char *t)
3604 {
3605 /* T.32 8.3.5 - Session termination command */
3606 /* TODO: */
3607 t += 4;
3608 return t;
3609 }
3610 /*- End of function --------------------------------------------------------*/
3611
3612 static const char *at_cmd_plus_FLI(at_state_t *s, const char *t)
3613 {
3614 /* T.32 8.5.1.5 - Local ID string parameter, TSI or CSI */
3615 /* TODO: */
3616 t += 4;
3617 return t;
3618 }
3619 /*- End of function --------------------------------------------------------*/
3620
3621 static const char *at_cmd_plus_FLO(at_state_t *s, const char *t)
3622 {
3623 /* T.31 Annex A */
3624 /* Implement something similar to the V.250 +IFC command */
3625 /* TODO: */
3626 t += 4;
3627 return t;
3628 }
3629 /*- End of function --------------------------------------------------------*/
3630
3631 static const char *at_cmd_plus_FLP(at_state_t *s, const char *t)
3632 {
3633 /* T.32 8.5.1.7 - Indicate document to poll parameter */
3634 /* TODO: */
3635 t += 4;
3636 return t;
3637 }
3638 /*- End of function --------------------------------------------------------*/
3639
3640 static const char *at_cmd_plus_FMI(at_state_t *s, const char *t)
3641 {
3642 /* T.31 says to duplicate +GMI */
3643 t += 4;
3644 if (t[0] == '?')
3645 {
3646 at_put_response(s, manufacturer);
3647 t += 1;
3648 }
3649 return t;
3650 }
3651 /*- End of function --------------------------------------------------------*/
3652
3653 static const char *at_cmd_plus_FMM(at_state_t *s, const char *t)
3654 {
3655 /* T.31 says to duplicate +GMM */
3656 t += 4;
3657 if (t[0] == '?')
3658 {
3659 at_put_response(s, model);
3660 t += 1;
3661 }
3662 return t;
3663 }
3664 /*- End of function --------------------------------------------------------*/
3665
3666 static const char *at_cmd_plus_FMR(at_state_t *s, const char *t)
3667 {
3668 /* T.31 says to duplicate +GMR */
3669 t += 4;
3670 if (t[0] == '?')
3671 {
3672 at_put_response(s, revision);
3673 t += 1;
3674 }
3675 return t;
3676 }
3677 /*- End of function --------------------------------------------------------*/
3678
3679 static const char *at_cmd_plus_FMS(at_state_t *s, const char *t)
3680 {
3681 /* T.32 8.5.2.9 - Minimum phase C speed parameter */
3682 t += 4;
3683 return t;
3684 }
3685 /*- End of function --------------------------------------------------------*/
3686
3687 static const char *at_cmd_plus_FND(at_state_t *s, const char *t)
3688 {
3689 /* T.32 8.5.2.10 - Non-Standard Message Data Indication parameter */
3690 t += 4;
3691 return t;
3692 }
3693 /*- End of function --------------------------------------------------------*/
3694
3695 static const char *at_cmd_plus_FNR(at_state_t *s, const char *t)
3696 {
3697 /* T.32 8.5.1.11 - Negotiation message reporting control parameters */
3698 t += 4;
3699 return t;
3700 }
3701 /*- End of function --------------------------------------------------------*/
3702
3703 static const char *at_cmd_plus_FNS(at_state_t *s, const char *t)
3704 {
3705 /* T.32 8.5.1.6 - Non-Standard Frame FIF parameter */
3706 t += 4;
3707 return t;
3708 }
3709 /*- End of function --------------------------------------------------------*/
3710
3711 static const char *at_cmd_plus_FPA(at_state_t *s, const char *t)
3712 {
3713 /* T.32 8.5.1.13 - Selective polling address parameter */
3714 t += 4;
3715 return t;
3716 }
3717 /*- End of function --------------------------------------------------------*/
3718
3719 static const char *at_cmd_plus_FPI(at_state_t *s, const char *t)
3720 {
3721 /* T.32 8.5.1.5 - Local Polling ID String parameter */
3722 t += 4;
3723 return t;
3724 }
3725 /*- End of function --------------------------------------------------------*/
3726
3727 static const char *at_cmd_plus_FPP(at_state_t *s, const char *t)
3728 {
3729 /* T.32 8.5.3 - Facsimile packet protocol */
3730 t += 4;
3731 return t;
3732 }
3733 /*- End of function --------------------------------------------------------*/
3734
3735 static const char *at_cmd_plus_FPR(at_state_t *s, const char *t)
3736 {
3737 /* T.31 Annex A */
3738 /* Implement something similar to the V.250 +IPR command */
3739 t += 4;
3740 if (!parse_out(s, &t, &s->dte_rate, 115200, NULL, "115200"))
3741 return NULL;
3742 return t;
3743 }
3744 /*- End of function --------------------------------------------------------*/
3745
3746 static const char *at_cmd_plus_FPS(at_state_t *s, const char *t)
3747 {
3748 /* T.32 8.5.2.2 - Page Status parameter */
3749 t += 4;
3750 return t;
3751 }
3752 /*- End of function --------------------------------------------------------*/
3753
3754 static const char *at_cmd_plus_FPW(at_state_t *s, const char *t)
3755 {
3756 /* T.32 8.5.1.13 - PassWord parameter (Sending or Polling) */
3757 t += 4;
3758 return t;
3759 }
3760 /*- End of function --------------------------------------------------------*/
3761
3762 static const char *at_cmd_plus_FRH(at_state_t *s, const char *t)
3763 {
3764 /* T.31 8.3.6 - HDLC receive */
3765 if (!process_class1_cmd(s, &t))
3766 return NULL;
3767 return t;
3768 }
3769 /*- End of function --------------------------------------------------------*/
3770
3771 static const char *at_cmd_plus_FRM(at_state_t *s, const char *t)
3772 {
3773 /* T.31 8.3.4 - Facsimile receive */
3774 if (!process_class1_cmd(s, &t))
3775 return NULL;
3776 return t;
3777 }
3778 /*- End of function --------------------------------------------------------*/
3779
3780 static const char *at_cmd_plus_FRQ(at_state_t *s, const char *t)
3781 {
3782 /* T.32 8.5.2.4 - Receive Quality Thresholds parameters */
3783 /* TODO */
3784 t += 4;
3785 return t;
3786 }
3787 /*- End of function --------------------------------------------------------*/
3788
3789 static const char *at_cmd_plus_FRS(at_state_t *s, const char *t)
3790 {
3791 /* T.31 8.3.2 - Receive silence */
3792 if (!process_class1_cmd(s, &t))
3793 return NULL;
3794 return t;
3795 }
3796 /*- End of function --------------------------------------------------------*/
3797
3798 static const char *at_cmd_plus_FRY(at_state_t *s, const char *t)
3799 {
3800 /* T.32 8.5.2.8 - ECM Retry Value parameter */
3801 /* TODO */
3802 t += 4;
3803 return t;
3804 }
3805 /*- End of function --------------------------------------------------------*/
3806
3807 static const char *at_cmd_plus_FSA(at_state_t *s, const char *t)
3808 {
3809 /* T.32 8.5.1.13 - Subaddress parameter */
3810 /* TODO */
3811 t += 4;
3812 return t;
3813 }
3814 /*- End of function --------------------------------------------------------*/
3815
3816 static const char *at_cmd_plus_FSP(at_state_t *s, const char *t)
3817 {
3818 /* T.32 8.5.1.8 - Request to poll parameter */
3819 /* TODO */
3820 t += 4;
3821 return t;
3822 }
3823 /*- End of function --------------------------------------------------------*/
3824
3825 static const char *at_cmd_plus_FTH(at_state_t *s, const char *t)
3826 {
3827 /* T.31 8.3.5 - HDLC transmit */
3828 if (!process_class1_cmd(s, &t))
3829 return NULL;
3830 return t;
3831 }
3832 /*- End of function --------------------------------------------------------*/
3833
3834 static const char *at_cmd_plus_FTM(at_state_t *s, const char *t)
3835 {
3836 /* T.31 8.3.3 - Facsimile transmit */
3837 if (!process_class1_cmd(s, &t))
3838 return NULL;
3839 return t;
3840 }
3841 /*- End of function --------------------------------------------------------*/
3842
3843 static const char *at_cmd_plus_FTS(at_state_t *s, const char *t)
3844 {
3845 /* T.31 8.3.1 - Transmit silence */
3846 if (!process_class1_cmd(s, &t))
3847 return NULL;
3848 return t;
3849 }
3850 /*- End of function --------------------------------------------------------*/
3851
3852 static const char *at_cmd_plus_GCAP(at_state_t *s, const char *t)
3853 {
3854 /* V.250 6.1.9 - Request complete capabilities list */
3855 t += 5;
3856 /* Response elements
3857 +FCLASS +F (FAX) commands
3858 +MS +M (modulation control) commands +MS and +MR
3859 +MV18S +M (modulation control) commands +MV18S and +MV18R
3860 +ES +E (error control) commands +ES, +EB, +ER, +EFCS, and +ETBM
3861 +DS +D (data compression) commands +DS and +DR */
3862 /* TODO: make this adapt to the configuration we really have. */
3863 if (t[0] == '?')
3864 {
3865 at_put_response(s, "+GCAP:+FCLASS");
3866 t += 1;
3867 }
3868 return t;
3869 }
3870 /*- End of function --------------------------------------------------------*/
3871
3872 static const char *at_cmd_plus_GCI(at_state_t *s, const char *t)
3873 {
3874 /* V.250 6.1.10 - Country of installation, */
3875 t += 4;
3876 if (!parse_hex_out(s, &t, &s->country_of_installation, 255, "+GCI:", "(00-FF)"))
3877 return NULL;
3878 return t;
3879 }
3880 /*- End of function --------------------------------------------------------*/
3881
3882 static const char *at_cmd_plus_GMI(at_state_t *s, const char *t)
3883 {
3884 /* V.250 6.1.4 - Request manufacturer identification */
3885 t += 4;
3886 if (t[0] == '?')
3887 {
3888 at_put_response(s, manufacturer);
3889 t += 1;
3890 }
3891 return t;
3892 }
3893 /*- End of function --------------------------------------------------------*/
3894
3895 static const char *at_cmd_plus_GMM(at_state_t *s, const char *t)
3896 {
3897 /* V.250 6.1.5 - Request model identification */
3898 t += 4;
3899 if (t[0] == '?')
3900 {
3901 at_put_response(s, model);
3902 t += 1;
3903 }
3904 return t;
3905 }
3906 /*- End of function --------------------------------------------------------*/
3907
3908 static const char *at_cmd_plus_GMR(at_state_t *s, const char *t)
3909 {
3910 /* V.250 6.1.6 - Request revision identification */
3911 t += 4;
3912 if (t[0] == '?')
3913 {
3914 at_put_response(s, revision);
3915 t += 1;
3916 }
3917 return t;
3918 }
3919 /*- End of function --------------------------------------------------------*/
3920
3921 static const char *at_cmd_plus_GOI(at_state_t *s, const char *t)
3922 {
3923 /* V.250 6.1.8 - Request global object identification */
3924 /* TODO: */
3925 t += 4;
3926 if (t[0] == '?')
3927 {
3928 at_put_response(s, GLOBAL_OBJECT_IDENTITY);
3929 t += 1;
3930 }
3931 return t;
3932 }
3933 /*- End of function --------------------------------------------------------*/
3934
3935 static const char *at_cmd_plus_GSN(at_state_t *s, const char *t)
3936 {
3937 /* V.250 6.1.7 - Request product serial number identification */
3938 /* TODO: */
3939 t += 4;
3940 if (t[0] == '?')
3941 {
3942 at_put_response(s, SERIAL_NUMBER);
3943 t += 1;
3944 }
3945 return t;
3946 }
3947 /*- End of function --------------------------------------------------------*/
3948
3949 static const char *at_cmd_plus_IBC(at_state_t *s, const char *t)
3950 {
3951 static const int maxes[13] =
3952 {
3953 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
3954 };
3955 int *locations[13];
3956 int i;
3957
3958 /* V.80 7.9 - Control of in-band control */
3959 /* TODO: */
3960 t += 4;
3961 /* 0: In-band control service disabled
3962 1: In-band control service enabled, 7-bit codes allowed, and top bit insignificant
3963 2; In-band control service enabled, 7-bit codes allowed, and 8-bit codes available
3964
3965 Circuits 105, 106, 107, 108, 109, 110, 125, 132, 133, 135, 142 in that order. For each one:
3966 0: disabled
3967 1: enabled
3968
3969 DCE line connect status reports:
3970 0: disabled
3971 1: enabled */
3972 for (i = 0; i < 13; i++)
3973 locations[i] = NULL;
3974 if (!parse_n_out(s, &t, locations, maxes, 13, "+IBC:", "(0-2),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0.1),(0,1)"))
3975 return NULL;
3976 return t;
3977 }
3978 /*- End of function --------------------------------------------------------*/
3979
3980 static const char *at_cmd_plus_IBM(at_state_t *s, const char *t)
3981 {
3982 static const int maxes[3] =
3983 {
3984 7, 255, 255
3985 };
3986 int *locations[3];
3987
3988 /* V.80 7.10 - In-band MARK idle reporting control */
3989 /* TODO: */
3990 t += 4;
3991 /* Report control
3992 0: No reports
3993 1: Report only once when <T1 > expires
3994 2: Report each time <T2> expires
3995 3: Report once when <T1> expires, and then each time <T2> expires
3996 4: Report only when the Mark-ldle Period ends; T3 = the entire interval
3997 5: Report the first time when <T1> is exceeded, and then once more when the mark idle period ends
3998 6: Report each time when <T2> is exceeded, and then once more when the mark idle period ends;
3999 T3 = entire interval -- N*T2
4000 7: report the first time when <T1> is exceeded, and then each time <T2> is exceeded, and then once
4001 more when the mark idle period ends; T3 = entire mark idle period -- N*T2 - T1
4002
4003 T1 in units of 10ms
4004
4005 T2 in units of 10ms */
4006 locations[0] = NULL;
4007 locations[1] = NULL;
4008 locations[2] = NULL;
4009 if (!parse_n_out(s, &t, locations, maxes, 3, "+IBM:", "(0-7),(0-255),(0-255)"))
4010 return NULL;
4011 return t;
4012 }
4013 /*- End of function --------------------------------------------------------*/
4014
4015 static const char *at_cmd_plus_ICF(at_state_t *s, const char *t)
4016 {
4017 /* V.250 6.2.11 - DTE-DCE character framing */
4018 t += 4;
4019 /* Character format
4020 0: auto detect
4021 1: 8 data 2 stop
4022 2: 8 data 1 parity 1 stop
4023 3: 8 data 1 stop
4024 4: 7 data 2 stop
4025 5: 7 data 1 parity 1 stop
4026 6: 7 data 1 stop
4027
4028 Parity
4029 0: Odd
4030 1: Even
4031 2: Mark
4032 3: Space */
4033 if (!parse_2_out(s, &t, &s->dte_char_format, 6, &s->dte_parity, 3, "+ICF:", "(0-6),(0-3)"))
4034 return NULL;
4035 return t;
4036 }
4037 /*- End of function --------------------------------------------------------*/
4038
4039 static const char *at_cmd_plus_ICLOK(at_state_t *s, const char *t)
4040 {
4041 /* V.250 6.2.14 - Select sync transmit clock source */
4042 t += 6;
4043 if (!parse_out(s, &t, &s->sync_tx_clock_source, 2, "+ICLOK:", "(0-2)"))
4044 return NULL;
4045 return t;
4046 }
4047 /*- End of function --------------------------------------------------------*/
4048
4049 static const char *at_cmd_plus_IDSR(at_state_t *s, const char *t)
4050 {
4051 /* V.250 6.2.16 - Select data set ready option */
4052 t += 5;
4053 if (!parse_out(s, &t, &s->dsr_option, 2, "+IDSR:", "(0-2)"))
4054 return NULL;
4055 return t;
4056 }
4057 /*- End of function --------------------------------------------------------*/
4058
4059 static const char *at_cmd_plus_IFC(at_state_t *s, const char *t)
4060 {
4061 /* V.250 6.2.12 - DTE-DCE local flow control */
4062 /* TODO: */
4063 t += 4;
4064 return t;
4065 }
4066 /*- End of function --------------------------------------------------------*/
4067
4068 static const char *at_cmd_plus_ILRR(at_state_t *s, const char *t)
4069 {
4070 /* V.250 6.2.13 - DTE-DCE local rate reporting */
4071 /* TODO: */
4072 t += 5;
4073 return t;
4074 }
4075 /*- End of function --------------------------------------------------------*/
4076
4077 static const char *at_cmd_plus_ILSD(at_state_t *s, const char *t)
4078 {
4079 /* V.250 6.2.15 - Select long space disconnect option */
4080 t += 5;
4081 if (!parse_out(s, &t, &s->long_space_disconnect_option, 2, "+ILSD:", "(0,1)"))
4082 return NULL;
4083 return t;
4084 }
4085 /*- End of function --------------------------------------------------------*/
4086
4087 static const char *at_cmd_plus_IPR(at_state_t *s, const char *t)
4088 {
4089 /* V.250 6.2.10 - Fixed DTE rate */
4090 /* TODO: */
4091 t += 4;
4092 if (!parse_out(s, &t, &s->dte_rate, 115200, "+IPR:", "(115200),(115200)"))
4093 return NULL;
4094 return t;
4095 }
4096 /*- End of function --------------------------------------------------------*/
4097
4098 static const char *at_cmd_plus_IRTS(at_state_t *s, const char *t)
4099 {
4100 /* V.250 6.2.17 - Select synchronous mode RTS option */
4101 t += 5;
4102 if (!parse_out(s, &t, NULL, 1, "+IRTS:", "(0,1)"))
4103 return NULL;
4104 return t;
4105 }
4106 /*- End of function --------------------------------------------------------*/
4107
4108 static const char *at_cmd_plus_ITF(at_state_t *s, const char *t)
4109 {
4110 /* V.80 8.4 - Transmit flow control thresholds */
4111 /* TODO: */
4112 t += 5;
4113 return t;
4114 }
4115 /*- End of function --------------------------------------------------------*/
4116
4117 static const char *at_cmd_plus_MA(at_state_t *s, const char *t)
4118 {
4119 /* V.250 6.4.2 - Modulation automode control */
4120 /* TODO: */
4121 t += 3;
4122 return t;
4123 }
4124 /*- End of function --------------------------------------------------------*/
4125
4126 static const char *at_cmd_plus_MR(at_state_t *s, const char *t)
4127 {
4128 /* V.250 6.4.3 - Modulation reporting control */
4129 /* 0 Disables reporting of modulation connection (+MCR: and +MRR: are not transmitted)
4130 1 Enables reporting of modulation connection (+MCR: and +MRR: are transmitted) */
4131 /* TODO: */
4132 t += 3;
4133 if (!parse_out(s, &t, NULL, 1, "+MR:", "(0,1)"))
4134 return NULL;
4135 return t;
4136 }
4137 /*- End of function --------------------------------------------------------*/
4138
4139 static const char *at_cmd_plus_MS(at_state_t *s, const char *t)
4140 {
4141 /* V.250 6.4.1 - Modulation selection */
4142 /* TODO: */
4143 t += 3;
4144 return t;
4145 }
4146 /*- End of function --------------------------------------------------------*/
4147
4148 static const char *at_cmd_plus_MSC(at_state_t *s, const char *t)
4149 {
4150 /* V.250 6.4.8 - Seamless rate change enable */
4151 /* 0 Disables V.34 seamless rate change
4152 1 Enables V.34 seamless rate change */
4153 /* TODO: */
4154 t += 4;
4155 if (!parse_out(s, &t, NULL, 1, "+MSC:", "(0,1)"))
4156 return NULL;
4157 return t;
4158 }
4159 /*- End of function --------------------------------------------------------*/
4160
4161 static const char *at_cmd_plus_MV18AM(at_state_t *s, const char *t)
4162 {
4163 /* V.250 6.4.6 - V.18 answering message editing */
4164 /* TODO: */
4165 t += 7;
4166 return t;
4167 }
4168 /*- End of function --------------------------------------------------------*/
4169
4170 static const char *at_cmd_plus_MV18P(at_state_t *s, const char *t)
4171 {
4172 /* V.250 6.4.7 - Order of probes */
4173 /* 2 Send probe message in 5-bit (Baudot) mode
4174 3 Send probe message in DTMF mode
4175 4 Send probe message in EDT mode
4176 5 Send Rec. V.21 carrier as a probe
4177 6 Send Rec. V.23 carrier as a probe
4178 7 Send Bell 103 carrier as a probe */
4179 /* TODO: */
4180 t += 6;
4181 if (!parse_out(s, &t, NULL, 7, "+MV18P:", "(2-7)"))
4182 return NULL;
4183 return t;
4184 }
4185 /*- End of function --------------------------------------------------------*/
4186
4187 static const char *at_cmd_plus_MV18R(at_state_t *s, const char *t)
4188 {
4189 /* V.250 6.4.5 - V.18 reporting control */
4190 /* TODO: */
4191 t += 6;
4192 if (!parse_out(s, &t, NULL, 1, "+MV18R:", "(0,1)"))
4193 return NULL;
4194 return t;
4195 }
4196 /*- End of function --------------------------------------------------------*/
4197
4198 static const char *at_cmd_plus_MV18S(at_state_t *s, const char *t)
4199 {
4200 /* V.250 6.4.4 - V.18 selection */
4201 /* mode:
4202 0 Disables V.18 operation
4203 1 V.18 operation, auto detect mode
4204 2 V.18 operation, connect in 5-bit (Baudot) mode
4205 3 V.18 operation, connect in DTMF mode
4206 4 V.18 operation, connect in EDT mode
4207 5 V.18 operation, connect in V.21 mode
4208 6 V.18 operation, connect in V.23 mode
4209 7 V.18 operation, connect in Bell 103-type mode
4210
4211 dflt_ans_mode:
4212 0 Disables V.18 answer operation
4213 1 No default specified (auto detect)
4214 2 V.18 operation connect in 5-bit (Baudot) mode
4215 3 V.18 operation connect in DTMF mode
4216 4 V.18 operation connect in EDT mode
4217
4218 fbk_time_enable:
4219 0 Disable
4220 1 Enable
4221
4222 ans_msg_enable
4223 0 Disable
4224 1 Enable
4225
4226 probing_en
4227 0 Disable probing
4228 1 Enable probing
4229 2 Initiate probing */
4230 /* TODO: */
4231 t += 6;
4232 return t;
4233 }
4234 /*- End of function --------------------------------------------------------*/
4235
4236 static const char *at_cmd_plus_PCW(at_state_t *s, const char *t)
4237 {
4238 /* V.250 6.8.1 - Call waiting enable (V.92 DCE) */
4239 /* TODO: */
4240 t += 4;
4241 return t;
4242 }
4243 /*- End of function --------------------------------------------------------*/
4244
4245 static const char *at_cmd_plus_PIG(at_state_t *s, const char *t)
4246 {
4247 /* V.250 6.8.5 - PCM upstream ignore */
4248 /* TODO: */
4249 t += 4;
4250 return t;
4251 }
4252 /*- End of function --------------------------------------------------------*/
4253
4254 static const char *at_cmd_plus_PMH(at_state_t *s, const char *t)
4255 {
4256 /* V.250 6.8.2 - Modem on hold enable */
4257 /* TODO: */
4258 t += 4;
4259 return t;
4260 }
4261 /*- End of function --------------------------------------------------------*/
4262
4263 static const char *at_cmd_plus_PMHF(at_state_t *s, const char *t)
4264 {
4265 /* V.250 6.8.6 - V.92 Modem on hold hook flash */
4266 /* TODO: */
4267 t += 5;
4268 return t;
4269 }
4270 /*- End of function --------------------------------------------------------*/
4271
4272 static const char *at_cmd_plus_PMHR(at_state_t *s, const char *t)
4273 {
4274 /* V.250 6.8.4 - Initiate modem on hold */
4275 /* TODO: */
4276 t += 5;
4277 return t;
4278 }
4279 /*- End of function --------------------------------------------------------*/
4280
4281 static const char *at_cmd_plus_PMHT(at_state_t *s, const char *t)
4282 {
4283 /* V.250 6.8.3 - Modem on hold timer */
4284 /* TODO: */
4285 t += 5;
4286 return t;
4287 }
4288 /*- End of function --------------------------------------------------------*/
4289
4290 static const char *at_cmd_plus_PQC(at_state_t *s, const char *t)
4291 {
4292 /* V.250 6.8.7 - V.92 Phase 1 and Phase 2 Control */
4293 /* TODO: */
4294 t += 4;
4295 return t;
4296 }
4297 /*- End of function --------------------------------------------------------*/
4298
4299 static const char *at_cmd_plus_PSS(at_state_t *s, const char *t)
4300 {
4301 /* V.250 6.8.8 - V.92 Use Short Sequence */
4302 /* TODO: */
4303 t += 4;
4304 return t;
4305 }
4306 /*- End of function --------------------------------------------------------*/
4307
4308 static const char *at_cmd_plus_SAC(at_state_t *s, const char *t)
4309 {
4310 /* V.252 3.4 - Audio transmit configuration */
4311 /* TODO: */
4312 t += 4;
4313 return t;
4314 }
4315 /*- End of function --------------------------------------------------------*/
4316
4317 static const char *at_cmd_plus_SAM(at_state_t *s, const char *t)
4318 {
4319 /* V.252 3.5 - Audio receive mode */
4320 /* TODO: */
4321 t += 4;
4322 return t;
4323 }
4324 /*- End of function --------------------------------------------------------*/
4325
4326 static const char *at_cmd_plus_SAR(at_state_t *s, const char *t)
4327 {
4328 /* V.252 5.3 - Audio receive channel indication */
4329 /* TODO: */
4330 t += 4;
4331 return t;
4332 }
4333 /*- End of function --------------------------------------------------------*/
4334
4335 static const char *at_cmd_plus_SARR(at_state_t *s, const char *t)
4336 {
4337 /* V.252 3.9 - Audio indication reporting */
4338 /* TODO: */
4339 t += 5;
4340 return t;
4341 }
4342 /*- End of function --------------------------------------------------------*/
4343
4344 static const char *at_cmd_plus_SAT(at_state_t *s, const char *t)
4345 {
4346 /* V.252 5.4 - Audio transmit channel indication */
4347 /* TODO: */
4348 t += 4;
4349 return t;
4350 }
4351 /*- End of function --------------------------------------------------------*/
4352
4353 static const char *at_cmd_plus_SCRR(at_state_t *s, const char *t)
4354 {
4355 /* V.252 3.11 - Capabilities indication reporting */
4356 /* TODO: */
4357 t += 5;
4358 return t;
4359 }
4360 /*- End of function --------------------------------------------------------*/
4361
4362 static const char *at_cmd_plus_SDC(at_state_t *s, const char *t)
4363 {
4364 /* V.252 3.3 - Data configuration */
4365 /* TODO: */
4366 t += 4;
4367 return t;
4368 }
4369 /*- End of function --------------------------------------------------------*/
4370
4371 static const char *at_cmd_plus_SDI(at_state_t *s, const char *t)
4372 {
4373 /* V.252 5.2 - Data channel identification */
4374 /* TODO: */
4375 t += 4;
4376 return t;
4377 }
4378 /*- End of function --------------------------------------------------------*/
4379
4380 static const char *at_cmd_plus_SDR(at_state_t *s, const char *t)
4381 {
4382 /* V.252 3.8 - Data indication reporting */
4383 /* TODO: */
4384 t += 4;
4385 return t;
4386 }
4387 /*- End of function --------------------------------------------------------*/
4388
4389 static const char *at_cmd_plus_SRSC(at_state_t *s, const char *t)
4390 {
4391 /* V.252 5.1.2 - Remote terminal simultaneous capability indication */
4392 /* TODO: */
4393 t += 5;
4394 return t;
4395 }
4396 /*- End of function --------------------------------------------------------*/
4397
4398 static const char *at_cmd_plus_STC(at_state_t *s, const char *t)
4399 {
4400 /* V.252 3.1 - Terminal configuration */
4401 /* TODO: */
4402 t += 4;
4403 return t;
4404 }
4405 /*- End of function --------------------------------------------------------*/
4406
4407 static const char *at_cmd_plus_STH(at_state_t *s, const char *t)
4408 {
4409 /* V.252 3.2 - Close logical channel */
4410 /* TODO: */
4411 t += 4;
4412 return t;
4413 }
4414 /*- End of function --------------------------------------------------------*/
4415
4416 static const char *at_cmd_plus_SVC(at_state_t *s, const char *t)
4417 {
4418 /* V.252 3.6 - Video transmit configuration */
4419 /* TODO: */
4420 t += 4;
4421 return t;
4422 }
4423 /*- End of function --------------------------------------------------------*/
4424
4425 static const char *at_cmd_plus_SVM(at_state_t *s, const char *t)
4426 {
4427 /* V.252 3.7 - Video receive mode */
4428 /* TODO: */
4429 t += 4;
4430 return t;
4431 }
4432 /*- End of function --------------------------------------------------------*/
4433
4434 static const char *at_cmd_plus_SVR(at_state_t *s, const char *t)
4435 {
4436 /* V.252 5.5 - Video receive channel indication */
4437 /* TODO: */
4438 t += 4;
4439 return t;
4440 }
4441 /*- End of function --------------------------------------------------------*/
4442
4443 static const char *at_cmd_plus_SVRR(at_state_t *s, const char *t)
4444 {
4445 /* V.252 3.10 - Video indication reporting */
4446 /* TODO: */
4447 t += 5;
4448 return t;
4449 }
4450 /*- End of function --------------------------------------------------------*/
4451
4452 static const char *at_cmd_plus_SVT(at_state_t *s, const char *t)
4453 {
4454 /* V.252 5.6 - Video transmit channel indication */
4455 /* TODO: */
4456 t += 4;
4457 return t;
4458 }
4459 /*- End of function --------------------------------------------------------*/
4460
4461 static const char *at_cmd_plus_TADR(at_state_t *s, const char *t)
4462 {
4463 /* V.250 6.7.2.9 - Local V.54 address */
4464 /* TODO: */
4465 t += 5;
4466 return t;
4467 }
4468 /*- End of function --------------------------------------------------------*/
4469
4470 static const char *at_cmd_plus_TAL(at_state_t *s, const char *t)
4471 {
4472 /* V.250 6.7.2.15 - Local analogue loop */
4473 /* Action
4474 0 Disable analogue loop
4475 1 Enable analogue loop
4476 Band
4477 0 Low frequency band
4478 1 High frequency band */
4479 /* TODO: */
4480 t += 4;
4481 if (!parse_2_out(s, &t, NULL, 1, NULL, 1, "+TAL:", "(0,1),(0,1)"))
4482 return NULL;
4483 return t;
4484 }
4485 /*- End of function --------------------------------------------------------*/
4486
4487 static const char *at_cmd_plus_TALS(at_state_t *s, const char *t)
4488 {
4489 /* V.250 6.7.2.6 - Analogue loop status */
4490 /* 0 Inactive
4491 1 V.24 circuit 141 invoked
4492 2 Front panel invoked
4493 3 Network management system invoked */
4494 /* TODO: */
4495 t += 5;
4496 if (!parse_out(s, &t, NULL, 3, "+TALS:", "(0-3)"))
4497 return NULL;
4498 return t;
4499 }
4500 /*- End of function --------------------------------------------------------*/
4501
4502 static const char *at_cmd_plus_TDLS(at_state_t *s, const char *t)
4503 {
4504 /* V.250 6.7.2.7 - Local digital loop status */
4505 /* 0 Disabled
4506 1 Enabled, inactive
4507 2 Front panel invoked
4508 3 Network management system invoked
4509 4 Remote invoked */
4510 /* TODO: */
4511 t += 5;
4512 if (!parse_out(s, &t, NULL, 3, "+TDLS:", "(0-4)"))
4513 return NULL;
4514 return t;
4515 }
4516 /*- End of function --------------------------------------------------------*/
4517
4518 static const char *at_cmd_plus_TE140(at_state_t *s, const char *t)
4519 {
4520 /* V.250 6.7.2.1 - Enable ckt 140 */
4521 /* 0 Disabled
4522 1 Enabled */
4523 /* TODO: */
4524 t += 6;
4525 if (!parse_out(s, &t, NULL, 1, "+TE140:", "(0,1)"))
4526 return NULL;
4527 return t;
4528 }
4529 /*- End of function --------------------------------------------------------*/
4530
4531 static const char *at_cmd_plus_TE141(at_state_t *s, const char *t)
4532 {
4533 /* V.250 6.7.2.2 - Enable ckt 141 */
4534 /* 0 Response is disabled
4535 1 Response is enabled */
4536 /* TODO: */
4537 t += 6;
4538 if (!parse_out(s, &t, NULL, 1, "+TE141:", "(0,1)"))
4539 return NULL;
4540 return t;
4541 }
4542 /*- End of function --------------------------------------------------------*/
4543
4544 static const char *at_cmd_plus_TEPAL(at_state_t *s, const char *t)
4545 {
4546 /* V.250 6.7.2.5 - Enable front panel analogue loop */
4547 /* 0 Disabled
4548 1 Enabled */
4549 /* TODO: */
4550 t += 6;
4551 if (!parse_out(s, &t, NULL, 1, "+TEPAL:", "(0,1)"))
4552 return NULL;
4553 return t;
4554 }
4555 /*- End of function --------------------------------------------------------*/
4556
4557 static const char *at_cmd_plus_TEPDL(at_state_t *s, const char *t)
4558 {
4559 /* V.250 6.7.2.4 - Enable front panel RDL */
4560 /* 0 Disabled
4561 1 Enabled */
4562 /* TODO: */
4563 t += 6;
4564 if (!parse_out(s, &t, NULL, 1, "+TEPDL:", "(0,1)"))
4565 return NULL;
4566 return t;
4567 }
4568 /*- End of function --------------------------------------------------------*/
4569
4570 static const char *at_cmd_plus_TERDL(at_state_t *s, const char *t)
4571 {
4572 /* V.250 6.7.2.3 - Enable RDL from remote */
4573 /* 0 Local DCE will ignore command from remote
4574 1 Local DCE will obey command from remote */
4575 /* TODO: */
4576 t += 6;
4577 if (!parse_out(s, &t, NULL, 1, "+TERDL:", "(0,1)"))
4578 return NULL;
4579 return t;
4580 }
4581 /*- End of function --------------------------------------------------------*/
4582
4583 static const char *at_cmd_plus_TLDL(at_state_t *s, const char *t)
4584 {
4585 /* V.250 6.7.2.13 - Local digital loop */
4586 /* 0 Stop test
4587 1 Start test */
4588 /* TODO: */
4589 t += 5;
4590 if (!parse_out(s, &t, NULL, 1, "+TLDL:", "(0,1)"))
4591 return NULL;
4592 return t;
4593 }
4594 /*- End of function --------------------------------------------------------*/
4595
4596 static const char *at_cmd_plus_TMO(at_state_t *s, const char *t)
4597 {
4598 /* V.250 6.9 - V.59 command */
4599 /* TODO: */
4600 t += 4;
4601 return t;
4602 }
4603 /*- End of function --------------------------------------------------------*/
4604
4605 static const char *at_cmd_plus_TMODE(at_state_t *s, const char *t)
4606 {
4607 /* V.250 6.7.2.10 - Set V.54 mode */
4608 /* TODO: */
4609 t += 6;
4610 if (!parse_out(s, &t, NULL, 1, "+TMODE:", "(0,1)"))
4611 return NULL;
4612 return t;
4613 }
4614 /*- End of function --------------------------------------------------------*/
4615
4616 static const char *at_cmd_plus_TNUM(at_state_t *s, const char *t)
4617 {
4618 /* V.250 6.7.2.12 - Errored bit and block counts */
4619 /* TODO: */
4620 t += 5;
4621 return t;
4622 }
4623 /*- End of function --------------------------------------------------------*/
4624
4625 static const char *at_cmd_plus_TRDL(at_state_t *s, const char *t)
4626 {
4627 /* V.250 6.7.2.14 - Request remote digital loop */
4628 /* 0 Stop RDL
4629 1 Start RDL */
4630 /* TODO: */
4631 t += 5;
4632 if (!parse_out(s, &t, NULL, 1, "+TRDL:", "(0,1)"))
4633 return NULL;
4634 return t;
4635 }
4636 /*- End of function --------------------------------------------------------*/
4637
4638 static const char *at_cmd_plus_TRDLS(at_state_t *s, const char *t)
4639 {
4640 /* V.250 6.7.2.8 - Remote digital loop status */
4641 /* TODO: */
4642 t += 6;
4643 return t;
4644 }
4645 /*- End of function --------------------------------------------------------*/
4646
4647 static const char *at_cmd_plus_TRES(at_state_t *s, const char *t)
4648 {
4649 /* V.250 6.7.2.17 - Self test result */
4650 /* 0 No test
4651 1 Pass
4652 2 Fail */
4653 /* TODO: */
4654 t += 5;
4655 if (!parse_out(s, &t, NULL, 1, "+TRES:", "(0-2)"))
4656 return NULL;
4657 return t;
4658 }
4659 /*- End of function --------------------------------------------------------*/
4660
4661 static const char *at_cmd_plus_TSELF(at_state_t *s, const char *t)
4662 {
4663 /* V.250 6.7.2.16 - Self test */
4664 /* 0 Intrusive full test
4665 1 Safe partial test */
4666 /* TODO: */
4667 t += 6;
4668 if (!parse_out(s, &t, NULL, 1, "+TSELF:", "(0,1)"))
4669 return NULL;
4670 return t;
4671 }
4672 /*- End of function --------------------------------------------------------*/
4673
4674 static const char *at_cmd_plus_TTER(at_state_t *s, const char *t)
4675 {
4676 /* V.250 6.7.2.11 - Test error rate */
4677 /* TODO: */
4678 t += 5;
4679 if (!parse_2_out(s, &t, NULL, 65535, NULL, 65535, "+TTER:", "(0-65535),(0-65535)"))
4680 return NULL;
4681 return t;
4682 }
4683 /*- End of function --------------------------------------------------------*/
4684
4685 static const char *at_cmd_plus_VAC(at_state_t *s, const char *t)
4686 {
4687 /* V.252 4.1 - Set audio code */
4688 return t;
4689 }
4690 /*- End of function --------------------------------------------------------*/
4691
4692 static const char *at_cmd_plus_VACR(at_state_t *s, const char *t)
4693 {
4694 /* V.252 6.1 - Audio code report */
4695 /* TODO: */
4696 t += 5;
4697 return t;
4698 }
4699 /*- End of function --------------------------------------------------------*/
4700
4701 static const char *at_cmd_plus_VBT(at_state_t *s, const char *t)
4702 {
4703 /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */
4704 /* TODO: */
4705 t += 4;
4706 return t;
4707 }
4708 /*- End of function --------------------------------------------------------*/
4709
4710 static const char *at_cmd_plus_VCID(at_state_t *s, const char *t)
4711 {
4712 /* 3GPP TS 27.007 C.2.3 - Calling number ID presentation */
4713 /* TODO: */
4714 t += 5;
4715 if (!parse_out(s, &t, &s->display_call_info, 1, NULL, "0,1"))
4716 return NULL;
4717 return t;
4718 }
4719 /*- End of function --------------------------------------------------------*/
4720
4721 static const char *at_cmd_plus_VCIDR(at_state_t *s, const char *t)
4722 {
4723 /* V.252 6.2 - Caller ID report */
4724 /* TODO: */
4725 t += 6;
4726 return t;
4727 }
4728 /*- End of function --------------------------------------------------------*/
4729
4730 static const char *at_cmd_plus_VDID(at_state_t *s, const char *t)
4731 {
4732 /* V.253 9.2.4 - DID service */
4733 /* TODO: */
4734 t += 5;
4735 return t;
4736 }
4737 /*- End of function --------------------------------------------------------*/
4738
4739 static const char *at_cmd_plus_VDIDR(at_state_t *s, const char *t)
4740 {
4741 /* V.252 6.2 - DID report */
4742 /* TODO: */
4743 t += 6;
4744 return t;
4745 }
4746 /*- End of function --------------------------------------------------------*/
4747
4748 static const char *at_cmd_plus_VDR(at_state_t *s, const char *t)
4749 {
4750 /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */
4751 /* TODO: */
4752 t += 4;
4753 return t;
4754 }
4755 /*- End of function --------------------------------------------------------*/
4756
4757 static const char *at_cmd_plus_VDT(at_state_t *s, const char *t)
4758 {
4759 /* V.253 10.3.2 - Control tone cadence reporting */
4760 /* TODO: */
4761 t += 4;
4762 return t;
4763 }
4764 /*- End of function --------------------------------------------------------*/
4765
4766 static const char *at_cmd_plus_VDX(at_state_t *s, const char *t)
4767 {
4768 /* V.253 10.5.6 - Speakerphone duplex mode */
4769 /* TODO: */
4770 t += 4;
4771 return t;
4772 }
4773 /*- End of function --------------------------------------------------------*/
4774
4775 static const char *at_cmd_plus_VEM(at_state_t *s, const char *t)
4776 {
4777 /* V.253 10.5.7 - Deliver event reports */
4778 /* TODO: */
4779 t += 4;
4780 return t;
4781 }
4782 /*- End of function --------------------------------------------------------*/
4783
4784 static const char *at_cmd_plus_VGM(at_state_t *s, const char *t)
4785 {
4786 /* V.253 10.5.2 - Microphone gain */
4787 /* TODO: */
4788 t += 4;
4789 return t;
4790 }
4791 /*- End of function --------------------------------------------------------*/
4792
4793 static const char *at_cmd_plus_VGR(at_state_t *s, const char *t)
4794 {
4795 /* V.253 10.2.1 - Receive gain selection */
4796 /* TODO: */
4797 t += 4;
4798 return t;
4799 }
4800 /*- End of function --------------------------------------------------------*/
4801
4802 static const char *at_cmd_plus_VGS(at_state_t *s, const char *t)
4803 {
4804 /* V.253 10.5.3 - Speaker gain */
4805 /* TODO: */
4806 t += 4;
4807 return t;
4808 }
4809 /*- End of function --------------------------------------------------------*/
4810
4811 static const char *at_cmd_plus_VGT(at_state_t *s, const char *t)
4812 {
4813 /* V.253 10.2.2 - Volume selection */
4814 /* TODO: */
4815 t += 4;
4816 return t;
4817 }
4818 /*- End of function --------------------------------------------------------*/
4819
4820 static const char *at_cmd_plus_VHC(at_state_t *s, const char *t)
4821 {
4822 /* V.252 4.12 - Telephony port hook control */
4823 /* TODO: */
4824 t += 4;
4825 return t;
4826 }
4827 /*- End of function --------------------------------------------------------*/
4828
4829 static const char *at_cmd_plus_VIP(at_state_t *s, const char *t)
4830 {
4831 /* V.253 10.1.1 - Initialize voice parameters */
4832 /* TODO: */
4833 t += 4;
4834 return t;
4835 }
4836 /*- End of function --------------------------------------------------------*/
4837
4838 static const char *at_cmd_plus_VIT(at_state_t *s, const char *t)
4839 {
4840 /* V.253 10.2.3 - DTE/DCE inactivity timer */
4841 /* TODO: */
4842 t += 4;
4843 return t;
4844 }
4845 /*- End of function --------------------------------------------------------*/
4846
4847 static const char *at_cmd_plus_VLS(at_state_t *s, const char *t)
4848 {
4849 /* V.253 10.2.4 - Analogue source/destination selection */
4850 /* TODO: */
4851 t += 4;
4852 return t;
4853 }
4854 /*- End of function --------------------------------------------------------*/
4855
4856 static const char *at_cmd_plus_VNH(at_state_t *s, const char *t)
4857 {
4858 /* V.253 9.2.5 - Automatic hangup control */
4859 /* TODO: */
4860 t += 4;
4861 return t;
4862 }
4863 /*- End of function --------------------------------------------------------*/
4864
4865 static const char *at_cmd_plus_VPH(at_state_t *s, const char *t)
4866 {
4867 /* V.252 4.11 - Phone hookswitch status */
4868 /* TODO: */
4869 t += 4;
4870 return t;
4871 }
4872 /*- End of function --------------------------------------------------------*/
4873
4874 static const char *at_cmd_plus_VPP(at_state_t *s, const char *t)
4875 {
4876 /* V.253 10.4.2 - Voice packet protocol */
4877 /* TODO: */
4878 t += 4;
4879 return t;
4880 }
4881 /*- End of function --------------------------------------------------------*/
4882
4883 static const char *at_cmd_plus_VPR(at_state_t *s, const char *t)
4884 {
4885 /* IS-101 10.4.3 - Select DTE/DCE interface rate */
4886 /* TODO: */
4887 t += 4;
4888 return t;
4889 }
4890 /*- End of function --------------------------------------------------------*/
4891
4892 static const char *at_cmd_plus_VRA(at_state_t *s, const char *t)
4893 {
4894 /* V.253 10.2.5 - Ringing tone goes away timer */
4895 /* TODO: */
4896 t += 4;
4897 return t;
4898 }
4899 /*- End of function --------------------------------------------------------*/
4900
4901 static const char *at_cmd_plus_VRID(at_state_t *s, const char *t)
4902 {
4903 int val;
4904
4905 /* Extension of V.253 +VCID, Calling number ID report/repeat */
4906 t += 5;
4907 val = 0;
4908 if (!parse_out(s, &t, &val, 1, NULL, "0,1"))
4909 return NULL;
4910 if (val == 1)
4911 at_display_call_info(s);
4912 return t;
4913 }
4914 /*- End of function --------------------------------------------------------*/
4915
4916 static const char *at_cmd_plus_VRL(at_state_t *s, const char *t)
4917 {
4918 /* V.253 10.1.2 - Ring local phone */
4919 /* TODO: */
4920 t += 4;
4921 return t;
4922 }
4923 /*- End of function --------------------------------------------------------*/
4924
4925 static const char *at_cmd_plus_VRN(at_state_t *s, const char *t)
4926 {
4927 /* V.253 10.2.6 - Ringing tone never appeared timer */
4928 /* TODO: */
4929 t += 4;
4930 return t;
4931 }
4932 /*- End of function --------------------------------------------------------*/
4933
4934 static const char *at_cmd_plus_VRX(at_state_t *s, const char *t)
4935 {
4936 /* V.253 10.1.3 - Voice receive state */
4937 /* TODO: */
4938 t += 4;
4939 return t;
4940 }
4941 /*- End of function --------------------------------------------------------*/
4942
4943 static const char *at_cmd_plus_VSD(at_state_t *s, const char *t)
4944 {
4945 /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */
4946 /* TODO: */
4947 t += 4;
4948 return t;
4949 }
4950 /*- End of function --------------------------------------------------------*/
4951
4952 static const char *at_cmd_plus_VSID(at_state_t *s, const char *t)
4953 {
4954 /* Extension of V.253 +VCID, Set calling number ID */
4955 t += 5;
4956 if (!parse_string_out(s, &t, &s->local_id, NULL))
4957 return NULL;
4958 if (at_modem_control(s, AT_MODEM_CONTROL_SETID, s->local_id) < 0)
4959 return NULL;
4960 return t;
4961 }
4962 /*- End of function --------------------------------------------------------*/
4963
4964 static const char *at_cmd_plus_VSM(at_state_t *s, const char *t)
4965 {
4966 /* V.253 10.2.8 - Compression method selection */
4967 /* TODO: */
4968 t += 4;
4969 return t;
4970 }
4971 /*- End of function --------------------------------------------------------*/
4972
4973 static const char *at_cmd_plus_VSP(at_state_t *s, const char *t)
4974 {
4975 /* V.253 10.5.1 - Voice speakerphone state */
4976 /* TODO: */
4977 t += 4;
4978 return t;
4979 }
4980 /*- End of function --------------------------------------------------------*/
4981
4982 static const char *at_cmd_plus_VTA(at_state_t *s, const char *t)
4983 {
4984 /* V.253 10.5.4 - Train acoustic echo-canceller */
4985 /* TODO: */
4986 t += 4;
4987 return t;
4988 }
4989 /*- End of function --------------------------------------------------------*/
4990
4991 static const char *at_cmd_plus_VTD(at_state_t *s, const char *t)
4992 {
4993 /* V.253 10.2.9 - Beep tone duration timer */
4994 /* TODO: */
4995 t += 4;
4996 return t;
4997 }
4998 /*- End of function --------------------------------------------------------*/
4999
5000 static const char *at_cmd_plus_VTER(at_state_t *s, const char *t)
5001 {
5002 /* V.252 6.4 - Simple telephony event report */
5003 /* TODO: */
5004 t += 4;
5005 return t;
5006 }
5007 /*- End of function --------------------------------------------------------*/
5008
5009 static const char *at_cmd_plus_VTH(at_state_t *s, const char *t)
5010 {
5011 /* V.253 10.5.5 - Train line echo-canceller */
5012 /* TODO: */
5013 t += 4;
5014 return t;
5015 }
5016 /*- End of function --------------------------------------------------------*/
5017
5018 static const char *at_cmd_plus_VTR(at_state_t *s, const char *t)
5019 {
5020 /* V.253 10.1.4 - Voice duplex state */
5021 /* TODO: */
5022 t += 4;
5023 return t;
5024 }
5025 /*- End of function --------------------------------------------------------*/
5026
5027 static const char *at_cmd_plus_VTS(at_state_t *s, const char *t)
5028 {
5029 /* V.253 10.1.5 - DTMF and tone generation in voice */
5030 /* TODO: */
5031 t += 4;
5032 return t;
5033 }
5034 /*- End of function --------------------------------------------------------*/
5035
5036 static const char *at_cmd_plus_VTX(at_state_t *s, const char *t)
5037 {
5038 /* V.253 10.1.6 - Transmit data state */
5039 /* TODO: */
5040 t += 4;
5041 return t;
5042 }
5043 /*- End of function --------------------------------------------------------*/
5044
5045 static const char *at_cmd_plus_VXT(at_state_t *s, const char *t)
5046 {
5047 /* IS-101 10.1.5 - Translate voice data */
5048 /* TODO: */
5049 t += 4;
5050 return t;
5051 }
5052 /*- End of function --------------------------------------------------------*/
5053
5054 static const char *at_cmd_plus_W(at_state_t *s, const char *t)
5055 {
5056 /* TIA-678 5.2.4.1 - Compliance indication */
5057 /* TODO: */
5058 t += 2;
5059 return t;
5060 }
5061 /*- End of function --------------------------------------------------------*/
5062
5063 static const char *at_cmd_plus_WBAG(at_state_t *s, const char *t)
5064 {
5065 /* TIA-678 C.5.6 Bias Modem Audio Gain */
5066 /* TODO: */
5067 t += 5;
5068 return t;
5069 }
5070 /*- End of function --------------------------------------------------------*/
5071
5072 static const char *at_cmd_plus_WCDA(at_state_t *s, const char *t)
5073 {
5074 /* TIA-678 B.3.2.5 Display Data Link Address */
5075 /* TODO: */
5076 t += 5;
5077 return t;
5078 }
5079 /*- End of function --------------------------------------------------------*/
5080
5081 static const char *at_cmd_plus_WCHG(at_state_t *s, const char *t)
5082 {
5083 /* TIA-678 B.3.2.4 Display Battery Charging Status */
5084 /* TODO: */
5085 t += 5;
5086 return t;
5087 }
5088 /*- End of function --------------------------------------------------------*/
5089
5090 static const char *at_cmd_plus_WCID(at_state_t *s, const char *t)
5091 {
5092 /* TIA-678 B.3.2.1 Display System ID (operator) */
5093 /* TODO: */
5094 t += 5;
5095 return t;
5096 }
5097 /*- End of function --------------------------------------------------------*/
5098
5099 static const char *at_cmd_plus_WCLK(at_state_t *s, const char *t)
5100 {
5101 /* TIA-678 B.3.2.3 Lock/Unlock DCE */
5102 /* TODO: */
5103 t += 5;
5104 return t;
5105 }
5106 /*- End of function --------------------------------------------------------*/
5107
5108 static const char *at_cmd_plus_WCPN(at_state_t *s, const char *t)
5109 {
5110 /* TIA-678 B.3.2.2 Set Personal Identification Number */
5111 /* TODO: */
5112 t += 5;
5113 return t;
5114 }
5115 /*- End of function --------------------------------------------------------*/
5116
5117 static const char *at_cmd_plus_WCXF(at_state_t *s, const char *t)
5118 {
5119 /* TIA-678 B.3.2.6 Display Supported Annex B commands */
5120 /* TODO: */
5121 t += 5;
5122 return t;
5123 }
5124 /*- End of function --------------------------------------------------------*/
5125
5126 static const char *at_cmd_plus_WDAC(at_state_t *s, const char *t)
5127 {
5128 /* TIA-678 C.5.1 Data over Analogue Cellular Command Query */
5129 /* TODO: */
5130 t += 5;
5131 return t;
5132 }
5133 /*- End of function --------------------------------------------------------*/
5134
5135 static const char *at_cmd_plus_WDIR(at_state_t *s, const char *t)
5136 {
5137 /* TIA-678 C.5.8 Phone Number Directory Selection */
5138 /* TODO: */
5139 t += 5;
5140 return t;
5141 }
5142 /*- End of function --------------------------------------------------------*/
5143
5144 static const char *at_cmd_plus_WECR(at_state_t *s, const char *t)
5145 {
5146 /* TIA-678 C.5.3 Enable Cellular Result Codes */
5147 /* TODO: */
5148 t += 5;
5149 return t;
5150 }
5151 /*- End of function --------------------------------------------------------*/
5152
5153 static const char *at_cmd_plus_WFON(at_state_t *s, const char *t)
5154 {
5155 /* TIA-678 C.5.5 Phone Specification */
5156 /* TODO: */
5157 t += 5;
5158 return t;
5159 }
5160 /*- End of function --------------------------------------------------------*/
5161
5162 static const char *at_cmd_plus_WKPD(at_state_t *s, const char *t)
5163 {
5164 /* TIA-678 C.5.7 Keypad Emulation */
5165 /* TODO: */
5166 t += 5;
5167 return t;
5168 }
5169 /*- End of function --------------------------------------------------------*/
5170
5171 static const char *at_cmd_plus_WPBA(at_state_t *s, const char *t)
5172 {
5173 /* TIA-678 C.5.9 Phone Battery Query */
5174 /* TODO: */
5175 t += 5;
5176 return t;
5177 }
5178 /*- End of function --------------------------------------------------------*/
5179
5180 static const char *at_cmd_plus_WPTH(at_state_t *s, const char *t)
5181 {
5182 /* TIA-678 C.5.10 Call Path */
5183 /* TODO: */
5184 t += 5;
5185 return t;
5186 }
5187 /*- End of function --------------------------------------------------------*/
5188
5189 static const char *at_cmd_plus_WRLK(at_state_t *s, const char *t)
5190 {
5191 /* TIA-678 C.5.4 Roam Lockout */
5192 /* TODO: */
5193 t += 5;
5194 return t;
5195 }
5196 /*- End of function --------------------------------------------------------*/
5197
5198 static const char *at_cmd_plus_WS45(at_state_t *s, const char *t)
5199 {
5200 /* TIA-678 5.2.4.2 DTE-side stack selection */
5201 /* TODO: */
5202 t += 5;
5203 return t;
5204 }
5205 /*- End of function --------------------------------------------------------*/
5206
5207 static const char *at_cmd_plus_WS46(at_state_t *s, const char *t)
5208 {
5209 /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */
5210 /* TODO: */
5211 t += 5;
5212 return t;
5213 }
5214 /*- End of function --------------------------------------------------------*/
5215
5216 static const char *at_cmd_plus_WS50(at_state_t *s, const char *t)
5217 {
5218 /* TIA-678 B.3.1.1 Normalized Signal Strength */
5219 /* TODO: */
5220 t += 5;
5221 return t;
5222 }
5223 /*- End of function --------------------------------------------------------*/
5224
5225 static const char *at_cmd_plus_WS51(at_state_t *s, const char *t)
5226 {
5227 /* TIA-678 B.3.1.2 Carrier Detect Signal Threshold */
5228 /* TODO: */
5229 t += 5;
5230 return t;
5231 }
5232 /*- End of function --------------------------------------------------------*/
5233
5234 static const char *at_cmd_plus_WS52(at_state_t *s, const char *t)
5235 {
5236 /* TIA-678 B.3.1.3 Normalized Battery Level */
5237 /* TODO: */
5238 t += 5;
5239 return t;
5240 }
5241 /*- End of function --------------------------------------------------------*/
5242
5243 static const char *at_cmd_plus_WS53(at_state_t *s, const char *t)
5244 {
5245 /* TIA-678 B.3.1.4 Normalized Channel Quality */
5246 /* TODO: */
5247 t += 5;
5248 return t;
5249 }
5250 /*- End of function --------------------------------------------------------*/
5251
5252 static const char *at_cmd_plus_WS54(at_state_t *s, const char *t)
5253 {
5254 /* TIA-678 B.3.1.5 Carrier Detect Channel Quality Threshold */
5255 /* TODO: */
5256 t += 5;
5257 return t;
5258 }
5259 /*- End of function --------------------------------------------------------*/
5260
5261 static const char *at_cmd_plus_WS57(at_state_t *s, const char *t)
5262 {
5263 /* TIA-678 B.3.1.7 Antenna Preference */
5264 /* TODO: */
5265 t += 5;
5266 return t;
5267 }
5268 /*- End of function --------------------------------------------------------*/
5269
5270 static const char *at_cmd_plus_WS58(at_state_t *s, const char *t)
5271 {
5272 /* TIA-678 B.3.1.8 Idle Time-out Value */
5273 /* TODO: */
5274 t += 5;
5275 return t;
5276 }
5277 /*- End of function --------------------------------------------------------*/
5278
5279 static const char *at_cmd_plus_WSTL(at_state_t *s, const char *t)
5280 {
5281 /* TIA-678 C.5.2 Call Session Time Limit */
5282 /* TODO: */
5283 t += 5;
5284 return t;
5285 }
5286 /*- End of function --------------------------------------------------------*/
5287
5288 /*
5289 AT command group prefixes:
5290
5291 +A Call control (network addressing) issues, common, PSTN, ISDN, Rec. X.25, switched digital
5292 +C Digital cellular extensions
5293 +D Data compression, Rec. V.42bis
5294 +E Error control, Rec. V.42
5295 +F Facsimile, Rec. T.30, etc.
5296 +G Generic issues such as identity and capabilities
5297 +I DTE-DCE interface issues, Rec. V.24, etc.
5298 +M Modulation, Rec. V.32bis, etc.
5299 +S Switched or simultaneous data types
5300 +T Test issues
5301 +V Voice extensions
5302 +W Wireless extensions
5303 */
5304
5305 #include "at_interpreter_dictionary.h"
5306
5307 static int command_search(const char *u, int len, int *matched)
5308 {
5309 int i;
5310 int index;
5311 int first;
5312 int last;
5313 int entry;
5314 int ptr;
5315
5316 entry = 0;
5317 /* Loop over the length of the string to search the trie... */
5318 for (i = 0, ptr = 0; ptr < COMMAND_TRIE_LEN; i++)
5319 {
5320 /* The character in u we are processing... */
5321 /* V.250 5.4.1 says upper and lower case are equivalent in commands */
5322 index = (unsigned char) toupper(u[i]);
5323 /* Is there a child node for this character? */
5324 /* Note: First and last could have been packed into one uint16_t,
5325 but space is not that critical, so the other packing is good
5326 enough to make the table reasonable. */
5327 first = command_trie[ptr++];
5328 last = command_trie[ptr++];
5329 entry = command_trie[ptr++];
5330 if (index < first || index > last)
5331 break;
5332 if ((ptr = command_trie[ptr + index - first]) == 0)
5333 break;
5334 ptr--;
5335 }
5336 *matched = i;
5337 return entry;
5338 }
5339 /*- End of function --------------------------------------------------------*/
5340
5341 SPAN_DECLARE(int) at_modem_control(at_state_t *s, int op, const char *num)
5342 {
5343 switch (op)
5344 {
5345 case AT_MODEM_CONTROL_ANSWER:
5346 break;
5347 case AT_MODEM_CONTROL_CALL:
5348 break;
5349 case AT_MODEM_CONTROL_HANGUP:
5350 break;
5351 case AT_MODEM_CONTROL_OFFHOOK:
5352 break;
5353 case AT_MODEM_CONTROL_DTR:
5354 break;
5355 case AT_MODEM_CONTROL_RTS:
5356 break;
5357 case AT_MODEM_CONTROL_CTS:
5358 break;
5359 case AT_MODEM_CONTROL_CAR:
5360 break;
5361 case AT_MODEM_CONTROL_RNG:
5362 break;
5363 case AT_MODEM_CONTROL_DSR:
5364 break;
5365 case AT_MODEM_CONTROL_RESTART:
5366 break;
5367 default:
5368 break;
5369 }
5370 /*endswitch*/
5371 return s->modem_control_handler(s, s->modem_control_user_data, op, num);
5372 }
5373 /*- End of function --------------------------------------------------------*/
5374
5375 SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len)
5376 {
5377 int i;
5378 int c;
5379 int entry;
5380 int matched;
5381 const char *t;
5382
5383 if (s->p.echo)
5384 s->at_tx_handler(s, s->at_tx_user_data, (uint8_t *) cmd, len);
5385
5386 for (i = 0; i < len; i++)
5387 {
5388 /* The spec says the top bit should be ignored */
5389 c = *cmd++ & 0x7F;
5390 /* Handle incoming character */
5391 if (s->line_ptr < 2)
5392 {
5393 /* Look for the initial "at", "AT", "a/" or "A/", and ignore anything before it */
5394 /* V.250 5.2.1 only shows "at" and "AT" as command prefixes. "At" and "aT" are
5395 not specified, despite 5.4.1 saying upper and lower case are equivalent in
5396 commands. Let's be tolerant and accept them. */
5397 if (tolower(c) == 'a')
5398 {
5399 s->line_ptr = 0;
5400 s->line[s->line_ptr++] = (char) toupper(c);
5401 }
5402 else if (s->line_ptr == 1)
5403 {
5404 if (tolower(c) == 't')
5405 {
5406 /* We have an "AT" command */
5407 s->line[s->line_ptr++] = (char) toupper(c);
5408 }
5409 else if (c == '/')
5410 {
5411 /* We have an "A/" command */
5412 /* TODO: implement "A/" command repeat */
5413 s->line[s->line_ptr++] = (char) c;
5414 }
5415 else
5416 {
5417 s->line_ptr = 0;
5418 }
5419 }
5420 }
5421 else
5422 {
5423 /* We are beyond the initial AT */
5424 if (c >= 0x20 && c <= 0x7E)
5425 {
5426 /* Add a new char */
5427 if (s->line_ptr < (int) (sizeof(s->line) - 1))
5428 s->line[s->line_ptr++] = (char) toupper(c);
5429 }
5430 else if (c == s->p.s_regs[3])
5431 {
5432 /* End of command line. Do line validation */
5433 s->line[s->line_ptr] = '\0';
5434 if (s->line_ptr > 2)
5435 {
5436 /* The spec says the commands within a command line are executed in order, until
5437 an error is found, or the end of the command line is reached. */
5438 t = s->line + 2;
5439 while (t && *t)
5440 {
5441 if ((entry = command_search(t, 15, &matched)) <= 0)
5442 break;
5443 if ((t = at_commands[entry - 1](s, t)) == NULL)
5444 break;
5445 if (t == (const char *) -1)
5446 break;
5447 }
5448 if (t != (const char *) -1)
5449 {
5450 if (t == NULL)
5451 at_put_response_code(s, AT_RESPONSE_CODE_ERROR);
5452 else
5453 at_put_response_code(s, AT_RESPONSE_CODE_OK);
5454 }
5455 }
5456 else if (s->line_ptr == 2)
5457 {
5458 /* It's just an empty "AT" command, return OK. */
5459 at_put_response_code(s, AT_RESPONSE_CODE_OK);
5460 }
5461 s->line_ptr = 0;
5462 }
5463 else if (c == s->p.s_regs[5])
5464 {
5465 /* Command line editing character (backspace) */
5466 if (s->line_ptr > 0)
5467 s->line_ptr--;
5468 }
5469 else
5470 {
5471 /* The spec says control characters, other than those
5472 explicitly handled, should be ignored, and so this
5473 invalid character causes everything buffered
5474 before it to also be ignored. */
5475 s->line_ptr = 0;
5476 }
5477 }
5478 }
5479 }
5480 /*- End of function --------------------------------------------------------*/
5481
5482 SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t handler, void *user_data)
5483 {
5484 s->class1_handler = handler;
5485 s->class1_user_data = user_data;
5486 }
5487 /*- End of function --------------------------------------------------------*/
5488
5489 SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
5490 at_tx_handler_t *at_tx_handler,
5491 void *at_tx_user_data,
5492 at_modem_control_handler_t *modem_control_handler,
5493 void *modem_control_user_data)
5494 {
5495 if (s == NULL)
5496 {
5497 if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL)
5498 return NULL;
5499 }
5500 memset(s, '\0', sizeof(*s));
5501 span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
5502 span_log_set_protocol(&s->logging, "AT");
5503 s->modem_control_handler = modem_control_handler;
5504 s->modem_control_user_data = modem_control_user_data;
5505 s->at_tx_handler = at_tx_handler;
5506 s->at_tx_user_data = at_tx_user_data;
5507 s->call_id = NULL;
5508 s->local_id = NULL;
5509 s->display_call_info = 0;
5510 at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
5511 s->p = profiles[0];
5512 return s;
5513 }
5514 /*- End of function --------------------------------------------------------*/
5515
5516 SPAN_DECLARE(int) at_release(at_state_t *s)
5517 {
5518 at_reset_call_info(s);
5519 if (s->local_id)
5520 free(s->local_id);
5521 return 0;
5522 }
5523 /*- End of function --------------------------------------------------------*/
5524
5525 SPAN_DECLARE(int) at_free(at_state_t *s)
5526 {
5527 int ret;
5528
5529 ret = at_release(s);
5530 free(s);
5531 return ret;
5532 }
5533 /*- End of function --------------------------------------------------------*/
5534 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.