at_interpreter_tests.c 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. /*
  2. * SpanDSP - a series of DSP components for telephony
  3. *
  4. * at_interpreter_tests.c - Tests for the AT interpreter.
  5. *
  6. * Written by Steve Underwood <steveu@coppice.org>
  7. *
  8. * Copyright (C) 2004, 2005, 2006 Steve Underwood
  9. *
  10. * All rights reserved.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2, as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. */
  25. /*! \file */
  26. /*! \page at_interpreter_tests_page AT interpreter tests
  27. \section at_interpreter_tests_page_sec_1 What does it do?
  28. These tests exercise all the commands which should be understood by the AT interpreter.
  29. */
  30. #if defined(HAVE_CONFIG_H)
  31. #include "config.h"
  32. #endif
  33. #include <stdlib.h>
  34. #include <stdio.h>
  35. #include <fcntl.h>
  36. #include <unistd.h>
  37. #include <string.h>
  38. #include <assert.h>
  39. #include <sndfile.h>
  40. #include "spandsp.h"
  41. #define DLE 0x10
  42. #define ETX 0x03
  43. #define SUB 0x1A
  44. #define MANUFACTURER "www.soft-switch.org"
  45. struct command_response_s
  46. {
  47. const char *command;
  48. const char *response;
  49. };
  50. static const struct command_response_s general_test_seq[] =
  51. {
  52. /* Try the various cases for "AT" */
  53. {"atE1\r", "atE1\r\r\nOK\r\n"},
  54. {"AtE1\r", "AtE1\r\r\nOK\r\n"},
  55. {"aTE1\r", "aTE1\r\r\nOK\r\n"},
  56. {"ATE1\r", "ATE1\r\r\nOK\r\n"},
  57. {"ATE0\r", "ATE0\r\r\nOK\r\n"},
  58. /* Try the various command formats */
  59. {"ATS8?\r", "\r\n005\r\n\r\nOK\r\n"},
  60. {"ATS8=1\r", "\r\nOK\r\n"},
  61. {"ATS8.5?\r", "\r\n0\r\n\r\nOK\r\n"},
  62. {"ATS8.5=1\r", "\r\nOK\r\n"},
  63. {"ATS8.5?\r", "\r\n1\r\n\r\nOK\r\n"},
  64. {"ATS8?\r", "\r\n033\r\n\r\nOK\r\n"},
  65. {"AT+FCLASS=1\r", "\r\nOK\r\n"},
  66. {"AT+FCLASS?\r", "\r\n1\r\n\r\nOK\r\n"},
  67. {"AT+FCLASS=?\r", "\r\n0,1,1.0\r\n\r\nOK\r\n"},
  68. /* Try all the commands */
  69. {"AT&C\r", "\r\nOK\r\n"}, /* V.250 6.2.8 - Circuit 109 (received line signal detector), behaviour */
  70. {"AT&D\r", "\r\nOK\r\n"}, /* V.250 6.2.9 - Circuit 108 (data terminal ready) behaviour */
  71. {"AT&F\r", "\r\nOK\r\n"}, /* V.250 6.1.2 - Set to factory-defined configuration */
  72. {"ATE0\r", "ATE0\r\r\nOK\r\n"}, /* Counteract the effects of the above */
  73. {"AT+A8E=?\r", "\r\n+A8E:(0-6),(0-5),(00-FF)\r\n\r\nOK\r\n"}, /* V.251 5.1 - V.8 and V.8bis operation controls */
  74. {"AT+A8M\r", "\r\nOK\r\n"}, /* V.251 5.2 - Send V.8 menu signals */
  75. {"AT+A8T=?\r", "\r\n+A8T:(0-10)\r\n\r\nOK\r\n"}, /* V.251 5.3 - Send V.8bis signal and/or message(s) */
  76. {"AT+ASTO=?\r", "\r\n+ASTO:\r\n\r\nOK\r\n"}, /* V.250 6.3.15 - Store telephone number */
  77. {"AT+CAAP=?\r", "\r\n+CAAP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.25 - Automatic answer for eMLPP Service */
  78. {"AT+CACM=?\r", "\r\n+CACM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.25 - Accumulated call meter */
  79. {"AT+CACSP=?\r", "\r\n+CACSP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.7 - Voice Group or Voice Broadcast Call State Attribute Presentation */
  80. {"AT+CAEMLPP=?\r", "\r\n+CAEMLPP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.22 - eMLPP Priority Registration and Interrogation */
  81. {"AT+CAHLD=?\r", "\r\n+CAHLD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.3 - Leave an ongoing Voice Group or Voice Broadcast Call */
  82. {"AT+CAJOIN=?\r", "\r\n+CAJOIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.1 - Accept an incoming Voice Group or Voice Broadcast Call */
  83. {"AT+CALA=?\r", "\r\n+CALA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.16 - Alarm */
  84. {"AT+CALCC=?\r", "\r\n+CALCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.6 - List current Voice Group and Voice Broadcast Calls */
  85. {"AT+CALD=?\r", "\r\n+CALD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.38 - Delete alar m */
  86. {"AT+CALM=?\r", "\r\n+CALM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.20 - Alert sound mode */
  87. {"AT+CAMM=?\r", "\r\n+CAMM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.26 - Accumulated call meter maximum */
  88. {"AT+CANCHEV=?\r", "\r\n+CANCHEV:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.8 - NCH Support Indication */
  89. {"AT+CAOC=?\r", "\r\n+CAOC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.16 - Advice of Charge */
  90. {"AT+CAPD=?\r", "\r\n+CAPD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.39 - Postpone or dismiss an alarm */
  91. {"AT+CAPTT=?\r", "\r\n+CAPTT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.4 - Talker Access for Voice Group Call */
  92. {"AT+CAREJ=?\r", "\r\n+CAREJ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.2 - Reject an incoming Voice Group or Voice Broadcast Call */
  93. {"AT+CAULEV=?\r", "\r\n+CAULEV:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.5 - Voice Group Call Uplink Status Presentation */
  94. {"AT+CBC=?\r", "\r\n+CBC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.4 - Battery charge */
  95. {"AT+CBCS=?\r", "\r\n+CBCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.3.2 - VBS subscriptions and GId status */
  96. {"AT+CBST=?\r", "\r\n+CBST:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.7 - Select bearer service type */
  97. {"AT+CCFC=?\r", "\r\n+CCFC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.11 - Call forwarding number and conditions */
  98. {"AT+CCLK=?\r", "\r\n+CCLK:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.15 - Clock */
  99. {"AT+CCUG=?\r", "\r\n+CCUG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.10 - Closed user group */
  100. {"AT+CCWA=?\r", "\r\n+CCWA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.12 - Call waiting */
  101. {"AT+CCWE=?\r", "\r\n+CCWE:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.28 - Call Meter maximum event */
  102. {"AT+CDIP=?\r", "\r\n+CDIP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.9 - Called line identification presentation */
  103. {"AT+CDIS=?\r", "\r\n+CDIS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.8 - Display control */
  104. {"AT+CEER=?\r", "\r\n+CEER:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.10 - Extended error report */
  105. {"AT+CFCS=?\r", "\r\n+CFCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.24 - Fast call setup conditions */
  106. {"AT+CFUN=?\r", "\r\n+CFUN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.2 - Set phone functionality */
  107. {"AT+CGACT=?\r", "\r\n+CGACT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.10 - PDP context activate or deactivate */
  108. {"AT+CGANS=?\r", "\r\n+CGANS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.16 - Manual response to a network request for PDP context activation */
  109. {"AT+CGATT=?\r", "\r\n+CGATT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.9 - PS attach or detach */
  110. {"AT+CGAUTO=?\r", "\r\n+CGAUTO:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.15 - Automatic response to a network request for PDP context activation */
  111. {"AT+CGCLASS=?\r", "\r\n+CGCLASS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.17 - GPRS mobile station class (GPRS only) */
  112. {"AT+CGCLOSP=?\r", "\r\n+CGCLOSP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.13 - Configure local octet stream PAD parameters (Obsolete) */
  113. {"AT+CGCLPAD=?\r", "\r\n+CGCLPAD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.12 - Configure local triple-X PAD parameters (GPRS only) (Obsolete) */
  114. {"AT+CGCMOD=?\r", "\r\n+CGCMOD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.11 - PDP Context Modify */
  115. {"AT+CGCS=?\r", "\r\n+CGCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.3.1 - VGCS subscriptions and GId status */
  116. {"AT+CGDATA=?\r", "\r\n+CGDATA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.12 - Enter data state */
  117. {"AT+CGDCONT=?\r", "\r\n+CGDCONT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.1 - Define PDP Context */
  118. {"AT+CGDSCONT=?\r", "\r\n+CGDSCONT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.2 - Define Secondary PDP Context */
  119. {"AT+CGEQMIN=?\r", "\r\n+CGEQMIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.7 - 3G Quality of Service Profile (Minimum acceptable) */
  120. {"AT+CGEQNEG=?\r", "\r\n+CGEQNEG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.8 - 3G Quality of Service Profile (Negotiated) */
  121. {"AT+CGEQREQ=?\r", "\r\n+CGEQREQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.6 - 3G Quality of Service Profile (Requested) */
  122. {"AT+CGEREP=?\r", "\r\n+CGEREP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.18 - Packet Domain event reporting */
  123. {"AT+CGMI=?\r", "\r\n+CGMI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.1 - Request manufacturer identification */
  124. {"AT+CGMM=?\r", "\r\n+CGMM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.2 - Request model identification */
  125. {"AT+CGMR=?\r", "\r\n+CGMR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.3 - Request revision identification */
  126. {"AT+CGPADDR=?\r", "\r\n+CGPADDR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.14 - Show PDP address */
  127. {"AT+CGQMIN=?\r", "\r\n+CGQMIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.5 - Quality of Service Profile (Minimum acceptable) */
  128. {"AT+CGQREQ=?\r", "\r\n+CGQREQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.4 - Quality of Service Profile (Requested) */
  129. {"AT+CGREG=?\r", "\r\n+CGREG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.19 - GPRS network registration status */
  130. {"AT+CGSMS=?\r", "\r\n+CGSMS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.20 - Select service for MO SMS messages */
  131. {"AT+CGSN=?\r", "\r\n+CGSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.4 - Request product serial number identification */
  132. {"AT+CGTFT=?\r", "\r\n+CGTFT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 10.1.3 - Traffic Flow Template */
  133. {"AT+CHLD=?\r", "\r\n+CHLD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.13 - Call related supplementary services */
  134. {"AT+CHSA=?\r", "\r\n+CHSA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.18 - HSCSD non-transparent asymmetry configuration */
  135. {"AT+CHSC=?\r", "\r\n+CHSC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.15 - HSCSD current call parameters */
  136. {"AT+CHSD=?\r", "\r\n+CHSD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.12 - HSCSD device parameters */
  137. {"AT+CHSN=?\r", "\r\n+CHSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.14 - HSCSD non-transparent call configuration */
  138. {"AT+CHSR=?\r", "\r\n+CHSR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.16 - HSCSD parameters report */
  139. {"AT+CHST=?\r", "\r\n+CHST:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.13 - HSCSD transparent call configuration */
  140. {"AT+CHSU=?\r", "\r\n+CHSU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.17 - HSCSD automatic user initiated upgrading */
  141. {"AT+CHUP=?\r", "\r\n+CHUP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.5 - Hangup call */
  142. {"AT+CIMI=?\r", "\r\n+CIMI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.6 - Request international mobile subscriber identity */
  143. {"AT+CIND=?\r", "\r\n+CIND:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.9 - Indicator control */
  144. {"AT+CKPD=?\r", "\r\n+CKPD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.7 - Keypad control */
  145. {"AT+CLAC=?\r", "\r\n+CLAC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.37 - List all available AT commands */
  146. {"AT+CLAE=?\r", "\r\n+CLAE:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.31 - Language Event */
  147. {"AT+CLAN=?\r", "\r\n+CLAN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.30 - Set Language */
  148. {"AT+CLCC=?\r", "\r\n+CLCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.18 - List current calls */
  149. {"AT+CLCK=?\r", "\r\n+CLCK:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.4 - Facility lock */
  150. {"AT+CLIP=?\r", "\r\n+CLIP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.6 - Calling line identification presentation */
  151. {"AT+CLIR=?\r", "\r\n+CLIR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.7 - Calling line identification restriction */
  152. {"AT+CLVL=?\r", "\r\n+CLVL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.23 - Loudspeaker volume level */
  153. {"AT+CMAR=?\r", "\r\n+CMAR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.36 - Master Reset */
  154. {"AT+CMEC=?\r", "\r\n+CMEC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.6 - Mobile Termination control mode */
  155. {"AT+CMER=?\r", "\r\n+CMER:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.10 - Mobile Termination event reporting */
  156. {"AT+CMOD=?\r", "\r\n+CMOD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.4 - Call mode */
  157. {"AT+CMUT=?\r", "\r\n+CMUT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.24 - Mute control */
  158. {"AT+CMUX=?\r", "\r\n+CMUX:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.7 - Multiplexing mode */
  159. {"AT+CNUM=?\r", "\r\n+CNUM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.1 - Subscriber number */
  160. {"AT+COLP=?\r", "\r\n+COLP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.8 - Connected line identification presentation */
  161. {"AT+COPN=?\r", "\r\n+COPN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.21 - Read operator names */
  162. {"AT+COPS=?\r", "\r\n+COPS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.3 - PLMN selection */
  163. {"AT+COTDI=?\r", "\r\n+COTDI:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 11.1.9 - Originator to Dispatcher Information */
  164. {"AT+CPAS=?\r", "\r\n+CPAS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.1 - Phone activity status */
  165. {"AT+CPBF=?\r", "\r\n+CPBF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.13 - Find phonebook entries */
  166. {"AT+CPBR=?\r", "\r\n+CPBR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.12 - Read phonebook entries */
  167. {"AT+CPBS=?\r", "\r\n+CPBS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.11 - Select phonebook memory storage */
  168. {"AT+CPBW=?\r", "\r\n+CPBW:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.14 - Write phonebook entry */
  169. {"AT+CPIN=?\r", "\r\n+CPIN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.3 - Enter PIN */
  170. {"AT+CPLS=?\r", "\r\n+CPLS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.20 - Selection of preferred PLMN list */
  171. {"AT+CPOL=?\r", "\r\n+CPOL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.19 - Preferred PLMN list */
  172. {"AT+CPPS=?\r", "\r\n+CPPS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.23 - eMLPP subscriptions */
  173. {"AT+CPROT=?\r", "\r\n+CPROT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.42 - Enter protocol mode */
  174. {"AT+CPUC=?\r", "\r\n+CPUC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.27 - Price per unit and currency table */
  175. {"AT+CPWC=?\r", "\r\n+CPWC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.29 - Power class */
  176. {"AT+CPWD=?\r", "\r\n+CPWD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.5 - Change password */
  177. {"AT+CR=?\r", "\r\n+CR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.9 - Service reporting control */
  178. {"AT+CRC=?\r", "\r\n+CRC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.11 - Cellular result codes */
  179. {"AT+CREG=?\r", "\r\n+CREG:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.2 - Network registration */
  180. {"AT+CRLP=?\r", "\r\n+CRLP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.8 - Radio link protocol */
  181. {"AT+CRMC=?\r", "\r\n+CRMC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.34 - Ring Melody Control */
  182. {"AT+CRMP=?\r", "\r\n+CRMP:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.35 - Ring Melody Playback */
  183. {"AT+CRSL=?\r", "\r\n+CRSL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.21 - Ringer sound level */
  184. {"AT+CRSM=?\r", "\r\n+CRSM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.18 - Restricted SIM access */
  185. {"AT+CSCC=?\r", "\r\n+CSCC:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.19 - Secure control command */
  186. {"AT+CSCS=?\r", "\r\n+CSCS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 5.5 - Select TE character set */
  187. {"AT+CSDF=?\r", "\r\n+CSDF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.22 - Settings date format */
  188. {"AT+CSGT=?\r", "\r\n+CSGT:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.32 - Set Greeting Text */
  189. {"AT+CSIL=?\r", "\r\n+CSIL:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.23 - Silence Command */
  190. {"AT+CSIM=?\r", "\r\n+CSIM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.17 - Generic SIM access */
  191. {"AT+CSNS=?\r", "\r\n+CSNS:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.19 - Single numbering scheme */
  192. {"AT+CSQ=?\r", "\r\n+CSQ:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.5 - Signal quality */
  193. {"AT+CSSN=?\r", "\r\n+CSSN:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.17 - Supplementary service notifications */
  194. {"AT+CSTA=?\r", "\r\n+CSTA:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.1 - Select type of address */
  195. {"AT+CSTF=?\r", "\r\n+CSTF:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.24 - Settings time format */
  196. {"AT+CSVM=?\r", "\r\n+CSVM:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.33 - Set Voice Mail Number */
  197. {"AT+CTFR=?\r", "\r\n+CTFR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.14 - Call deflection */
  198. {"AT+CTZR=?\r", "\r\n+CTZR:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.41 - Time Zone Reporting */
  199. {"AT+CTZU=?\r", "\r\n+CTZU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.40 - Automatic Time Zone Update */
  200. {"AT+CUSD=?\r", "\r\n+CUSD:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.15 - Unstructured supplementary service data */
  201. {"AT+CUUS1=?\r", "\r\n+CUUS1:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 7.26 - User to User Signalling Service 1 */
  202. {"AT+CV120=?\r", "\r\n+CV120:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.21 - V.120 rate adaption protocol */
  203. {"AT+CVHU=?\r", "\r\n+CVHU:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 6.20 - Voice Hangup Control */
  204. {"AT+CVIB=?\r", "\r\n+CVIB:\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 8.22 - Vibrator mode */
  205. {"AT+DR=?\r", "\r\n+DR:\r\n\r\nOK\r\n"}, /* V.250 6.6.2 - Data compression reporting */
  206. {"AT+DS=?\r", "\r\n+DS:\r\n\r\nOK\r\n"}, /* V.250 6.6.1 - Data compression */
  207. {"AT+EB=?\r", "\r\n+EB:\r\n\r\nOK\r\n"}, /* V.250 6.5.2 - Break handling in error control operation */
  208. {"AT+EFCS=?\r", "\r\n+EFCS:(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.5.4 - 32-bit frame check sequence */
  209. {"AT+EFCS?\r", "\r\n+EFCS:0\r\n\r\nOK\r\n"},
  210. {"AT+EFRAM=?\r", "\r\n+EFRAM:(1-65535),(1-65535)\r\n\r\nOK\r\n"},
  211. /* V.250 6.5.8 - Frame length */
  212. {"AT+ER=?\r", "\r\n+ER:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.5.5 - Error control reporting */
  213. {"AT+ES=?\r", "\r\n+ES:(0-7),(0-4),(0-9)\r\n\r\nOK\r\n"}, /* V.250 6.5.1 - Error control selection */
  214. {"AT+ES?\r", "\r\n+ES:0,0,0\r\n\r\nOK\r\n"},
  215. {"AT+ESA=?\r", "\r\n+ESA:(0-2),(0-1),(0-1),(0-1),(0-2),(0-1),(0-255),(0-255)\r\n\r\nOK\r\n"},
  216. /* V.80 8.2 - Synchronous access mode configuration */
  217. {"AT+ESA?\r", "\r\n+ESA:0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"},
  218. {"AT+ESR\r", "\r\nOK\r\n"}, /* V.250 6.5.3 - Selective repeat */
  219. {"AT+ETBM=?\r", "\r\n+ETBM:(0-2),(0-2),(0-30)\r\n\r\nOK\r\n"}, /* T.31 8.5.1 - Adaptive reception control */
  220. {"AT+ETBM?\r", "\r\n+ETBM:0,0\r\n\r\nOK\r\n"},
  221. {"AT+EWIND=?\r", "\r\n+EWIND:(1-127),(1-127)\r\n\r\nOK\r\n"}, /* V.250 6.5.7 - Window size */
  222. {"AT+EWIND?\r", "\r\n+EWIND:0,0\r\n\r\nOK\r\n"},
  223. {"AT+F34=?\r", "\r\n+F34:(0-14),(0-14),(0-2),(0-14),(0-14)\r\n\r\nOK\r\n"},
  224. /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
  225. {"AT+F34?\r", "\r\n+F34:0,0,0,0,0\r\n\r\nOK\r\n"},
  226. {"AT+FAR=?\r", "\r\n0,1\r\n\r\nOK\r\n"}, /* T.31 8.5.1 - Adaptive reception control */
  227. {"AT+FAR?\r", "\r\n0\r\n\r\nOK\r\n"},
  228. {"AT+FCL=?\r", "\r\n(0-255)\r\n\r\nOK\r\n"}, /* T.31 8.5.2 - Carrier loss timeout */
  229. {"AT+FCLASS=?\r", "\r\n0,1,1.0\r\n\r\nOK\r\n"}, /* T.31 8.2 - Capabilities identification and control */
  230. {"AT+FCLASS?\r", "\r\n1\r\n\r\nOK\r\n"},
  231. {"AT+FDD=?\r", "\r\n(0,1)\r\n\r\nOK\r\n"}, /* T.31 8.5.3 - Double escape character replacement */
  232. {"AT+FDD?\r", "\r\n0\r\n\r\nOK\r\n"},
  233. {"AT+FIT=?\r", "\r\n+FIT:(0-255),(0-1)\r\n\r\nOK\r\n"}, /* T.31 8.5.4 - DTE inactivity timeout */
  234. {"AT+FIT?\r", "\r\n+FIT:0,0\r\n\r\nOK\r\n"},
  235. {"AT+FLO=?\r", "\r\n+FLO:(0-2)\r\n\r\nOK\r\n"}, /* T.31 says to implement something similar to +IFC */
  236. {"AT+FLO?\r", "\r\n+FLO:2\r\n\r\nOK\r\n"},
  237. {"AT+FMI?\r", "\r\n" MANUFACTURER "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMI */
  238. {"AT+FMM?\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMM */
  239. {"AT+FMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"}, /* T.31 says to duplicate +GMR */
  240. {"AT+FPR=?\r", "\r\n115200\r\n\r\nOK\r\n"}, /* T.31 says to implement something similar to +IPR */
  241. {"AT+FPR?\r", "\r\n0\r\n\r\nOK\r\n"},
  242. {"AT+FRH=?\r", "\r\n3\r\n\r\nOK\r\n"}, /* T.31 8.3.6 - HDLC receive */
  243. {"AT+FRH?\r", "\r\n-1\r\n\r\nOK\r\n"},
  244. {"AT+FRM=?\r", "\r\n24,48,72,73,74,96,97,98,121,122,145,146\r\n\r\nOK\r\n"}, /* T.31 8.3.4 - Facsimile receive */
  245. {"AT+FRM?\r", "\r\n-1\r\n\r\nOK\r\n"},
  246. {"AT+FRS=?\r", "\r\n0-255\r\n\r\nOK\r\n"}, /* T.31 8.3.2 - Receive silence */
  247. {"AT+FRS?\r", "\r\n-1\r\n\r\nOK\r\n"},
  248. {"AT+FTH=?\r", "\r\n3\r\n\r\nOK\r\n"}, /* T.31 8.3.5 - HDLC transmit */
  249. {"AT+FTH?\r", "\r\n-1\r\n\r\nOK\r\n"},
  250. {"AT+FTM=?\r", "\r\n24,48,72,73,74,96,97,98,121,122,145,146\r\n\r\nOK\r\n"}, /* T.31 8.3.3 - Facsimile transmit */
  251. {"AT+FTM?\r", "\r\n-1\r\n\r\nOK\r\n"},
  252. {"AT+FTS=?\r", "\r\n0-255\r\n\r\nOK\r\n"}, /* T.31 8.3.1 - Transmit silence */
  253. {"AT+FTS?\r", "\r\n-1\r\n\r\nOK\r\n"},
  254. {"AT+GCAP\r", "\r\nOK\r\n"}, /* V.250 6.1.9 - Request complete capabilities list */
  255. {"AT+GCI=?\r", "\r\n+GCI:(00-FF)\r\n\r\nOK\r\n"}, /* V.250 6.1.10 - Country of installation, */
  256. {"AT+GCI?\r", "\r\n+GCI:00\r\n\r\nOK\r\n"},
  257. {"AT+GMI?\r", "\r\n" MANUFACTURER "\r\n\r\nOK\r\n"}, /* V.250 6.1.4 - Request manufacturer identification */
  258. {"AT+GMM?\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* V.250 6.1.5 - Request model identification */
  259. {"AT+GMR?\r", "\r\n" VERSION "\r\n\r\nOK\r\n"}, /* V.250 6.1.6 - Request revision identification */
  260. {"AT+GOI\r", "\r\nOK\r\n"}, /* V.250 6.1.8 - Request global object identification */
  261. {"AT+GSN?\r", "\r\n42\r\n\r\nOK\r\n"}, /* V.250 6.1.7 - Request product serial number identification */
  262. {"AT+IBC=?\r", "\r\n+IBC:(0-2),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0,1),(0.1),(0,1)\r\n\r\nOK\r\n"},
  263. /* V.80 7.9 - Control of in-band control */
  264. {"AT+IBC?\r", "\r\n+IBC:0,0,0,0,0,0,0,0,0,0,0,0,0\r\n\r\nOK\r\n"},
  265. {"AT+IBM=?\r", "\r\n+IBM:(0-7),(0-255),(0-255)\r\n\r\nOK\r\n"}, /* V.80 7.10 - In-band MARK idle reporting control */
  266. {"AT+IBM?\r", "\r\n+IBM:0,0,0\r\n\r\nOK\r\n"},
  267. {"AT+ICF?\r", "\r\n+ICF:0,0\r\n\r\nOK\r\n"}, /* V.250 6.2.11 - DTE-DCE character framing */
  268. {"AT+ICLOK?\r", "\r\n+ICLOK:0\r\n\r\nOK\r\n"}, /* V.250 6.2.14 - Select sync transmit clock source */
  269. {"AT+IDSR?\r", "\r\n+IDSR:0\r\n\r\nOK\r\n"}, /* V.250 6.2.16 - Select data set ready option */
  270. {"AT+IFC=?\r", "\r\n+IFC:(0-2),(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.2.12 - DTE-DCE local flow control */
  271. {"AT+IFC?\r", "\r\n+IFC:2,2\r\n\r\nOK\r\n"},
  272. {"AT+ILRR\r", "\r\nOK\r\n"}, /* V.250 6.2.13 - DTE-DCE local rate reporting */
  273. {"AT+ILSD=?\r", "\r\n+ILSD:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.2.15 - Select long space disconnect option */
  274. {"AT+ILSD?\r", "\r\n+ILSD:0\r\n\r\nOK\r\n"},
  275. {"AT+IPR=?\r", "\r\n+IPR:(115200),(115200)\r\n\r\nOK\r\n"}, /* V.250 6.2.10 - Fixed DTE rate */
  276. {"AT+IPR?\r", "\r\n+IPR:0\r\n\r\nOK\r\n"},
  277. {"AT+IRTS=?\r", "\r\n+IRTS:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.2.17 - Select synchronous mode RTS option */
  278. {"AT+IRTS?\r", "\r\n+IRTS:0\r\n\r\nOK\r\n"},
  279. {"AT+MA\r", "\r\nOK\r\n"}, /* V.250 6.4.2 - Modulation automode control */
  280. {"AT+MR=?\r", "\r\n+MR:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.3 - Modulation reporting control */
  281. {"AT+MR?\r", "\r\n+MR:0\r\n\r\nOK\r\n"},
  282. {"AT+MS\r", "\r\nOK\r\n"}, /* V.250 6.4.1 - Modulation selection */
  283. {"AT+MSC=?\r", "\r\n+MSC:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.8 - Seamless rate change enable */
  284. {"AT+MSC?\r", "\r\n+MSC:0\r\n\r\nOK\r\n"},
  285. {"AT+MV18AM\r", "\r\nOK\r\n"}, /* V.250 6.4.6 - V.18 answering message editing */
  286. {"AT+MV18P=?\r", "\r\n+MV18P:(2-7)\r\n\r\nOK\r\n"}, /* V.250 6.4.7 - Order of probes */
  287. {"AT+MV18P?\r", "\r\n+MV18P:0\r\n\r\nOK\r\n"},
  288. {"AT+MV18R=?\r", "\r\n+MV18R:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.4.5 - V.18 reporting control */
  289. {"AT+MV18R?\r", "\r\n+MV18R:0\r\n\r\nOK\r\n"},
  290. {"AT+MV18S\r", "\r\nOK\r\n"}, /* V.250 6.4.4 - V.18 selection */
  291. {"AT+TADR\r", "\r\nOK\r\n"}, /* V.250 6.7.2.9 - Local V.54 address */
  292. {"AT+TAL=?\r", "\r\n+TAL:(0,1),(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.15 - Local analogue loop */
  293. {"AT+TAL?\r", "\r\n+TAL:0,0\r\n\r\nOK\r\n"},
  294. {"AT+TALS=?\r", "\r\n+TALS:(0-3)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.6 - Analogue loop status */
  295. {"AT+TALS?\r", "\r\n+TALS:0\r\n\r\nOK\r\n"},
  296. {"AT+TDLS=?\r", "\r\n+TDLS:(0-4)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.7 - Local digital loop status */
  297. {"AT+TDLS?\r", "\r\n+TDLS:0\r\n\r\nOK\r\n"},
  298. {"AT+TE140=?\r", "\r\n+TE140:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.1 - Enable ckt 140 */
  299. {"AT+TE140?\r", "\r\n+TE140:0\r\n\r\nOK\r\n"},
  300. {"AT+TE141=?\r", "\r\n+TE141:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.2 - Enable ckt 141 */
  301. {"AT+TE141?\r", "\r\n+TE141:0\r\n\r\nOK\r\n"},
  302. {"AT+TEPAL=?\r", "\r\n+TEPAL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.5 - Enable front panel analogue loop */
  303. {"AT+TEPAL?\r", "\r\n+TEPAL:0\r\n\r\nOK\r\n"},
  304. {"AT+TEPDL=?\r", "\r\n+TEPDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.4 - Enable front panel RDL */
  305. {"AT+TEPDL?\r", "\r\n+TEPDL:0\r\n\r\nOK\r\n"},
  306. {"AT+TERDL=?\r", "\r\n+TERDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.3 - Enable RDL from remote */
  307. {"AT+TERDL?\r", "\r\n+TERDL:0\r\n\r\nOK\r\n"},
  308. {"AT+TLDL=?\r", "\r\n+TLDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.13 - Local digital loop */
  309. {"AT+TLDL?\r", "\r\n+TLDL:0\r\n\r\nOK\r\n"},
  310. {"AT+TMODE=?\r", "\r\n+TMODE:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.10 - Set V.54 mode */
  311. {"AT+TMODE?\r", "\r\n+TMODE:0\r\n\r\nOK\r\n"},
  312. {"AT+TNUM\r", "\r\nOK\r\n"}, /* V.250 6.7.2.12 - Errored bit and block counts */
  313. {"AT+TRDL=?\r", "\r\n+TRDL:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.14 - Request remote digital loop */
  314. {"AT+TRDL?\r", "\r\n+TRDL:0\r\n\r\nOK\r\n"},
  315. {"AT+TRDLS\r", "\r\nOK\r\n"}, /* V.250 6.7.2.8 - Remote digital loop status */
  316. {"AT+TRES=?\r", "\r\n+TRES:(0-2)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.17 - Self test result */
  317. {"AT+TRES?\r", "\r\n+TRES:0\r\n\r\nOK\r\n"},
  318. {"AT+TSELF=?\r", "\r\n+TSELF:(0,1)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.16 - Self test */
  319. {"AT+TSELF?\r", "\r\n+TSELF:0\r\n\r\nOK\r\n"},
  320. {"AT+TTER=?\r", "\r\n+TTER:(0-65535),(0-65535)\r\n\r\nOK\r\n"}, /* V.250 6.7.2.11 - Test error rate */
  321. {"AT+TTER?\r", "\r\n+TTER:0,0\r\n\r\nOK\r\n"},
  322. {"AT+VBT\r", "\r\nOK\r\n"}, /* 3GPP TS 27.007 C.2.2 - Buffer threshold setting */
  323. {"AT+VCID=?\r", "\r\n0,1\r\n\r\nOK\r\n"}, /* 3GPP TS 27.007 C.2.3 - Calling number ID presentation */
  324. {"AT+VCID?\r", "\r\n0\r\n\r\nOK\r\n"},
  325. {"AT+VDR\r", "\r\nOK\r\n"}, /* V.253 10.3.1 - Distinctive ring (ring cadence reporting) */
  326. {"AT+VDT\r", "\r\nOK\r\n"}, /* V.253 10.3.2 - Control tone cadence reporting */
  327. {"AT+VDX\r", "\r\nOK\r\n"}, /* V.253 10.5.6 - Speakerphone duplex mode */
  328. {"AT+VEM\r", "\r\nOK\r\n"}, /* V.253 10.5.7 - Deliver event reports */
  329. {"AT+VGM\r", "\r\nOK\r\n"}, /* V.253 10.5.2 - Microphone gain */
  330. {"AT+VGR\r", "\r\nOK\r\n"}, /* V.253 10.2.1 - Receive gain selection */
  331. {"AT+VGS\r", "\r\nOK\r\n"}, /* V.253 10.5.3 - Speaker gain */
  332. {"AT+VGT\r", "\r\nOK\r\n"}, /* V.253 10.2.2 - Volume selection */
  333. {"AT+VIP\r", "\r\nOK\r\n"}, /* V.253 10.1.1 - Initialize voice parameters */
  334. {"AT+VIT\r", "\r\nOK\r\n"}, /* V.253 10.2.3 - DTE/DCE inactivity timer */
  335. {"AT+VLS\r", "\r\nOK\r\n"}, /* V.253 10.2.4 - Analogue source/destination selection */
  336. {"AT+VPP\r", "\r\nOK\r\n"}, /* V.253 10.4.2 - Voice packet protocol */
  337. {"AT+VRA\r", "\r\nOK\r\n"}, /* V.253 10.2.5 - Ringing tone goes away timer */
  338. {"AT+VRID?\r", "\r\n0\r\n\r\nOK\r\n"}, /* Extension - Find the originating and destination numbers */
  339. {"AT+VRL\r", "\r\nOK\r\n"}, /* V.253 10.1.2 - Ring local phone */
  340. {"AT+VRN\r", "\r\nOK\r\n"}, /* V.253 10.2.6 - Ringing tone never appeared timer */
  341. {"AT+VRX\r", "\r\nOK\r\n"}, /* V.253 10.1.3 - Voice receive state */
  342. {"AT+VSD\r", "\r\nOK\r\n"}, /* V.253 10.2.7 - Silence detection (QUIET and SILENCE) */
  343. {"AT+VSID=12345\r", "\r\nOK\r\n"}, /* Extension - Set the originating number */
  344. {"AT+VSID?\r", "\r\n12345\r\n\r\nOK\r\n"},
  345. {"AT+VSM\r", "\r\nOK\r\n"}, /* V.253 10.2.8 - Compression method selection */
  346. {"AT+VSP\r", "\r\nOK\r\n"}, /* V.253 10.5.1 - Voice speakerphone state */
  347. {"AT+VTA\r", "\r\nOK\r\n"}, /* V.253 10.5.4 - Train acoustic echo-canceller */
  348. {"AT+VTD\r", "\r\nOK\r\n"}, /* V.253 10.2.9 - Beep tone duration timer */
  349. {"AT+VTH\r", "\r\nOK\r\n"}, /* V.253 10.5.5 - Train line echo-canceller */
  350. {"AT+VTR\r", "\r\nOK\r\n"}, /* V.253 10.1.4 - Voice duplex state */
  351. {"AT+VTS\r", "\r\nOK\r\n"}, /* V.253 10.1.5 - DTMF and tone generation in voice */
  352. {"AT+VTX\r", "\r\nOK\r\n"}, /* V.253 10.1.6 - Transmit data state */
  353. {"AT+WS46\r", "\r\nOK\r\n"}, /* 3GPP TS 27.007 5.9 - PCCA STD-101 [17] select wireless network */
  354. {"ATA\r", "\r\nERROR\r\n"}, /* V.250 6.3.5 - Answer */
  355. {"ATDT -1234567890ABCDPSTW*#+,!@\r;", ""}, /* V.250 6.3.1 - Dial */
  356. {"ATE1\r", "\r\nOK\r\n"}, /* V.250 6.2.4 - Command echo */
  357. {"ATE0\r", "ATE0\r\r\nOK\r\n"}, /* V.250 6.2.4 - Command echo */
  358. {"ATH\r", "\r\nOK\r\n"}, /* V.250 6.3.6 - Hook control */
  359. {"ATI\r", "\r\n" PACKAGE "\r\n\r\nOK\r\n"}, /* V.250 6.1.3 - Request identification information */
  360. {"ATL\r", "\r\nOK\r\n"}, /* V.250 6.3.13 - Monitor speaker loudness */
  361. {"ATM\r", "\r\nOK\r\n"}, /* V.250 6.3.14 - Monitor speaker mode */
  362. {"ATO\r", "\r\nCONNECT\r\n\r\nOK\r\n"}, /* V.250 6.3.7 - Return to online data state */
  363. {"ATP\r", "\r\nOK\r\n"}, /* V.250 6.3.3 - Select pulse dialling (command) */
  364. {"ATQ\r", "\r\nOK\r\n"}, /* V.250 6.2.5 - Result code suppression */
  365. {"ATS0=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.8 - Automatic answer */
  366. {"ATS0?\r", "\r\n000\r\n\r\nOK\r\n"},
  367. {"ATS10=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.12 - Automatic disconnect delay */
  368. {"ATS10?\r", "\r\n000\r\n\r\nOK\r\n"},
  369. {"ATS3=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.1 - Command line termination character */
  370. {"ATS3?\r", "\r\n013\r\n\r\nOK\r\n"},
  371. {"ATS4=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.2 - Response formatting character */
  372. {"ATS4?\r", "\r\n010\r\n\r\nOK\r\n"},
  373. {"ATS5=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.2.3 - Command line editing character */
  374. {"ATS5?\r", "\r\n008\r\n\r\nOK\r\n"},
  375. {"ATS6=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.9 - Pause before blind dialling */
  376. {"ATS6?\r", "\r\n001\r\n\r\nOK\r\n"},
  377. {"ATS7=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.10 - Connection completion timeout */
  378. {"ATS7?\r", "\r\n060\r\n\r\nOK\r\n"},
  379. {"ATS8=?\r", "\r\n000\r\n\r\nOK\r\n"}, /* V.250 6.3.11 - Comma dial modifier time */
  380. {"ATS8?\r", "\r\n005\r\n\r\nOK\r\n"},
  381. {"ATT\r", "\r\nOK\r\n"}, /* V.250 6.3.2 - Select tone dialling (command) */
  382. {"ATV0\r", "0\r"}, /* V.250 6.2.6 - DCE response format */
  383. {"ATV1\r", "\r\nOK\r\n"},
  384. {"ATX4\r", "\r\nOK\r\n"}, /* V.250 6.2.7 - Result code selection and call progress monitoring control */
  385. {"ATZ\r", "\r\nOK\r\n"}, /* V.250 6.1.1 - Reset to default configuration */
  386. {"", ""}
  387. };
  388. char *decode_test_file = NULL;
  389. int countdown = 0;
  390. int command_response_test_step = -1;
  391. char response_buf[1000];
  392. int response_buf_ptr = 0;
  393. static int at_rx(at_state_t *s, const char *t, int len)
  394. {
  395. at_interpreter(s, t, len);
  396. return 0;
  397. }
  398. /*- End of function --------------------------------------------------------*/
  399. static int at_send(at_state_t *s, const char *t)
  400. {
  401. printf("%s", t);
  402. at_rx(s, t, strlen(t));
  403. return 0;
  404. }
  405. /*- End of function --------------------------------------------------------*/
  406. #if 0
  407. static int at_send_at(at_state_t *s, const char *t)
  408. {
  409. uint8_t buf[500];
  410. sprintf((char *) buf, "AT%s\r", t);
  411. printf("%s", t);
  412. at_rx(s, t, strlen(t));
  413. return 0;
  414. }
  415. /*- End of function --------------------------------------------------------*/
  416. static int at_expect(at_state_t *s, const char *t)
  417. {
  418. return 0;
  419. }
  420. /*- End of function --------------------------------------------------------*/
  421. static int at_send_hdlc(at_state_t *s, uint8_t *t, int len)
  422. {
  423. uint8_t buf[100];
  424. int i;
  425. int j;
  426. for (i = 0, j = 0; i < len; i++)
  427. {
  428. if (*t == DLE)
  429. buf[j++] = DLE;
  430. buf[j++] = *t++;
  431. }
  432. buf[j++] = DLE;
  433. buf[j++] = ETX;
  434. at_rx(s, (char *) buf, j);
  435. return 0;
  436. }
  437. /*- End of function --------------------------------------------------------*/
  438. #endif
  439. static int general_test(at_state_t *s)
  440. {
  441. int i;
  442. for (i = 0; general_test_seq[i].command[0]; i++)
  443. {
  444. response_buf_ptr = 0;
  445. response_buf[0] = '\0';
  446. command_response_test_step = i;
  447. at_send(s, general_test_seq[i].command);
  448. if (strcmp(general_test_seq[command_response_test_step].response, response_buf) != 0)
  449. {
  450. printf("Incorrect response\n");
  451. printf("Expected: '%s'\n", general_test_seq[command_response_test_step].response);
  452. printf("Received: '%s'\n", response_buf);
  453. return -1;
  454. }
  455. }
  456. return 0;
  457. }
  458. /*- End of function --------------------------------------------------------*/
  459. static int modem_call_control(void *user_data, int op, const char *num)
  460. {
  461. switch (op)
  462. {
  463. case AT_MODEM_CONTROL_CALL:
  464. printf("\nModem control - Dialing '%s'\n", num);
  465. break;
  466. case AT_MODEM_CONTROL_ANSWER:
  467. printf("\nModem control - Answering\n");
  468. /* Force an error response, so we get something well defined for the test. */
  469. return -1;
  470. case AT_MODEM_CONTROL_HANGUP:
  471. printf("\nModem control - Hanging up\n");
  472. break;
  473. case AT_MODEM_CONTROL_OFFHOOK:
  474. printf("\nModem control - Going off hook\n");
  475. break;
  476. case AT_MODEM_CONTROL_ONHOOK:
  477. printf("\nModem control - Going on hook\n");
  478. break;
  479. case AT_MODEM_CONTROL_DTR:
  480. printf("\nModem control - DTR %d\n", (int) (intptr_t) num);
  481. break;
  482. case AT_MODEM_CONTROL_RTS:
  483. printf("\nModem control - RTS %d\n", (int) (intptr_t) num);
  484. break;
  485. case AT_MODEM_CONTROL_CTS:
  486. printf("\nModem control - CTS %d\n", (int) (intptr_t) num);
  487. break;
  488. case AT_MODEM_CONTROL_CAR:
  489. printf("\nModem control - CAR %d\n", (int) (intptr_t) num);
  490. break;
  491. case AT_MODEM_CONTROL_RNG:
  492. printf("\nModem control - RNG %d\n", (int) (intptr_t) num);
  493. break;
  494. case AT_MODEM_CONTROL_DSR:
  495. printf("\nModem control - DSR %d\n", (int) (intptr_t) num);
  496. break;
  497. case AT_MODEM_CONTROL_SETID:
  498. printf("\nModem control - Set ID '%s'\n", num);
  499. break;
  500. case AT_MODEM_CONTROL_RESTART:
  501. printf("\nModem control - Restart %d\n", (int) (intptr_t) num);
  502. break;
  503. case AT_MODEM_CONTROL_DTE_TIMEOUT:
  504. printf("\nModem control - Set DTE timeout %d\n", (int) (intptr_t) num);
  505. break;
  506. default:
  507. printf("\nModem control - operation %d\n", op);
  508. break;
  509. }
  510. /*endswitch*/
  511. return 0;
  512. }
  513. /*- End of function --------------------------------------------------------*/
  514. static int at_tx_handler(void *user_data, const uint8_t *buf, size_t len)
  515. {
  516. int i;
  517. for (i = 0; i < len; i++)
  518. {
  519. response_buf[response_buf_ptr++] = buf[i];
  520. putchar(buf[i]);
  521. }
  522. response_buf[response_buf_ptr] = '\0';
  523. return 0;
  524. }
  525. /*- End of function --------------------------------------------------------*/
  526. int main(int argc, char *argv[])
  527. {
  528. at_state_t *at_state;
  529. if ((at_state = at_init(NULL, at_tx_handler, NULL, modem_call_control, NULL)) == NULL)
  530. {
  531. fprintf(stderr, "Cannot start the AT interpreter\n");
  532. exit(2);
  533. }
  534. if (general_test(at_state))
  535. {
  536. printf("Tests failed.\n");
  537. exit(2);
  538. }
  539. printf("Tests passed.\n");
  540. at_free(at_state);
  541. return 0;
  542. }
  543. /*- End of function --------------------------------------------------------*/
  544. /*- End of file ------------------------------------------------------------*/