comparison spandsp-0.0.3/spandsp-0.0.3/src/at_interpreter.c @ 5:f762bf195c4b

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

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