FreeCalypso > hg > fc-magnetite
comparison src/cs/services/atp/atp_cmd.h @ 0:945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
binary blobs and LCD demo files have been excluded,
all line endings are LF only
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Sun, 25 Sep 2016 22:50:11 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:945cf7f506b2 |
|---|---|
| 1 /******************************************************************************** | |
| 2 * | |
| 3 * File Name : atp_cmd.h | |
| 4 * | |
| 5 * External definition for commands supported by ATP | |
| 6 * | |
| 7 * (C) Texas Instruments, all rights reserved | |
| 8 * | |
| 9 * Version number : 0.1 - 03-03-2000 | |
| 10 * | |
| 11 * History : 0.1 - Created by E. Baissus | |
| 12 * | |
| 13 * Author : Eric Baissus : e-baissus@ti.com | |
| 14 * | |
| 15 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved | |
| 16 * | |
| 17 ********************************************************************************/ | |
| 18 #include "rv/rv_general.h" | |
| 19 #include "rvf/rvf_api.h" | |
| 20 #include "atp/atp_config.h" | |
| 21 #include "atp/atp_api.h" | |
| 22 | |
| 23 #include <stdlib.h> | |
| 24 | |
| 25 #ifndef ATP_CMD_H | |
| 26 #define ATP_CMD_H | |
| 27 | |
| 28 | |
| 29 /************************** LOCAL DCE-DTE PORT CONTROL **************************/ | |
| 30 /* */ | |
| 31 /* Define the number of word needed to mask the commands executed by the ATP. */ | |
| 32 #define NB_WORD_OF_DCE_CMD_MASK (0x01) | |
| 33 | |
| 34 /* Define the default command line termination character (See ITU-T */ | |
| 35 /* Recommendation V.250 ter page 21). */ | |
| 36 #define ATP_CR_CHARACTER ('\x0D') | |
| 37 | |
| 38 /* Define the default response formatting character (See ITU-T Recommendation */ | |
| 39 /* V.250 ter page 22). */ | |
| 40 #define ATP_LF_CHARACTER ('\x0A') | |
| 41 | |
| 42 /* Define the default command line editing character (See ITU-T Recommendation */ | |
| 43 /* V.250 ter page 22). */ | |
| 44 #define ATP_BS_CHARACTER ('\x08') | |
| 45 | |
| 46 /* Define the escape sequence (See ITU-T Recommendation V.250 ter page 24). */ | |
| 47 #define MAX_NB_OF_CHARACTER_FOR_END_SEQUENCE (0x03) | |
| 48 | |
| 49 static const char ATP_ESCAPE_SEQUENCE[] = "+++"; | |
| 50 | |
| 51 /* Define the command echo (See ITU-T Recommendation V.250 ter page 23). */ | |
| 52 typedef enum | |
| 53 { | |
| 54 ECHO_OFF = 0x00000000, | |
| 55 ECHO_ON | |
| 56 } T_ATP_ECHO_MODE; | |
| 57 | |
| 58 /* Define the result code suppression (See ITU-T Recommendation V.250 ter page */ | |
| 59 /* 23). */ | |
| 60 typedef enum | |
| 61 { | |
| 62 RESULT_CODE_ON = 0x00000000, | |
| 63 RESULT_CODE_OFF | |
| 64 } T_ATP_RESULT_CODE_MODE; | |
| 65 | |
| 66 /* Define the DCE response format (See ITU-T Recommendation V.250 ter page 24). */ | |
| 67 typedef enum | |
| 68 { | |
| 69 ATP_VERBOSE_0 = 0x00000000, | |
| 70 ATP_VERBOSE_1 | |
| 71 } T_ATP_VERBOSE_MODE; | |
| 72 | |
| 73 /* Define the structure used to store information related to DCE handling. Note */ | |
| 74 /* that 'nb_plus_received' indicates the number of escape characters that have */ | |
| 75 /* been previously received (refer to 'escape_sequence_tmp_buffer_p'). */ | |
| 76 typedef UINT16 T_ATP_DCE_MASK[NB_WORD_OF_DCE_CMD_MASK]; | |
| 77 | |
| 78 typedef struct | |
| 79 { | |
| 80 char cr_character; | |
| 81 char lf_character; | |
| 82 char bs_character; | |
| 83 char escape_sequence[MAX_NB_OF_CHARACTER_FOR_END_SEQUENCE]; | |
| 84 T_ATP_ECHO_MODE echo_mode; | |
| 85 T_ATP_RESULT_CODE_MODE result_code_mode; | |
| 86 T_ATP_VERBOSE_MODE verbose_mode; | |
| 87 T_ATP_DCE_MASK dce_mask; | |
| 88 UINT8 nb_plus_received; | |
| 89 UINT8 *escape_sequence_tmp_buffer_p[MAX_NB_OF_CHARACTER_FOR_END_SEQUENCE]; | |
| 90 UINT8 length_of_escape_sequence_tmp_buffer_p[MAX_NB_OF_CHARACTER_FOR_END_SEQUENCE]; | |
| 91 } T_ATP_DCE_INFO; | |
| 92 | |
| 93 | |
| 94 /********************************** AT COMMANDS *********************************/ | |
| 95 /* */ | |
| 96 /* Define all supported AT commands. */ | |
| 97 /* __________________________________________________________________________ */ | |
| 98 /* | | | | | */ | |
| 99 /* | Binary code | Len | Command | Description | */ | |
| 100 /* |___________________|_____|_________|______________________________________| */ | |
| 101 /* | | | | | */ | |
| 102 /* | ATP_ATA_NB | 1 | ATA | Answer. | */ | |
| 103 /* | ATP_ATD_NB | 1 | ATD | Dial. | */ | |
| 104 /* | ATP_ATE_NB | 1 | ATE | Command echo. | */ | |
| 105 /* | ATP_ATH_NB | 1 | ATH | Hook control. | */ | |
| 106 /* | ATP_ATI_NB | 1 | ATI | Request Identification Information | */ | |
| 107 /* | ATP_ATL_NB | 1 | ATL | Monitor speaker loudness. | */ | |
| 108 /* | ATP_ATM_NB | 1 | ATM | Monitor speaker mode. | */ | |
| 109 /* | ATP_ATO_NB | 1 | ATO | Return to online data state. | */ | |
| 110 /* | ATP_ATP_NB | 1 | ATP | Select pulse dialling. | */ | |
| 111 /* | ATP_ATQ_NB | 1 | ATQ | Result code suppression. | */ | |
| 112 /* | ATP_ATS0_NB | 2 | ATS0 | Automatic answer. | */ | |
| 113 /* | ATP_ATS10_NB | 3 | ATS10 | Automatic disconnect delay. | */ | |
| 114 /* | ATP_ATS3_NB | 2 | ATS3 | Command line termination character. | */ | |
| 115 /* | ATP_ATS4_NB | 2 | ATS4 | Response formatting character. | */ | |
| 116 /* | ATP_ATS5_NB | 2 | ATS5 | Command line editing character. | */ | |
| 117 /* | ATP_ATS6_NB | 2 | ATS6 | Pause before blind dialling. | */ | |
| 118 /* | ATP_ATS7_NB | 2 | ATS7 | Connection completion timeout. | */ | |
| 119 /* | ATP_ATS8_NB | 2 | ATS8 | Comma dial modifier time. | */ | |
| 120 /* | ATP_ATT_NB | 1 | ATT | Select tone dialling. | */ | |
| 121 /* | ATP_ATV_NB | 1 | ATV | DCE response format. | */ | |
| 122 /* | ATP_ATX_NB | 1 | ATX | Result code selection and call | */ | |
| 123 /* | | | | progress monitoring control. | */ | |
| 124 /* | ATP_ATZ_NB | 1 | ATZ | Reset to default configuration. | */ | |
| 125 /* | ATP_AT_AND_C_NB | 2 | AT&C | Circuit 109 (received line signal | */ | |
| 126 /* | | | | detector) behavior. | */ | |
| 127 /* | ATP_AT_AND_D_NB | 2 | AT&D | Circuit 108 (data terminal ready) | */ | |
| 128 /* | | | | behavior. | */ | |
| 129 /* | ATP_AT_AND_F_NB | 2 | AT&F | Set to factory defined | */ | |
| 130 /* | | | | configuration. | */ | |
| 131 /* |___________________|_____|_________|______________________________________| */ | |
| 132 /* | | | | | */ | |
| 133 /* |ATP_AT_PLUS_CKPD_NB| 5 | AT+CKPD | Keypad control command (See GSM TS | */ | |
| 134 /* | | | | 07.07, Section 8.7). For <keys>, the | */ | |
| 135 /* | | | | value of 200 indicates the button on | */ | |
| 136 /* | | | | the headset being pushed. The <time> | */ | |
| 137 /* | | | | and <pause> parameters have no | */ | |
| 138 /* | | | | meaning in the headset profile. | */ | |
| 139 /* |ATP_AT_PLUS_FDR_NB | 4 | AT+FDR | Receive a page. | */ | |
| 140 /* |ATP_AT_PLUS_FDT_NB | 4 | AT+FDT | Send a page. | */ | |
| 141 /* |ATP_AT_PLUS_FKS_NB | 4 | AT+FKS | Session termination. | */ | |
| 142 /* |ATP_AT_PLUS_GMI_NB | 4 | AT+GMI | Request manufacturer identification. | */ | |
| 143 /* |ATP_AT_PLUS_GMM_NB | 4 | AT+GMM | Request model identification. | */ | |
| 144 /* |ATP_AT_PLUS_GMR_NB | 4 | AT+GMR | Request revision identification. | */ | |
| 145 /* |ATP_AT_PLUS_GCAP_NB| 5 | AT+GCAP | Request complete capabilities list. | */ | |
| 146 /* |ATP_AT_PLUS_VGM_NB | 4 | AT+VGM | Command issued by the HS to report | */ | |
| 147 /* | | | | the current microphone gain level | */ | |
| 148 /* | | | | setting to the AG (See Headset | */ | |
| 149 /* | | | | Specification, Section 4.7.3). | */ | |
| 150 /* |ATP_AT_PLUS_VGS_NB | 4 | AT+VGS | Command issued by the HS to report | */ | |
| 151 /* | | | | the current speaker gain level | */ | |
| 152 /* | | | | setting to the AG (See Headset | */ | |
| 153 /* | | | | Specification, Section 4.7.3). | */ | |
| 154 /* |___________________|_____|_________|______________________________________| */ | |
| 155 /* */ | |
| 156 /* Define the command line prefix "AT" (See ITU-T Recommendation V.250 ter page */ | |
| 157 /* page 4). */ | |
| 158 #define ATP_AT_PREFIX ("AT") | |
| 159 #define ATP_AT_PREFIX_LEN (0x02) | |
| 160 | |
| 161 /* Text codes for AT commands. */ | |
| 162 static const char ATP_AT_TXT_TABLE[] = {'A', \ | |
| 163 'D', \ | |
| 164 'E', \ | |
| 165 'H', \ | |
| 166 'I', \ | |
| 167 'L', \ | |
| 168 'M', \ | |
| 169 'O', \ | |
| 170 'P', \ | |
| 171 'Q', \ | |
| 172 'S', '0', \ | |
| 173 'S', '1', '0', \ | |
| 174 'S', '3', \ | |
| 175 'S', '4', \ | |
| 176 'S', '5', \ | |
| 177 'S', '6', \ | |
| 178 'S', '7', \ | |
| 179 'S', '8', \ | |
| 180 'T', \ | |
| 181 'V', \ | |
| 182 'X', \ | |
| 183 'Z', \ | |
| 184 '&', 'C', \ | |
| 185 '&', 'D', \ | |
| 186 '&', 'F', \ | |
| 187 '+', 'C', 'K', 'P', 'D', \ | |
| 188 '+', 'F', 'D', 'R', \ | |
| 189 '+', 'F', 'D', 'T', \ | |
| 190 '+', 'F', 'K', 'S', \ | |
| 191 '+', 'G', 'M', 'I', \ | |
| 192 '+', 'G', 'M', 'M', \ | |
| 193 '+', 'G', 'M', 'R', \ | |
| 194 '+', 'G', 'C', 'A', 'P', \ | |
| 195 '+', 'V', 'G', 'M', \ | |
| 196 '+', 'V', 'G', 'S', \ | |
| 197 '\xFF'}; | |
| 198 | |
| 199 /* Binary related codes. */ | |
| 200 typedef enum | |
| 201 { | |
| 202 ATP_ATA_NB = (0x00000000), | |
| 203 ATP_ATD_NB, | |
| 204 ATP_ATE_NB, | |
| 205 ATP_ATH_NB, | |
| 206 ATP_ATI_NB, | |
| 207 ATP_ATL_NB, | |
| 208 ATP_ATM_NB, | |
| 209 ATP_ATO_NB, | |
| 210 ATP_ATP_NB, | |
| 211 ATP_ATQ_NB, | |
| 212 ATP_ATS0_NB, | |
| 213 ATP_ATS10_NB, | |
| 214 ATP_ATS3_NB, | |
| 215 ATP_ATS4_NB, | |
| 216 ATP_ATS5_NB, | |
| 217 ATP_ATS6_NB, | |
| 218 ATP_ATS7_NB, | |
| 219 ATP_ATS8_NB, | |
| 220 ATP_ATT_NB, | |
| 221 ATP_ATV_NB, | |
| 222 ATP_ATX_NB, | |
| 223 ATP_ATZ_NB, | |
| 224 ATP_AT_AND_C_NB, | |
| 225 ATP_AT_AND_D_NB, | |
| 226 ATP_AT_AND_F_NB, | |
| 227 ATP_AT_PLUS_CKPD_NB, | |
| 228 ATP_AT_PLUS_FDR_NB, | |
| 229 ATP_AT_PLUS_FDT_NB, | |
| 230 ATP_AT_PLUS_FKS_NB, | |
| 231 ATP_AT_PLUS_GMI_NB, | |
| 232 ATP_AT_PLUS_GMM_NB, | |
| 233 ATP_AT_PLUS_GMR_NB, | |
| 234 ATP_AT_PLUS_GCAP_NB, | |
| 235 ATP_AT_PLUS_VGM_NB, | |
| 236 ATP_AT_PLUS_VGS_NB, | |
| 237 ATP_MAX_NB_OF_AT_COMMANDS | |
| 238 } T_ATP_BINARY_AT_COMMANDS; | |
| 239 | |
| 240 /* Related offsets. */ | |
| 241 #define ATP_ATA_OFFSET (0x00) | |
| 242 #define ATP_ATD_OFFSET (ATP_ATA_OFFSET + 0x01) | |
| 243 #define ATP_ATE_OFFSET (ATP_ATD_OFFSET + 0x01) | |
| 244 #define ATP_ATH_OFFSET (ATP_ATE_OFFSET + 0x01) | |
| 245 #define ATP_ATI_OFFSET (ATP_ATH_OFFSET + 0x01) | |
| 246 #define ATP_ATL_OFFSET (ATP_ATI_OFFSET + 0x01) | |
| 247 #define ATP_ATM_OFFSET (ATP_ATL_OFFSET + 0x01) | |
| 248 #define ATP_ATO_OFFSET (ATP_ATM_OFFSET + 0x01) | |
| 249 #define ATP_ATP_OFFSET (ATP_ATO_OFFSET + 0x01) | |
| 250 #define ATP_ATQ_OFFSET (ATP_ATP_OFFSET + 0x01) | |
| 251 #define ATP_ATS0_OFFSET (ATP_ATQ_OFFSET + 0x01) | |
| 252 #define ATP_ATS10_OFFSET (ATP_ATS0_OFFSET + 0x02) | |
| 253 #define ATP_ATS3_OFFSET (ATP_ATS10_OFFSET + 0x03) | |
| 254 #define ATP_ATS4_OFFSET (ATP_ATS3_OFFSET + 0x02) | |
| 255 #define ATP_ATS5_OFFSET (ATP_ATS4_OFFSET + 0x02) | |
| 256 #define ATP_ATS6_OFFSET (ATP_ATS5_OFFSET + 0x02) | |
| 257 #define ATP_ATS7_OFFSET (ATP_ATS6_OFFSET + 0x02) | |
| 258 #define ATP_ATS8_OFFSET (ATP_ATS7_OFFSET + 0x02) | |
| 259 #define ATP_ATT_OFFSET (ATP_ATS8_OFFSET + 0x02) | |
| 260 #define ATP_ATV_OFFSET (ATP_ATT_OFFSET + 0x01) | |
| 261 #define ATP_ATX_OFFSET (ATP_ATV_OFFSET + 0x01) | |
| 262 #define ATP_ATZ_OFFSET (ATP_ATX_OFFSET + 0x01) | |
| 263 #define ATP_AT_AND_C_OFFSET (ATP_ATZ_OFFSET + 0x01) | |
| 264 #define ATP_AT_AND_D_OFFSET (ATP_AT_AND_C_OFFSET + 0x02) | |
| 265 #define ATP_AT_AND_F_OFFSET (ATP_AT_AND_D_OFFSET + 0x02) | |
| 266 #define ATP_AT_PLUS_CKPD_OFFSET (ATP_AT_AND_F_OFFSET + 0x02) | |
| 267 #define ATP_AT_PLUS_FDR_OFFSET (ATP_AT_PLUS_CKPD_OFFSET + 0x05) | |
| 268 #define ATP_AT_PLUS_FDT_OFFSET (ATP_AT_PLUS_FDR_OFFSET + 0x04) | |
| 269 #define ATP_AT_PLUS_FKS_OFFSET (ATP_AT_PLUS_FDT_OFFSET + 0x04) | |
| 270 #define ATP_AT_PLUS_GMI_OFFSET (ATP_AT_PLUS_FKS_OFFSET + 0x04) | |
| 271 #define ATP_AT_PLUS_GMM_OFFSET (ATP_AT_PLUS_GMI_OFFSET + 0x04) | |
| 272 #define ATP_AT_PLUS_GMR_OFFSET (ATP_AT_PLUS_GMM_OFFSET + 0x04) | |
| 273 #define ATP_AT_PLUS_GCAP_OFFSET (ATP_AT_PLUS_GMR_OFFSET + 0x04) | |
| 274 #define ATP_AT_PLUS_VGM_OFFSET (ATP_AT_PLUS_GCAP_OFFSET + 0x05) | |
| 275 #define ATP_AT_PLUS_VGS_OFFSET (ATP_AT_PLUS_VGM_OFFSET + 0x04) | |
| 276 #define ATP_AT_LAST_OFFSET (ATP_AT_PLUS_VGS_OFFSET + 0x04) | |
| 277 | |
| 278 /* Related structures. */ | |
| 279 typedef enum | |
| 280 { | |
| 281 ATP_CMD_NOT_DEFINED = (0x00000000), | |
| 282 ATP_NO_PARAM, | |
| 283 ATP_BASIC_PARAM, | |
| 284 ATP_DIAL_PARAM, | |
| 285 ATP_S_PARAM, | |
| 286 ATP_NO_EXTENDED_PARAM, | |
| 287 ATP_SINGLE_EXTENDED_PARAM, | |
| 288 ATP_PLUS_CKPD_PARAM | |
| 289 } T_ATP_CMD_FORMAT; | |
| 290 | |
| 291 #define ATP_ATA_PARAM (ATP_NO_PARAM) | |
| 292 #define ATP_ATD_PARAM (ATP_DIAL_PARAM) | |
| 293 #define ATP_ATE_PARAM (ATP_BASIC_PARAM) | |
| 294 #define ATP_ATH_PARAM (ATP_BASIC_PARAM) | |
| 295 #define ATP_ATI_PARAM (ATP_BASIC_PARAM) | |
| 296 #define ATP_ATL_PARAM (ATP_BASIC_PARAM) | |
| 297 #define ATP_ATM_PARAM (ATP_BASIC_PARAM) | |
| 298 #define ATP_ATO_PARAM (ATP_BASIC_PARAM) | |
| 299 #define ATP_ATP_PARAM (ATP_NO_PARAM) | |
| 300 #define ATP_ATQ_PARAM (ATP_BASIC_PARAM) | |
| 301 #define ATP_ATS0_PARAM (ATP_S_PARAM) | |
| 302 #define ATP_ATS10_PARAM (ATP_S_PARAM) | |
| 303 #define ATP_ATS3_PARAM (ATP_S_PARAM) | |
| 304 #define ATP_ATS4_PARAM (ATP_S_PARAM) | |
| 305 #define ATP_ATS5_PARAM (ATP_S_PARAM) | |
| 306 #define ATP_ATS6_PARAM (ATP_S_PARAM) | |
| 307 #define ATP_ATS7_PARAM (ATP_S_PARAM) | |
| 308 #define ATP_ATS8_PARAM (ATP_S_PARAM) | |
| 309 #define ATP_ATT_PARAM (ATP_NO_PARAM) | |
| 310 #define ATP_ATV_PARAM (ATP_BASIC_PARAM) | |
| 311 #define ATP_ATX_PARAM (ATP_BASIC_PARAM) | |
| 312 #define ATP_ATZ_PARAM (ATP_BASIC_PARAM) | |
| 313 #define ATP_AT_AND_C_PARAM (ATP_BASIC_PARAM) | |
| 314 #define ATP_AT_AND_D_PARAM (ATP_BASIC_PARAM) | |
| 315 #define ATP_AT_AND_F_PARAM (ATP_BASIC_PARAM) | |
| 316 #define ATP_AT_PLUS_CKPD_PARAM (ATP_PLUS_CKPD_PARAM) | |
| 317 #define ATP_AT_PLUS_FDR_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 318 #define ATP_AT_PLUS_FDT_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 319 #define ATP_AT_PLUS_FKS_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 320 #define ATP_AT_PLUS_GMI_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 321 #define ATP_AT_PLUS_GMM_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 322 #define ATP_AT_PLUS_GMR_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 323 #define ATP_AT_PLUS_GCAP_PARAM (ATP_NO_EXTENDED_PARAM) | |
| 324 #define ATP_AT_PLUS_VGM_PARAM (ATP_SINGLE_EXTENDED_PARAM) | |
| 325 #define ATP_AT_PLUS_VGS_PARAM (ATP_SINGLE_EXTENDED_PARAM) | |
| 326 | |
| 327 #define ATP_AT_OFFSET_COLUMN (0x00) | |
| 328 #define ATP_AT_PARAM_COLUMN (0x01) | |
| 329 | |
| 330 static const UINT8 ATP_AT_INFO[ATP_MAX_NB_OF_AT_COMMANDS + 0x01][0x02] \ | |
| 331 = {{ATP_ATA_OFFSET, ATP_ATA_PARAM}, \ | |
| 332 {ATP_ATD_OFFSET, ATP_ATD_PARAM}, \ | |
| 333 {ATP_ATE_OFFSET, ATP_ATE_PARAM}, \ | |
| 334 {ATP_ATH_OFFSET, ATP_ATH_PARAM}, \ | |
| 335 {ATP_ATI_OFFSET, ATP_ATI_PARAM}, \ | |
| 336 {ATP_ATL_OFFSET, ATP_ATL_PARAM}, \ | |
| 337 {ATP_ATM_OFFSET, ATP_ATM_PARAM}, \ | |
| 338 {ATP_ATO_OFFSET, ATP_ATO_PARAM}, \ | |
| 339 {ATP_ATP_OFFSET, ATP_ATP_PARAM}, \ | |
| 340 {ATP_ATQ_OFFSET, ATP_ATQ_PARAM}, \ | |
| 341 {ATP_ATS0_OFFSET, ATP_ATS0_PARAM}, \ | |
| 342 {ATP_ATS10_OFFSET, ATP_ATS10_PARAM}, \ | |
| 343 {ATP_ATS3_OFFSET, ATP_ATS3_PARAM}, \ | |
| 344 {ATP_ATS4_OFFSET, ATP_ATS4_PARAM}, \ | |
| 345 {ATP_ATS5_OFFSET, ATP_ATS5_PARAM}, \ | |
| 346 {ATP_ATS6_OFFSET, ATP_ATS6_PARAM}, \ | |
| 347 {ATP_ATS7_OFFSET, ATP_ATS7_PARAM}, \ | |
| 348 {ATP_ATS8_OFFSET, ATP_ATS8_PARAM}, \ | |
| 349 {ATP_ATT_OFFSET, ATP_ATT_PARAM}, \ | |
| 350 {ATP_ATV_OFFSET, ATP_ATV_PARAM}, \ | |
| 351 {ATP_ATX_OFFSET, ATP_ATX_PARAM}, \ | |
| 352 {ATP_ATZ_OFFSET, ATP_ATZ_PARAM}, \ | |
| 353 {ATP_AT_AND_C_OFFSET, ATP_AT_AND_C_PARAM}, \ | |
| 354 {ATP_AT_AND_D_OFFSET, ATP_AT_AND_D_PARAM}, \ | |
| 355 {ATP_AT_AND_F_OFFSET, ATP_AT_AND_F_PARAM}, \ | |
| 356 {ATP_AT_PLUS_CKPD_OFFSET, ATP_AT_PLUS_CKPD_PARAM}, \ | |
| 357 {ATP_AT_PLUS_FDR_OFFSET, ATP_AT_PLUS_FDR_PARAM}, \ | |
| 358 {ATP_AT_PLUS_FDT_OFFSET, ATP_AT_PLUS_FDT_PARAM}, \ | |
| 359 {ATP_AT_PLUS_FKS_OFFSET, ATP_AT_PLUS_FKS_PARAM}, \ | |
| 360 {ATP_AT_PLUS_GMI_OFFSET, ATP_AT_PLUS_GMI_PARAM}, \ | |
| 361 {ATP_AT_PLUS_GMM_OFFSET, ATP_AT_PLUS_GMM_PARAM}, \ | |
| 362 {ATP_AT_PLUS_GMR_OFFSET, ATP_AT_PLUS_GMR_PARAM}, \ | |
| 363 {ATP_AT_PLUS_GCAP_OFFSET, ATP_AT_PLUS_GCAP_PARAM}, \ | |
| 364 {ATP_AT_PLUS_VGM_OFFSET, ATP_AT_PLUS_VGM_PARAM}, \ | |
| 365 {ATP_AT_PLUS_VGS_OFFSET, ATP_AT_PLUS_VGS_PARAM}, \ | |
| 366 {ATP_AT_LAST_OFFSET, ATP_CMD_NOT_DEFINED}}; | |
| 367 | |
| 368 /* Define the maximum length (text format) of <numbers> appearing in basic */ | |
| 369 /* syntax commands. */ | |
| 370 /* - <number> (up to 65535). */ | |
| 371 #define MAX_BASIC_CMD_PARAM_LEN (0x05) | |
| 372 | |
| 373 /* Define the structure associated with basic syntax commands (except for the */ | |
| 374 /* D and S commands). The format of such commands is <command>[<number>], where */ | |
| 375 /* <number> may be a string of one or more characters from "0" through "9" */ | |
| 376 /* representing the decimal integer value (See ITU-T Recommendation V.250 ter */ | |
| 377 /* page 5). */ | |
| 378 typedef struct | |
| 379 { | |
| 380 UINT16 number; | |
| 381 } T_ATP_BASIC_CMD; | |
| 382 | |
| 383 /* Define all basic syntax commands do not expext any <number>. */ | |
| 384 /* __________________________________________________________________________ */ | |
| 385 /* | | | | | */ | |
| 386 /* | Binary code | Len | Command | Description | */ | |
| 387 /* |___________________|_____|_________|______________________________________| */ | |
| 388 /* | | | | | */ | |
| 389 /* | ATP_ATA_NB | 1 | ATA | Answer. | */ | |
| 390 /* | ATP_ATP_NB | 1 | ATP | Select pulse dialling. | */ | |
| 391 /* | ATP_ATT_NB | 1 | ATT | Select tone dialling. | */ | |
| 392 /* |___________________|_____|_________|______________________________________| */ | |
| 393 /* */ | |
| 394 /* Define all other basic syntax commands. */ | |
| 395 /* __________________________________________________________________________ */ | |
| 396 /* | | | | | */ | |
| 397 /* | Binary code | Len | Command | Description | */ | |
| 398 /* |___________________|_____|_________|______________________________________| */ | |
| 399 /* | | | | | */ | |
| 400 /* | ATP_ATE_NB | 1 | ATE | Command echo. | */ | |
| 401 /* | ATP_ATH_NB | 1 | ATH | Hook control. | */ | |
| 402 /* | ATP_ATI_NB | 1 | ATI | Request Identification Information | */ | |
| 403 /* | ATP_ATL_NB | 1 | ATL | Monitor speaker loudness. | */ | |
| 404 /* | ATP_ATM_NB | 1 | ATM | Monitor speaker mode. | */ | |
| 405 /* | ATP_ATO_NB | 1 | ATO | Return to online data state. | */ | |
| 406 /* | ATP_ATQ_NB | 1 | ATQ | Result code suppression. | */ | |
| 407 /* | ATP_ATV_NB | 1 | ATV | DCE response format. | */ | |
| 408 /* | ATP_ATX_NB | 1 | ATX | Result code selection and call | */ | |
| 409 /* | | | | progress monitoring control. | */ | |
| 410 /* | ATP_ATZ_NB | 1 | ATZ | Reset to default configuration. | */ | |
| 411 /* | ATP_AT_AND_C_NB | 2 | AT&C | Circuit 109 (received line signal | */ | |
| 412 /* | | | | detector) behavior. | */ | |
| 413 /* | ATP_AT_AND_D_NB | 2 | AT&D | Circuit 108 (data terminal ready) | */ | |
| 414 /* | | | | behavior. | */ | |
| 415 /* | ATP_AT_AND_F_NB | 2 | AT&F | Set to factory defined | */ | |
| 416 /* | | | | configuration. | */ | |
| 417 /* |___________________|_____|_________|______________________________________| */ | |
| 418 typedef T_ATP_BASIC_CMD T_ATP_ATE_PARAM; | |
| 419 typedef T_ATP_BASIC_CMD T_ATP_ATH_PARAM; | |
| 420 typedef T_ATP_BASIC_CMD T_ATP_ATI_PARAM; | |
| 421 typedef T_ATP_BASIC_CMD T_ATP_ATL_PARAM; | |
| 422 typedef T_ATP_BASIC_CMD T_ATP_ATM_PARAM; | |
| 423 typedef T_ATP_BASIC_CMD T_ATP_ATO_PARAM; | |
| 424 typedef T_ATP_BASIC_CMD T_ATP_ATQ_PARAM; | |
| 425 typedef T_ATP_BASIC_CMD T_ATP_ATV_PARAM; | |
| 426 typedef T_ATP_BASIC_CMD T_ATP_ATX_PARAM; | |
| 427 typedef T_ATP_BASIC_CMD T_ATP_ATZ_PARAM; | |
| 428 typedef T_ATP_BASIC_CMD T_ATP_AT_AND_C_PARAM; | |
| 429 typedef T_ATP_BASIC_CMD T_ATP_AT_AND_D_PARAM; | |
| 430 typedef T_ATP_BASIC_CMD T_ATP_AT_AND_F_PARAM; | |
| 431 | |
| 432 /* Define the maximum number of characters appearing in the <dial_string>. */ | |
| 433 #define MAX_DIAL_STRING_LEN (30) | |
| 434 | |
| 435 /* Define the structure associated with "Dial" command whose format is */ | |
| 436 /* D[<dial_string>][;] (See ITU-T Recommendation V.250 ter page 31). Note that */ | |
| 437 /* all characters appearing on the same command line after D are considered */ | |
| 438 /* part of the call addressing information to be signalled to the network, or */ | |
| 439 /* modifiers used to control the signalling process, up to a semicolon */ | |
| 440 /* character or the end of the command line. If the <dial_string> is terminated */ | |
| 441 /* by a semicolon, the DCE does not start the call origination procedure, but */ | |
| 442 /* instead returns to command state after completion of the signalling of call */ | |
| 443 /* addressing information to the network. */ | |
| 444 typedef struct | |
| 445 { | |
| 446 char dial_string_p[MAX_DIAL_STRING_LEN]; | |
| 447 UINT8 dial_string_length; | |
| 448 enum | |
| 449 { | |
| 450 DATA_CALL = 0x00000000, | |
| 451 VOICE_CALL | |
| 452 } call_type; | |
| 453 } T_ATP_DIAL; | |
| 454 | |
| 455 /* Define all dial commands. */ | |
| 456 /* __________________________________________________________________________ */ | |
| 457 /* | | | | | */ | |
| 458 /* | Binary code | Len | Command | Description | */ | |
| 459 /* |___________________|_____|_________|______________________________________| */ | |
| 460 /* | | | | | */ | |
| 461 /* | ATP_ATD_NB | 1 | ATD | Dial. | */ | |
| 462 /* |___________________|_____|_________|______________________________________| */ | |
| 463 typedef T_ATP_DIAL T_ATP_ATD_PARAM; | |
| 464 | |
| 465 /* Define the maximum length (text format) of <values> appearing in */ | |
| 466 /* S-parameters. */ | |
| 467 /* - '=' + <value> (up to 65535). */ | |
| 468 #define MAX_S_PARAM_LEN (0x06) | |
| 469 | |
| 470 /* Define the structure associated with S-parameters. Formats of such commands */ | |
| 471 /* are S<parameter_number>? and S<parameter_number>=[<value>], where <value> */ | |
| 472 /* shall consist of a decimal constant (See ITU-T Recommendation V.250 ter */ | |
| 473 /* pages 5 and 6). */ | |
| 474 typedef struct | |
| 475 { | |
| 476 enum | |
| 477 { | |
| 478 READ_S_PARAM = 0x00000001, | |
| 479 SET_S_PARAM | |
| 480 } s_operator; | |
| 481 UINT16 value; | |
| 482 } T_ATP_S_PARAM; | |
| 483 | |
| 484 /* Define all S-parameters. */ | |
| 485 /* __________________________________________________________________________ */ | |
| 486 /* | | | | | */ | |
| 487 /* | Binary code | Len | Command | Description | */ | |
| 488 /* |___________________|_____|_________|______________________________________| */ | |
| 489 /* | | | | | */ | |
| 490 /* | ATP_ATS0_NB | 2 | ATS0 | Automatic answer. | */ | |
| 491 /* | ATP_ATS10_NB | 3 | ATS10 | Automatic disconnect delay. | */ | |
| 492 /* | ATP_ATS3_NB | 2 | ATS3 | Command line termination character. | */ | |
| 493 /* | ATP_ATS4_NB | 2 | ATS4 | Response formatting character. | */ | |
| 494 /* | ATP_ATS5_NB | 2 | ATS5 | Command line editing character. | */ | |
| 495 /* | ATP_ATS6_NB | 2 | ATS6 | Pause before blind dialling. | */ | |
| 496 /* | ATP_ATS7_NB | 2 | ATS7 | Connection completion timeout. | */ | |
| 497 /* | ATP_ATS8_NB | 2 | ATS8 | Comma dial modifier time. | */ | |
| 498 /* |___________________|_____|_________|______________________________________| */ | |
| 499 typedef T_ATP_S_PARAM T_ATP_ATS0_PARAM; | |
| 500 typedef T_ATP_S_PARAM T_ATP_ATS10_PARAM; | |
| 501 typedef T_ATP_S_PARAM T_ATP_ATS3_PARAM; | |
| 502 typedef T_ATP_S_PARAM T_ATP_ATS4_PARAM; | |
| 503 typedef T_ATP_S_PARAM T_ATP_ATS5_PARAM; | |
| 504 typedef T_ATP_S_PARAM T_ATP_ATS6_PARAM; | |
| 505 typedef T_ATP_S_PARAM T_ATP_ATS7_PARAM; | |
| 506 typedef T_ATP_S_PARAM T_ATP_ATS8_PARAM; | |
| 507 | |
| 508 /* Define operators dedicated to extended syntax commands. "=" is used to set */ | |
| 509 /* the indicated extended syntax command to a new value (See ITU-T */ | |
| 510 /* Recommendation V.250 ter page 8). Note that if no value is given, the */ | |
| 511 /* extended syntax command specified may be set to 0. "?" is used to read the */ | |
| 512 /* current value of the indicated extended syntax command (See ITU-T */ | |
| 513 /* Recommendation V.250 ter page 9). "=?" is used to test whether the extended */ | |
| 514 /* syntax command is implemented in the DCE. */ | |
| 515 typedef enum | |
| 516 { | |
| 517 NO_SUBPARAMETER = 0x00000000, | |
| 518 READ_EXTENDED_CMD, | |
| 519 SET_EXTENDED_CMD, | |
| 520 TEST_EXTENDED_CMD | |
| 521 } T_ATP_EXTENDED_OPERATOR; | |
| 522 | |
| 523 /* Define the maximum length (text format) of extended syntax commands that */ | |
| 524 /* have no subparameter. */ | |
| 525 /* - '=?'. */ | |
| 526 #define MAX_NO_SUBPARAMETER_LEN (0x02) | |
| 527 | |
| 528 /* Define the structure associated with extended syntax commands that have no */ | |
| 529 /* subparameter. Formats of such commands are +<name> and +<name>=?, where */ | |
| 530 /* <name> may be a string of one or sixteen characters selected from the */ | |
| 531 /* following set (See ITU-T Recommendation V.250 ter page 6): */ | |
| 532 /* "A" through "Z", */ | |
| 533 /* "0" through "9", */ | |
| 534 /* "!", "%", "-", ".", "/", ":" and "_". */ | |
| 535 typedef struct | |
| 536 { | |
| 537 T_ATP_EXTENDED_OPERATOR extended_operator; | |
| 538 } T_ATP_NO_SUBPARAMETER; | |
| 539 | |
| 540 /* Define all extended syntax commands do not expext any <value>. */ | |
| 541 /* __________________________________________________________________________ */ | |
| 542 /* | | | | | */ | |
| 543 /* | Binary code | Len | Command | Description | */ | |
| 544 /* |___________________|_____|_________|______________________________________| */ | |
| 545 /* | | | | | */ | |
| 546 /* |ATP_AT_PLUS_FDR_NB | 4 | AT+FDR | Receive a page. | */ | |
| 547 /* |ATP_AT_PLUS_FDT_NB | 4 | AT+FDT | Send a page. | */ | |
| 548 /* |ATP_AT_PLUS_FKS_NB | 4 | AT+FKS | Session termination. | */ | |
| 549 /* |ATP_AT_PLUS_GMI_NB | 4 | AT+GMI | Request manufacturer identification. | */ | |
| 550 /* |ATP_AT_PLUS_GMM_NB | 4 | AT+GMM | Request model identification. | */ | |
| 551 /* |ATP_AT_PLUS_GMR_NB | 4 | AT+GMR | Request revision identification. | */ | |
| 552 /* |ATP_AT_PLUS_GCAP_NB| 5 | AT+GCAP | Request complete capabilities list. | */ | |
| 553 /* |___________________|_____|_________|______________________________________| */ | |
| 554 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_FDR_PARAM; | |
| 555 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_FDT_PARAM; | |
| 556 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_FKS_PARAM; | |
| 557 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_GMI_PARAM; | |
| 558 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_GMM_PARAM; | |
| 559 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_GMR_PARAM; | |
| 560 typedef T_ATP_NO_SUBPARAMETER T_ATP_AT_PLUS_GCAP_PARAM; | |
| 561 | |
| 562 /* Define the maximum length (text format) of <values> appearing in extended */ | |
| 563 /* syntax commands whose subparameter is a numeric constant. */ | |
| 564 /* - '=' + <value> (up to 65535). */ | |
| 565 #define MAX_SINGLE_SUBPARAMETER_LEN (0x06) | |
| 566 | |
| 567 /* Define the structure associated with extended syntax commands whose */ | |
| 568 /* subparameter is a numeric constant. Formats of such commands are +<name>?, */ | |
| 569 /* +<name>[=<value>] and and +<name>=?, where <name> may be a string of one or */ | |
| 570 /* sixteen characters selected from the following set (See ITU-T Recommendation */ | |
| 571 /* V.250 ter page 6): */ | |
| 572 /* "A" through "Z", */ | |
| 573 /* "0" through "9", */ | |
| 574 /* "!", "%", "-", ".", "/", ":" and "_". */ | |
| 575 /* */ | |
| 576 /* <value> shall consist of a numeric constant (See ITU-T Recommendation V.250 */ | |
| 577 /* ter page 6). */ | |
| 578 /* Some additional commands may follow an extended syntax command on the same */ | |
| 579 /* command line if a semicolon is inserted after the preceding extended command */ | |
| 580 /* as a separator. The semicolon is not necessary when the extended syntax */ | |
| 581 /* command is the last command on the command line (See ITU-T Recommendation */ | |
| 582 /* V.250 ter page 9). Besides, extended syntax commands may appear on the same */ | |
| 583 /* command line after a basic syntax command without a separator, in the same */ | |
| 584 /* manner as concatenation of basic syntax commands. */ | |
| 585 typedef struct | |
| 586 { | |
| 587 T_ATP_EXTENDED_OPERATOR extended_operator; | |
| 588 UINT16 value; | |
| 589 } T_ATP_SINGLE_SUBPARAMETER; | |
| 590 | |
| 591 /* Define all extended syntax commands whose subparameter is a numeric */ | |
| 592 /* constant. */ | |
| 593 /* __________________________________________________________________________ */ | |
| 594 /* | | | | | */ | |
| 595 /* | Binary code | Len | Command | Description | */ | |
| 596 /* |___________________|_____|_________|______________________________________| */ | |
| 597 /* | | | | meaning in the headset profile. | */ | |
| 598 /* |ATP_AT_PLUS_VGM_NB | 4 | AT+VGM | Command issued by the HS to report | */ | |
| 599 /* | | | | the current microphone gain level | */ | |
| 600 /* | | | | setting to the AG (See Headset | */ | |
| 601 /* | | | | Specification, Section 4.7.3). | */ | |
| 602 /* |ATP_AT_PLUS_VGS_NB | 4 | AT+VGS | Command issued by the HS to report | */ | |
| 603 /* | | | | the current speaker gain level | */ | |
| 604 /* | | | | setting to the AG (See Headset | */ | |
| 605 /* | | | | Specification, Section 4.7.3). | */ | |
| 606 /* |___________________|_____|_________|______________________________________| */ | |
| 607 typedef T_ATP_SINGLE_SUBPARAMETER T_ATP_AT_PLUS_VGM_PARAM; | |
| 608 typedef T_ATP_SINGLE_SUBPARAMETER T_ATP_AT_PLUS_VGS_PARAM; | |
| 609 | |
| 610 /* Define the maximum number of keys appearing in the <keys>. */ | |
| 611 #define MAX_NB_OF_KEYS (5) | |
| 612 | |
| 613 /* Define the maximum length (text format) of the <compound_value> appearing in */ | |
| 614 /* keypad control commands. */ | |
| 615 /* - "=" + """ + MAX_NB_OF_KEYS * [";" + <keys> (up to 65535) + ";"] + """ + */ | |
| 616 /* + "," + <time> (up to 65535) */ | |
| 617 /* + "," + <pause> (up to 65535). */ | |
| 618 #define MAX_CKPD_PARAM_LEN (0x0F + MAX_NB_OF_KEYS * 0x07) | |
| 619 | |
| 620 /* Define the structure associated with the extended syntax command +CKPD. */ | |
| 621 /* Formats of such command are +<name>=<keys>[,<time>[,<pause>]] and +<name>=?, */ | |
| 622 /* where <name> may be a string of one or sixteen characters selected from the */ | |
| 623 /* following set (See ITU-T Recommendation V.250 ter page 6): */ | |
| 624 /* "A" through "Z", */ | |
| 625 /* "0" through "9", */ | |
| 626 /* "!", "%", "-", ".", "/", ":" and "_". */ | |
| 627 /* */ | |
| 628 /* <keys> shall consist of a string constant (See ETS 300 916 (GSM 07.07) */ | |
| 629 /* Version 5.8.1 page 62). */ | |
| 630 /* <time> and <pause> shall consist of numeric constants in tenths of a second */ | |
| 631 /* (See ETS 300 916 (GSM 07.07) Version 5.8.1 page 62). */ | |
| 632 /* Some additional commands may follow an extended syntax command on the same */ | |
| 633 /* command line if a semicolon is inserted after the preceding extended command */ | |
| 634 /* as a separator. The semicolon is not necessary when the extended syntax */ | |
| 635 /* command is the last command on the command line (See ITU-T Recommendation */ | |
| 636 /* V.250 ter page 9). Besides, extended syntax commands may appear on the same */ | |
| 637 /* command line after a basic syntax command without a separator, in the same */ | |
| 638 /* manner as concatenation of basic syntax commands. */ | |
| 639 typedef struct | |
| 640 { | |
| 641 T_ATP_EXTENDED_OPERATOR extended_operator; | |
| 642 UINT16 keys[MAX_NB_OF_KEYS]; | |
| 643 UINT8 nb_keys; | |
| 644 UINT16 time; | |
| 645 UINT16 pause; | |
| 646 } T_ATP_PLUS_CKPD; | |
| 647 | |
| 648 /* Define all extended syntax commands. */ | |
| 649 /* __________________________________________________________________________ */ | |
| 650 /* | | | | | */ | |
| 651 /* | Binary code | Len | Command | Description | */ | |
| 652 /* |___________________|_____|_________|______________________________________| */ | |
| 653 /* | | | | | */ | |
| 654 /* |ATP_AT_PLUS_CKPD_NB| 5 | AT+CKPD | Keypad control command (See GSM TS | */ | |
| 655 /* | | | | 07.07, Section 8.7). For <keys>, the | */ | |
| 656 /* | | | | value of 200 indicates the button on | */ | |
| 657 /* | | | | the headset being pushed. The <time> | */ | |
| 658 /* | | | | and <pause> parameters have no | */ | |
| 659 /* | | | | meaning in the headset profile. | */ | |
| 660 /* |___________________|_____|_________|______________________________________| */ | |
| 661 typedef T_ATP_PLUS_CKPD T_ATP_AT_PLUS_CKPD_PARAM; | |
| 662 | |
| 663 /* Define the default time value. */ | |
| 664 #define DEFAULT_TIME (0x0000) | |
| 665 | |
| 666 /* Define an unspecified time value. */ | |
| 667 #define TIME_DO_NOT_CARE (0x0000) | |
| 668 | |
| 669 /* Define the default pause value. */ | |
| 670 #define DEFAULT_PAUSE (0x0000) | |
| 671 | |
| 672 /* Define an unspecified pause value. */ | |
| 673 #define PAUSE_DO_NOT_CARE (0x0000) | |
| 674 | |
| 675 | |
| 676 /********************************* RESULT CODES *********************************/ | |
| 677 /* */ | |
| 678 /* Define all supported result codes. */ | |
| 679 /* */ | |
| 680 /* __________________________________________________________________________ */ | |
| 681 /* | | | | | | */ | |
| 682 /* | Binary code | Len | Result code | Numeric | Description | */ | |
| 683 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 684 /* | | | | | | */ | |
| 685 /* | ATP_OK_NB | 2 | OK | 0 | Acknoledges | */ | |
| 686 /* | | | | | execution of a | */ | |
| 687 /* | | | | | command. | */ | |
| 688 /* | ATP_CONNECT_NB | 7 | CONNECT | 1 | A connection has | */ | |
| 689 /* | | | | | been established. | */ | |
| 690 /* | ATP_RING_NB | 4 | RING | 2 | Incoming call | */ | |
| 691 /* | | | | | detected. | */ | |
| 692 /* | ATP_NO_CARRIER_NB | 10 | NO CARRIER | 3 | The connection has | */ | |
| 693 /* | | | | | been terminated or | */ | |
| 694 /* | | | | | the attempt to | */ | |
| 695 /* | | | | | establish a | */ | |
| 696 /* | | | | | connection failed. | */ | |
| 697 /* | ATP_ERROR_NB | 5 | ERROR | 4 | Problem with | */ | |
| 698 /* | | | | | processing the | */ | |
| 699 /* | | | | | command line. | */ | |
| 700 /* | ATP_NO_DIALTONE_NB | 11 | NO DIALTONE | 6 | No dial tone | */ | |
| 701 /* | | | | | detected. | */ | |
| 702 /* | ATP_BUSY_NB | 4 | BUSY | 7 | Busy signal | */ | |
| 703 /* | | | | | detected. | */ | |
| 704 /* | ATP_NO_ANSWER_NB | 9 | NO ANSWER | 8 | '@' dial modifier | */ | |
| 705 /* | | | | | was used, but remote | */ | |
| 706 /* | | | | | ringing followed by | */ | |
| 707 /* | | | | | 5 seconds of silence | */ | |
| 708 /* | | | | | was not detected | */ | |
| 709 /* | | | | | before expiration of | */ | |
| 710 /* | | | | | the connection | */ | |
| 711 /* | | | | | timer. | */ | |
| 712 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 713 /* | | | | | | */ | |
| 714 /* | ATP_CONNECT_TXT_NB | 7 | CONNECT | X | A connection has | */ | |
| 715 /* | | | | | been established. | */ | |
| 716 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 717 /* | | | | | | */ | |
| 718 /* | ATP_PLUS_VGM_NB | 4 | +VGM | X | Unsolicited result | */ | |
| 719 /* | | | | | code issued by the | */ | |
| 720 /* | | | | | AG to set the | */ | |
| 721 /* | | | | | microphone gain of | */ | |
| 722 /* | | | | | the HS (See Headset | */ | |
| 723 /* | | | | | Specification, | */ | |
| 724 /* | | | | | Section 4.7.3). | */ | |
| 725 /* | ATP_PLUS_VGS_NB | 4 | +VGS | X | Unsolicited result | */ | |
| 726 /* | | | | | code issued by the | */ | |
| 727 /* | | | | | AG to set the | */ | |
| 728 /* | | | | | speaker gain of the | */ | |
| 729 /* | | | | | HS (See Headset | */ | |
| 730 /* | | | | | Specification, | */ | |
| 731 /* | | | | | Section 4.7.3). | */ | |
| 732 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 733 /* | | | | | | */ | |
| 734 /* |ATP_PLUS_CME_ERROR_NB| 11 | +CME ERROR: | X | Final result code | */ | |
| 735 /* | | | | | similar to the | */ | |
| 736 /* | | | | | regular ERROR result | */ | |
| 737 /* | | | | | code (See GSM TS | */ | |
| 738 /* | | | | | 07.07, Section 9.2). | */ | |
| 739 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 740 /* | | | | | | */ | |
| 741 /* |ATP_PLUS_CMS_ERROR_NB| 11 | +CMS ERROR: | X | Final result code | */ | |
| 742 /* | | | | | that indicates an | */ | |
| 743 /* | | | | | error related to | */ | |
| 744 /* | | | | | mobile equipment or | */ | |
| 745 /* | | | | | network (See GSM TS | */ | |
| 746 /* | | | | | 07.05, Section | */ | |
| 747 /* | | | | | 3.2.5). | */ | |
| 748 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 749 /* */ | |
| 750 /* Define the length of <CR><LF> headers of information responses (See ETS 300 */ | |
| 751 /* 916 (GSM 07.07) Version 4.1 page 13). */ | |
| 752 #define ATP_RESULT_CODE_HEADER_LEN (0x02) | |
| 753 | |
| 754 /* Text codes for result codes (verbose responses disabled). */ | |
| 755 static const char ATP_RESULT_CODE_TXT_TABLE_V0[] = {'0', \ | |
| 756 '1', \ | |
| 757 '2', \ | |
| 758 '3', \ | |
| 759 '4', \ | |
| 760 '6', \ | |
| 761 '7', \ | |
| 762 '8', \ | |
| 763 'C', 'O', 'N', 'N', 'E', 'C', 'T', \ | |
| 764 '+', 'V', 'G', 'M', \ | |
| 765 '+', 'V', 'G', 'S', \ | |
| 766 '+', 'C', 'M', 'E', ' ', 'E', 'R', 'R', 'O', 'R', ':', \ | |
| 767 '+', 'C', 'M', 'S', ' ', 'E', 'R', 'R', 'O', 'R', ':', \ | |
| 768 '\xFF'}; | |
| 769 | |
| 770 /* Text codes for result codes (verbose responses enabled). */ | |
| 771 static const char ATP_RESULT_CODE_TXT_TABLE_V1[] = {'O', 'K', \ | |
| 772 'C', 'O', 'N', 'N', 'E', 'C', 'T', \ | |
| 773 'R', 'I', 'N', 'G', \ | |
| 774 'N', 'O', ' ', 'C', 'A', 'R', 'R', 'I', 'E', 'R', \ | |
| 775 'E', 'R', 'R', 'O', 'R', \ | |
| 776 'N', 'O', ' ', 'D', 'I', 'A', 'L', 'T', 'O', 'N', 'E', \ | |
| 777 'B', 'U', 'S', 'Y', \ | |
| 778 'N', 'O', ' ', 'A', 'N', 'S', 'W', 'E', 'R', \ | |
| 779 'C', 'O', 'N', 'N', 'E', 'C', 'T', \ | |
| 780 '+', 'V', 'G', 'M', \ | |
| 781 '+', 'V', 'G', 'S', \ | |
| 782 '+', 'C', 'M', 'E', ' ', 'E', 'R', 'R', 'O', 'R', ':', \ | |
| 783 '+', 'C', 'M', 'S', ' ', 'E', 'R', 'R', 'O', 'R', ':', \ | |
| 784 '\xFF'}; | |
| 785 | |
| 786 /* Binary related codes. */ | |
| 787 typedef enum | |
| 788 { | |
| 789 ATP_OK_NB = (0x00000000), | |
| 790 ATP_CONNECT_NB, | |
| 791 ATP_RING_NB, | |
| 792 ATP_NO_CARRIER_NB, | |
| 793 ATP_ERROR_NB, | |
| 794 ATP_NO_DIALTONE_NB = (0x00000006), | |
| 795 ATP_BUSY_NB, | |
| 796 ATP_NO_ANSWER_NB, | |
| 797 ATP_CONNECT_TXT_NB, | |
| 798 ATP_PLUS_VGM_NB, | |
| 799 ATP_PLUS_VGS_NB, | |
| 800 ATP_PLUS_CME_ERROR_NB, | |
| 801 ATP_PLUS_CMS_ERROR_NB, | |
| 802 ATP_MAX_NB_OF_RESULT_CODES | |
| 803 } T_ATP_BINARY_RESULT_CODES; | |
| 804 | |
| 805 /* Related offsets (verbose responses disabled). */ | |
| 806 #define ATP_OK_OFFSET_V0 (0x00) | |
| 807 #define ATP_CONNECT_OFFSET_V0 (ATP_OK_OFFSET_V0 + 0x01) | |
| 808 #define ATP_RING_OFFSET_V0 (ATP_CONNECT_OFFSET_V0 + 0x01) | |
| 809 #define ATP_NO_CARRIER_OFFSET_V0 (ATP_RING_OFFSET_V0 + 0x01) | |
| 810 #define ATP_ERROR_OFFSET_V0 (ATP_NO_CARRIER_OFFSET_V0 + 0x01) | |
| 811 #define ATP_NO_DIALTONE_OFFSET_V0 (ATP_ERROR_OFFSET_V0 + 0x01) | |
| 812 #define ATP_BUSY_OFFSET_V0 (ATP_NO_DIALTONE_OFFSET_V0 + 0x01) | |
| 813 #define ATP_NO_ANSWER_OFFSET_V0 (ATP_BUSY_OFFSET_V0 + 0x01) | |
| 814 #define ATP_CONNECT_TXT_OFFSET_V0 (ATP_NO_ANSWER_OFFSET_V0 + 0x01) | |
| 815 #define ATP_PLUS_VGM_OFFSET_V0 (ATP_CONNECT_TXT_OFFSET_V0 + 0x07) | |
| 816 #define ATP_PLUS_VGS_OFFSET_V0 (ATP_PLUS_VGM_OFFSET_V0 + 0x04) | |
| 817 #define ATP_PLUS_CME_ERROR_OFFSET_V0 (ATP_PLUS_VGS_OFFSET_V0 + 0x04) | |
| 818 #define ATP_PLUS_CMS_ERROR_OFFSET_V0 (ATP_PLUS_CME_ERROR_OFFSET_V0 + 0x0B) | |
| 819 #define ATP_RESULT_CODE_LAST_OFFSET_V0 (ATP_PLUS_CMS_ERROR_OFFSET_V0 + 0x0B) | |
| 820 | |
| 821 /* Related offsets (verbose responses enabled). */ | |
| 822 #define ATP_OK_OFFSET_V1 (0x00) | |
| 823 #define ATP_CONNECT_OFFSET_V1 (ATP_OK_OFFSET_V1 + 0x02) | |
| 824 #define ATP_RING_OFFSET_V1 (ATP_CONNECT_OFFSET_V1 + 0x07) | |
| 825 #define ATP_NO_CARRIER_OFFSET_V1 (ATP_RING_OFFSET_V1 + 0x04) | |
| 826 #define ATP_ERROR_OFFSET_V1 (ATP_NO_CARRIER_OFFSET_V1 + 0x0A) | |
| 827 #define ATP_NO_DIALTONE_OFFSET_V1 (ATP_ERROR_OFFSET_V1 + 0x05) | |
| 828 #define ATP_BUSY_OFFSET_V1 (ATP_NO_DIALTONE_OFFSET_V1 + 0x0B) | |
| 829 #define ATP_NO_ANSWER_OFFSET_V1 (ATP_BUSY_OFFSET_V1 + 0x04) | |
| 830 #define ATP_CONNECT_TXT_OFFSET_V1 (ATP_NO_ANSWER_OFFSET_V1 + 0x09) | |
| 831 #define ATP_PLUS_VGM_OFFSET_V1 (ATP_CONNECT_TXT_OFFSET_V1 + 0x07) | |
| 832 #define ATP_PLUS_VGS_OFFSET_V1 (ATP_PLUS_VGM_OFFSET_V1 + 0x04) | |
| 833 #define ATP_PLUS_CME_ERROR_OFFSET_V1 (ATP_PLUS_VGS_OFFSET_V1 + 0x04) | |
| 834 #define ATP_PLUS_CMS_ERROR_OFFSET_V1 (ATP_PLUS_CME_ERROR_OFFSET_V1 + 0x0B) | |
| 835 #define ATP_RESULT_CODE_LAST_OFFSET_V1 (ATP_PLUS_CMS_ERROR_OFFSET_V1 + 0x0B) | |
| 836 | |
| 837 /* Related structures. */ | |
| 838 typedef enum | |
| 839 { | |
| 840 ATP_RESULT_CODE_NOT_DEFINED = (0x00000000), | |
| 841 ATP_BASIC_RESULT_CODE, | |
| 842 ATP_EXTENDED_RESULT_CODE, | |
| 843 ATP_CONNECT_TXT_RESULT_CODE, | |
| 844 ATP_PLUS_ERROR_RESULT_CODE | |
| 845 } T_ATP_RESULT_CODE_FORMAT; | |
| 846 | |
| 847 #define ATP_OK_PARAM (ATP_BASIC_RESULT_CODE) | |
| 848 #define ATP_CONNECT_PARAM (ATP_BASIC_RESULT_CODE) | |
| 849 #define ATP_RING_PARAM (ATP_BASIC_RESULT_CODE) | |
| 850 #define ATP_NO_CARRIER_PARAM (ATP_BASIC_RESULT_CODE) | |
| 851 #define ATP_ERROR_PARAM (ATP_BASIC_RESULT_CODE) | |
| 852 #define ATP_NO_DIALTONE_PARAM (ATP_BASIC_RESULT_CODE) | |
| 853 #define ATP_BUSY_PARAM (ATP_BASIC_RESULT_CODE) | |
| 854 #define ATP_NO_ANSWER_PARAM (ATP_BASIC_RESULT_CODE) | |
| 855 #define ATP_CONNECT_TXT_PARAM (ATP_CONNECT_TXT_RESULT_CODE) | |
| 856 #define ATP_PLUS_VGM_PARAM (ATP_EXTENDED_RESULT_CODE) | |
| 857 #define ATP_PLUS_VGS_PARAM (ATP_EXTENDED_RESULT_CODE) | |
| 858 #define ATP_PLUS_CME_ERROR_PARAM (ATP_PLUS_ERROR_RESULT_CODE) | |
| 859 #define ATP_PLUS_CMS_ERROR_PARAM (ATP_PLUS_ERROR_RESULT_CODE) | |
| 860 | |
| 861 #define ATP_RESULT_OFFSET_V0_COLUMN (0x00) | |
| 862 #define ATP_RESULT_OFFSET_V1_COLUMN (0x01) | |
| 863 #define ATP_RESULT_PARAM_COLUMN (0x02) | |
| 864 | |
| 865 static const UINT8 ATP_RESULT_CODE_INFO[ATP_MAX_NB_OF_RESULT_CODES + 0x01][0x03] \ | |
| 866 = {{ATP_OK_OFFSET_V0, ATP_OK_OFFSET_V1, ATP_OK_PARAM}, \ | |
| 867 {ATP_CONNECT_OFFSET_V0, ATP_CONNECT_OFFSET_V1, ATP_CONNECT_PARAM}, \ | |
| 868 {ATP_RING_OFFSET_V0, ATP_RING_OFFSET_V1, ATP_RING_PARAM}, \ | |
| 869 {ATP_NO_CARRIER_OFFSET_V0, ATP_NO_CARRIER_OFFSET_V1, ATP_NO_CARRIER_PARAM}, \ | |
| 870 {ATP_ERROR_OFFSET_V0, ATP_ERROR_OFFSET_V1, ATP_ERROR_PARAM}, \ | |
| 871 {ATP_NO_DIALTONE_OFFSET_V0, ATP_NO_DIALTONE_OFFSET_V1, ATP_RESULT_CODE_NOT_DEFINED}, \ | |
| 872 {ATP_NO_DIALTONE_OFFSET_V0, ATP_NO_DIALTONE_OFFSET_V1, ATP_NO_DIALTONE_PARAM}, \ | |
| 873 {ATP_BUSY_OFFSET_V0, ATP_BUSY_OFFSET_V1, ATP_BUSY_PARAM}, \ | |
| 874 {ATP_NO_ANSWER_OFFSET_V0, ATP_NO_ANSWER_OFFSET_V1, ATP_NO_ANSWER_PARAM}, \ | |
| 875 {ATP_CONNECT_TXT_OFFSET_V0, ATP_CONNECT_TXT_OFFSET_V1, ATP_CONNECT_TXT_PARAM}, \ | |
| 876 {ATP_PLUS_VGM_OFFSET_V0, ATP_PLUS_VGM_OFFSET_V1, ATP_PLUS_VGM_PARAM}, \ | |
| 877 {ATP_PLUS_VGS_OFFSET_V0, ATP_PLUS_VGS_OFFSET_V1, ATP_PLUS_VGS_PARAM}, \ | |
| 878 {ATP_PLUS_CME_ERROR_OFFSET_V0, ATP_PLUS_CME_ERROR_OFFSET_V1, ATP_PLUS_CME_ERROR_PARAM}, \ | |
| 879 {ATP_PLUS_CMS_ERROR_OFFSET_V0, ATP_PLUS_CMS_ERROR_OFFSET_V1, ATP_PLUS_CMS_ERROR_PARAM}, \ | |
| 880 {ATP_RESULT_CODE_LAST_OFFSET_V0, ATP_RESULT_CODE_LAST_OFFSET_V1, ATP_RESULT_CODE_NOT_DEFINED}}; | |
| 881 | |
| 882 /* Define the maximum extended result code parameter length: */ | |
| 883 /* - '=' + <value> (up to 65535). */ | |
| 884 #define MAX_SINGLE_RESULT_CODE_VALUE_LEN (0x06) | |
| 885 | |
| 886 /* Define the structure associated with extended result codes. The format of */ | |
| 887 /* such result codes is <result_code>[=<value>] (See Headset Specification, */ | |
| 888 /* Section 4.7.3). <value> shall consist of a numeric constant. */ | |
| 889 typedef struct | |
| 890 { | |
| 891 UINT16 value; | |
| 892 } T_ATP_SINGLE_RESULT_CODE_VALUE; | |
| 893 | |
| 894 /* Define all extended syntax result codes. */ | |
| 895 /* __________________________________________________________________________ */ | |
| 896 /* | | | | | | */ | |
| 897 /* | Binary code | Len | Result code | Numeric | Description | */ | |
| 898 /* |__________________|_____|_____________|_________|_________________________| */ | |
| 899 /* | | | | | | */ | |
| 900 /* | ATP_PLUS_VGM_NB | 4 | +VGM | X | Unsolicited result code | */ | |
| 901 /* | | | | | issued by the AG to set | */ | |
| 902 /* | | | | | the microphone gain of | */ | |
| 903 /* | | | | | the HS (See Headset | */ | |
| 904 /* | | | | | Specification, Section | */ | |
| 905 /* | | | | | 4.7.3). | */ | |
| 906 /* | ATP_PLUS_VGS_NB | 4 | +VGS | X | Unsolicited result code | */ | |
| 907 /* | | | | | issued by the AG to set | */ | |
| 908 /* | | | | | the speaker gain of the | */ | |
| 909 /* | | | | | HS (See Headset | */ | |
| 910 /* | | | | | Specification, Section | */ | |
| 911 /* | | | | | 4.7.3). | */ | |
| 912 /* |__________________|_____|_____________|_________|_________________________| */ | |
| 913 typedef T_ATP_SINGLE_RESULT_CODE_VALUE T_ATP_PLUS_VGM_PARAM; | |
| 914 typedef T_ATP_SINGLE_RESULT_CODE_VALUE T_ATP_PLUS_VGS_PARAM; | |
| 915 | |
| 916 /* Define the maximum number of characters appearing in the <text>. */ | |
| 917 /* - '=' + <value> (up to 65535). */ | |
| 918 #define MAX_CONNECT_TXT_LEN (MAX_SINGLE_RESULT_CODE_VALUE_LEN) | |
| 919 | |
| 920 /* Define the structure associated with CONNECT<text> result code whose format */ | |
| 921 /* is CONNECT <text> (See ITU-T Recommendation V.250 ter page 11). <text> */ | |
| 922 /* should specify the baudrate (1200, 2400, 4800, 9600 ...). */ | |
| 923 /* __________________________________________________________________________ */ | |
| 924 /* | | | | | | */ | |
| 925 /* | Binary code | Len | Result code | Numeric | Description | */ | |
| 926 /* |__________________|_____|_____________|_________|_________________________| */ | |
| 927 /* | | | | | | */ | |
| 928 /* |ATP_CONNECT_TXT_NB| 7 | CONNECT | X | A connection has been | */ | |
| 929 /* | | | | | established. | */ | |
| 930 /* |__________________|_____|_____________|_________|_________________________| */ | |
| 931 typedef T_ATP_SINGLE_RESULT_CODE_VALUE T_ATP_CONNECT_TXT_PARAM; | |
| 932 | |
| 933 /* Define the maximum number of characters appearing in the <error>. */ | |
| 934 #define MAX_PLUS_ERROR_LEN (30) | |
| 935 | |
| 936 /* Define the structure associated with <error> result code whose format is */ | |
| 937 /* either +CME ERROR: <error> (See See GSM TS 07.07, Section 9.2) or +CMS */ | |
| 938 /* ERROR: <error> (See GSM TS 07.05, Section 3.2.5)). */ | |
| 939 /* __________________________________________________________________________ */ | |
| 940 /* | | | | | | */ | |
| 941 /* | Binary code | Len | Result code | Numeric | Description | */ | |
| 942 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 943 /* | | | | | | */ | |
| 944 /* |ATP_PLUS_CME_ERROR_NB| 11 | +CME ERROR: | X | Final result code | */ | |
| 945 /* | | | | | similar to the | */ | |
| 946 /* | | | | | regular ERROR result | */ | |
| 947 /* | | | | | code (See GSM TS | */ | |
| 948 /* | | | | | 07.07, Section 9.2). | */ | |
| 949 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 950 /* | | | | | | */ | |
| 951 /* |ATP_PLUS_CMS_ERROR_NB| 11 | +CMS ERROR: | X | Final result code | */ | |
| 952 /* | | | | | that indicates an | */ | |
| 953 /* | | | | | error related to | */ | |
| 954 /* | | | | | mobile equipment or | */ | |
| 955 /* | | | | | network (See GSM TS | */ | |
| 956 /* | | | | | 07.05, Section | */ | |
| 957 /* | | | | | 3.2.5). | */ | |
| 958 /* |_____________________|_____|_____________|_________|______________________| */ | |
| 959 typedef struct | |
| 960 { | |
| 961 char error_p[MAX_PLUS_ERROR_LEN]; | |
| 962 UINT8 error_length; | |
| 963 } T_ATP_PLUS_ERROR_RESULT_CODE; | |
| 964 | |
| 965 | |
| 966 /************************************ MACROS ************************************/ | |
| 967 /* */ | |
| 968 /* Define a macro used to compare the first "count" characters of the two */ | |
| 969 /* buffers "reference" and "buffer". The comparison is not case sensitive. Note */ | |
| 970 /* that the "reference" must be in all caps. Therefore, the gap between */ | |
| 971 /* alphabetic lower-case characters and their upper-case equivalents is 0x20 */ | |
| 972 /* (See CCITT T.50 (1992), International Reference Alphabet). */ | |
| 973 /* */ | |
| 974 /* Prototype: */ | |
| 975 /* ATP_MEM_I_CMP (T_ATP_TXT_CMD reference, */ | |
| 976 /* T_ATP_TXT_CMD buffer, */ | |
| 977 /* UINT8 count, */ | |
| 978 /* BOOLEAN *equal); */ | |
| 979 #define ATP_MEM_I_CMP(reference, \ | |
| 980 buffer, \ | |
| 981 count, \ | |
| 982 equal) \ | |
| 983 { \ | |
| 984 UINT8 nb_byte = 0x00; \ | |
| 985 while ((nb_byte < (count)) && \ | |
| 986 (((buffer)[nb_byte] == (reference)[nb_byte]) || \ | |
| 987 (((buffer)[nb_byte] >= 'a') && \ | |
| 988 ((buffer)[nb_byte] <= 'z') && \ | |
| 989 ((reference)[nb_byte] == ((buffer)[nb_byte] - '\x20'))))) \ | |
| 990 { \ | |
| 991 nb_byte++; \ | |
| 992 } \ | |
| 993 *(equal) = (BOOLEAN) ((nb_byte == (count)) ? (TRUE) : (FALSE)); \ | |
| 994 } | |
| 995 | |
| 996 /* Define a macro used to compare the first "count" characters of the two */ | |
| 997 /* buffers "reference" and "buffer". The comparison is not case sensitive. */ | |
| 998 /* Besides, space characters are ignored and may be used freely for formatting */ | |
| 999 /* purposes (See ITU-T Recommendation V.250 ter page 4). Note that the */ | |
| 1000 /* "reference" must be in all caps. Therefore, the gap between alphabetic */ | |
| 1001 /* lower-case characters and their upper-case equivalents is 0x20 (See CCITT */ | |
| 1002 /* T.50 (1992), International Reference Alphabet). */ | |
| 1003 /* */ | |
| 1004 /* Prototype: */ | |
| 1005 /* ATP_MEM_SP_I_CMP (T_ATP_TXT_CMD reference, */ | |
| 1006 /* T_ATP_TXT_CMD buffer, */ | |
| 1007 /* UINT8 *count, */ | |
| 1008 /* BOOLEAN *equal); */ | |
| 1009 #define ATP_MEM_SP_I_CMP(reference, \ | |
| 1010 buffer, \ | |
| 1011 count, \ | |
| 1012 equal) \ | |
| 1013 { \ | |
| 1014 UINT8 nb_byte_ref = 0x00; \ | |
| 1015 UINT8 nb_byte_buf = 0x00; \ | |
| 1016 while ((nb_byte_ref < *(count)) && \ | |
| 1017 (((buffer)[nb_byte_buf] == '\x20') || \ | |
| 1018 ((buffer)[nb_byte_buf] == (reference)[nb_byte_ref]) || \ | |
| 1019 (((buffer)[nb_byte_buf] >= 'a') && \ | |
| 1020 ((buffer)[nb_byte_buf] <= 'z') && \ | |
| 1021 ((reference)[nb_byte_ref] == ((buffer)[nb_byte_buf] - '\x20'))))) \ | |
| 1022 { \ | |
| 1023 if ((buffer)[nb_byte_buf++] == '\x20') \ | |
| 1024 { \ | |
| 1025 continue; \ | |
| 1026 } \ | |
| 1027 nb_byte_ref++; \ | |
| 1028 } \ | |
| 1029 *(equal) = (BOOLEAN) ((nb_byte_ref == *(count)) ? (TRUE) : (FALSE)); \ | |
| 1030 *(count) = nb_byte_buf; \ | |
| 1031 } | |
| 1032 | |
| 1033 | |
| 1034 /************************ MACROS DEDICATED TO AT COMMANDS ***********************/ | |
| 1035 /* */ | |
| 1036 /* Define a macro used to get the <number> of basic syntax commands. Note that */ | |
| 1037 /* <number> may be a string of one or more characters from "0" through "9" */ | |
| 1038 /* representing the decimal integer value (See ITU-T Recommendation V.250 ter */ | |
| 1039 /* page 5). Besides, if <number> is missing, the "initial_value" is assumed. */ | |
| 1040 /* */ | |
| 1041 /* Prototype: */ | |
| 1042 /* ATP_GET_NUMBER (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1043 /* UINT16 *number_p, */ | |
| 1044 /* const char initial_value); */ | |
| 1045 #define ATP_GET_NUMBER(cmd_line_p, \ | |
| 1046 number_p, \ | |
| 1047 initial_value) \ | |
| 1048 { \ | |
| 1049 char nb_value_p[0x05] = {'\x00','\x00','\x00','\x00','\x00'}; \ | |
| 1050 UINT8 nb_digit = 0x00; \ | |
| 1051 for (*nb_value_p = initial_value; \ | |
| 1052 ((*(cmd_line_p) >= '0') && (*(cmd_line_p) <= '9')) || \ | |
| 1053 (*(cmd_line_p) == ' '); \ | |
| 1054 (cmd_line_p)++) \ | |
| 1055 { \ | |
| 1056 if (((*(cmd_line_p) == '0') && (nb_digit == 0x00)) || \ | |
| 1057 (*(cmd_line_p) == ' '))\ | |
| 1058 { \ | |
| 1059 continue; \ | |
| 1060 } \ | |
| 1061 nb_value_p[nb_digit++] = *(cmd_line_p); \ | |
| 1062 } \ | |
| 1063 *(number_p) = (UINT16) atoi (nb_value_p); \ | |
| 1064 } | |
| 1065 | |
| 1066 /* Define a macro used to get the <dial_string> of dial (See ITU-T */ | |
| 1067 /* Recommendation V.250 ter page 31). All characters appearing on the same */ | |
| 1068 /* command line after D are considered part of the call addressing information */ | |
| 1069 /* to be signalled to the network, or modifiers used to control the signalling */ | |
| 1070 /* process, up to a semicolon character or the end of the command line. If the */ | |
| 1071 /* <dial_string> is terminated by a semicolon, the DCE does not start the call */ | |
| 1072 /* origination procedure, but instead returns to command state after completion */ | |
| 1073 /* of the signalling of call addressing information to the network. */ | |
| 1074 /* */ | |
| 1075 /* Prototype: */ | |
| 1076 /* ATP_GET_DIAL_STRING (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1077 /* T_ATP_TXT_CMD dial_string_p, */ | |
| 1078 /* UINT8 *dial_string_length_p, */ | |
| 1079 /* UINT8 *call_type_p, */ | |
| 1080 /* const char termination_char); */ | |
| 1081 #define ATP_GET_DIAL_STRING(cmd_line_p, \ | |
| 1082 dial_string_p, \ | |
| 1083 dial_string_length_p, \ | |
| 1084 call_type_p, \ | |
| 1085 termination_char) \ | |
| 1086 { \ | |
| 1087 *(call_type_p) = DATA_CALL; \ | |
| 1088 for (*(dial_string_length_p) = 0x00; \ | |
| 1089 (*(cmd_line_p) != termination_char) && \ | |
| 1090 (*(dial_string_length_p) < MAX_DIAL_STRING_LEN); \ | |
| 1091 (*(dial_string_length_p))++) \ | |
| 1092 { \ | |
| 1093 if (*(cmd_line_p) == ';') \ | |
| 1094 { \ | |
| 1095 *(call_type_p) = VOICE_CALL; \ | |
| 1096 break; \ | |
| 1097 } \ | |
| 1098 (dial_string_p)[*(dial_string_length_p)] = *(cmd_line_p)++; \ | |
| 1099 } \ | |
| 1100 } | |
| 1101 | |
| 1102 /* Define a macro used to get operators such as "=", "?" or "=?". */ | |
| 1103 /* */ | |
| 1104 /* Prototype: */ | |
| 1105 /* ATP_GET_OPERATOR (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1106 /* T_ATP_EXTENDED_OPERATOR *s_operator_p); */ | |
| 1107 #define ATP_GET_OPERATOR(cmd_line_p, \ | |
| 1108 s_operator_p) \ | |
| 1109 { \ | |
| 1110 for (*(s_operator_p) = 0x00; \ | |
| 1111 ((*(cmd_line_p) == '=') || (*(cmd_line_p) == '?') || \ | |
| 1112 (*(cmd_line_p) == ' ')); \ | |
| 1113 (cmd_line_p)++) \ | |
| 1114 { \ | |
| 1115 switch (*(cmd_line_p)) \ | |
| 1116 { \ | |
| 1117 case '?': \ | |
| 1118 { \ | |
| 1119 *(s_operator_p) += 0x01; \ | |
| 1120 break; \ | |
| 1121 } \ | |
| 1122 case '=': \ | |
| 1123 { \ | |
| 1124 *(s_operator_p) += 0x02; \ | |
| 1125 break; \ | |
| 1126 } \ | |
| 1127 default: \ | |
| 1128 { \ | |
| 1129 break; \ | |
| 1130 } \ | |
| 1131 } \ | |
| 1132 } \ | |
| 1133 } | |
| 1134 | |
| 1135 /* Define a macro used to get the <value> of S-parameters. Note that <value> */ | |
| 1136 /* shall consist of a decimal constant (See ITU-T Recommendation V.250 ter page */ | |
| 1137 /* 6). */ | |
| 1138 /* */ | |
| 1139 /* Prototype: */ | |
| 1140 /* ATP_GET_PARAMETER_VALUE (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1141 /* T_ATP_EXTENDED_OPERATOR *s_operator_p, */ | |
| 1142 /* UINT16 *value_p); */ | |
| 1143 #define ATP_GET_PARAMETER_VALUE(cmd_line_p, \ | |
| 1144 s_operator_p, \ | |
| 1145 value_p) \ | |
| 1146 { \ | |
| 1147 ATP_GET_OPERATOR((cmd_line_p), \ | |
| 1148 (s_operator_p)); \ | |
| 1149 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1150 (value_p), \ | |
| 1151 '0'); \ | |
| 1152 } | |
| 1153 | |
| 1154 /* Define a macro used to proceed with subsequent commands that might follow an */ | |
| 1155 /* extended syntax command (See ITU-T Recommendation V.250 ter page 9). */ | |
| 1156 /* */ | |
| 1157 /* Prototype: */ | |
| 1158 /* ATP_GET_ADDITIONAL_CMD (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1159 /* const char termination_char); */ | |
| 1160 #define ATP_GET_ADDITIONAL_CMD(cmd_line_p, \ | |
| 1161 termination_char) \ | |
| 1162 { \ | |
| 1163 while (*(cmd_line_p) != termination_char) \ | |
| 1164 { \ | |
| 1165 if (*(cmd_line_p)++ == ';') \ | |
| 1166 { \ | |
| 1167 break; \ | |
| 1168 } \ | |
| 1169 } \ | |
| 1170 } | |
| 1171 | |
| 1172 /* Define a macro used to get the <value> of extended syntax commands. Note */ | |
| 1173 /* that <value> shall consist of either a numeric constant or a string constant */ | |
| 1174 /* (See ITU-T Recommendation V.250 ter page 6). However, only numeric constants */ | |
| 1175 /* are supported for now. */ | |
| 1176 /* */ | |
| 1177 /* Prototype: */ | |
| 1178 /* ATP_GET_VALUE (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1179 /* T_ATP_EXTENDED_OPERATOR *extended_operator_p, */ | |
| 1180 /* UINT16 *value_p, */ | |
| 1181 /* const char termination_char); */ | |
| 1182 #define ATP_GET_VALUE(cmd_line_p, \ | |
| 1183 extended_operator_p, \ | |
| 1184 value_p, \ | |
| 1185 termination_char) \ | |
| 1186 { \ | |
| 1187 ATP_GET_OPERATOR((cmd_line_p), \ | |
| 1188 (extended_operator_p)); \ | |
| 1189 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1190 (value_p), \ | |
| 1191 '0'); \ | |
| 1192 ATP_GET_ADDITIONAL_CMD((cmd_line_p), \ | |
| 1193 (termination_char)); \ | |
| 1194 } | |
| 1195 | |
| 1196 /* Define a macro used to get the <keys> of keypad control command. Note that */ | |
| 1197 /* <keys> shall consist of a string constant (See ETS 300 916 (GSM 07.07) */ | |
| 1198 /* Version 5.8.1 page 62). Note also that <keys> is a string of characters */ | |
| 1199 /* representing keys (See See ETS 300 916 (GSM 07.07) Version 5.8.1 page 62). */ | |
| 1200 /* Colon character followed by one character can be used to indicate a */ | |
| 1201 /* manufacturer specific key not listed here. All characters from a semicolon */ | |
| 1202 /* character to the next single semicolon character are treated as alpha */ | |
| 1203 /* entries and are not converted to key equivalents. All semicolon characters */ | |
| 1204 /* inside alpha entries should be duplicated in the DTE. Pause characters "W" */ | |
| 1205 /* and "w" can be used to pause between key pressings for a time specified by */ | |
| 1206 /* <pause>. */ | |
| 1207 /* */ | |
| 1208 /* Prototype: */ | |
| 1209 /* ATP_GET_KEYS (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1210 /* T_ATP_AT_PLUS_CKPD_PARAM *ckpd_param_p, */ | |
| 1211 /* const char termination_char); */ | |
| 1212 #define ATP_GET_KEYS(cmd_line_p, \ | |
| 1213 ckpd_param_p, \ | |
| 1214 termination_char) \ | |
| 1215 { \ | |
| 1216 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1217 &((ckpd_param_p)->keys[0x00]), \ | |
| 1218 '0'); \ | |
| 1219 (ckpd_param_p)->nb_keys = 0x01; \ | |
| 1220 ATP_GET_ADDITIONAL_CMD((cmd_line_p), \ | |
| 1221 (termination_char)); \ | |
| 1222 } | |
| 1223 // { \ | |
| 1224 // UINT8 nb_keys = 0x00; \ | |
| 1225 // while (*(cmd_line_p) != termination_char) \ | |
| 1226 // { \ | |
| 1227 // if (*(cmd_line_p)++ == '\"') \ | |
| 1228 // { \ | |
| 1229 // break; \ | |
| 1230 // } \ | |
| 1231 // } \ | |
| 1232 // while (*(cmd_line_p) != termination_char) \ | |
| 1233 // { \ | |
| 1234 // switch (*(cmd_line_p)++) \ | |
| 1235 // { \ | |
| 1236 // case ' ': \ | |
| 1237 // { \ | |
| 1238 // continue; \ | |
| 1239 // } \ | |
| 1240 // case ';': \ | |
| 1241 // { \ | |
| 1242 // ATP_GET_NUMBER((cmd_line_p), \ | |
| 1243 // &((ckpd_param_p)->keys[nb_keys]), \ | |
| 1244 // '0'); \ | |
| 1245 // nb_keys++; \ | |
| 1246 // while (*(cmd_line_p) != termination_char) \ | |
| 1247 // { \ | |
| 1248 // if (*(cmd_line_p)++ == ';') \ | |
| 1249 // { \ | |
| 1250 // break; \ | |
| 1251 // } \ | |
| 1252 // } \ | |
| 1253 // continue; \ | |
| 1254 // } \ | |
| 1255 // case ':': \ | |
| 1256 // { \ | |
| 1257 // while (*(cmd_line_p) != termination_char) \ | |
| 1258 // { \ | |
| 1259 // if (*(cmd_line_p)++ == ':') \ | |
| 1260 // { \ | |
| 1261 // break; \ | |
| 1262 // } \ | |
| 1263 // } \ | |
| 1264 // continue; \ | |
| 1265 // } \ | |
| 1266 // case '\"': \ | |
| 1267 // { \ | |
| 1268 // break; \ | |
| 1269 // } \ | |
| 1270 // default: \ | |
| 1271 // { \ | |
| 1272 // (ckpd_param_p)->keys[nb_keys] = (UINT16) (*(cmd_line_p - 0x01)); \ | |
| 1273 // nb_keys++; \ | |
| 1274 // continue; \ | |
| 1275 // } \ | |
| 1276 // } \ | |
| 1277 // break; \ | |
| 1278 // } \ | |
| 1279 // (ckpd_param_p)->nb_keys = nb_keys; \ | |
| 1280 // } | |
| 1281 | |
| 1282 /* Define a macro used to proceed with subsequent numeric and string values */ | |
| 1283 /* that might appear in a compound value (See ITU-T Recommendation V.250 ter */ | |
| 1284 /* page 7). */ | |
| 1285 /* */ | |
| 1286 /* Prototype: */ | |
| 1287 /* ATP_GET_ADDITIONAL_VALUE (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1288 /* const char termination_char); */ | |
| 1289 #define ATP_GET_ADDITIONAL_VALUE(cmd_line_p, \ | |
| 1290 termination_char) \ | |
| 1291 { \ | |
| 1292 while (*(cmd_line_p) != termination_char) \ | |
| 1293 { \ | |
| 1294 switch (*(cmd_line_p)) \ | |
| 1295 { \ | |
| 1296 case ',': \ | |
| 1297 { \ | |
| 1298 cmd_line_p++; \ | |
| 1299 } \ | |
| 1300 case ';': \ | |
| 1301 { \ | |
| 1302 break; \ | |
| 1303 } \ | |
| 1304 default: \ | |
| 1305 { \ | |
| 1306 cmd_line_p++; \ | |
| 1307 continue; \ | |
| 1308 } \ | |
| 1309 } \ | |
| 1310 break; \ | |
| 1311 } \ | |
| 1312 } | |
| 1313 | |
| 1314 /* Define a macro used to get the <keys>,<time> and <pause> of keypad control */ | |
| 1315 /* command. Note that <keys> shall consist of a string constant and <time> and */ | |
| 1316 /* <pause> shall consist of numeric constants in tenths of a second (See ETS */ | |
| 1317 /* 300 916 (GSM 07.07) Version 5.8.1 page 62). */ | |
| 1318 /* */ | |
| 1319 /* Prototype: */ | |
| 1320 /* ATP_GET_CKPD_PARAM (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1321 /* T_ATP_AT_PLUS_CKPD_PARAM *ckpd_param_p, */ | |
| 1322 /* const char termination_char); */ | |
| 1323 #define ATP_GET_CKPD_PARAM(cmd_line_p, \ | |
| 1324 ckpd_param_p, \ | |
| 1325 termination_char) \ | |
| 1326 { \ | |
| 1327 ATP_GET_OPERATOR((cmd_line_p), \ | |
| 1328 &((ckpd_param_p)->extended_operator)); \ | |
| 1329 ATP_GET_KEYS((cmd_line_p), \ | |
| 1330 (ckpd_param_p), \ | |
| 1331 (termination_char)); \ | |
| 1332 ATP_GET_ADDITIONAL_VALUE((cmd_line_p), \ | |
| 1333 (termination_char)); \ | |
| 1334 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1335 &((ckpd_param_p)->time), \ | |
| 1336 '0'); \ | |
| 1337 ATP_GET_ADDITIONAL_VALUE((cmd_line_p), \ | |
| 1338 (termination_char)); \ | |
| 1339 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1340 &((ckpd_param_p)->pause), \ | |
| 1341 '0'); \ | |
| 1342 ATP_GET_ADDITIONAL_CMD((cmd_line_p), \ | |
| 1343 (termination_char)); \ | |
| 1344 } | |
| 1345 | |
| 1346 | |
| 1347 /************************ MACRO DEDICATED TO RESULT CODES ***********************/ | |
| 1348 /* */ | |
| 1349 /* Define a macro used to get the <value> associated with extended result codes */ | |
| 1350 /* (See Headset Specification, Section 4.7.3). Note that <value> shall consist */ | |
| 1351 /* of a numeric constant. */ | |
| 1352 /* */ | |
| 1353 /* Prototype: */ | |
| 1354 /* ATP_GET_RESULT_CODE_VALUE (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1355 /* UINT16 *value_p); */ | |
| 1356 #define ATP_GET_RESULT_CODE_VALUE(cmd_line_p, \ | |
| 1357 value_p) \ | |
| 1358 { \ | |
| 1359 UINT8 result_operator = 0x00; \ | |
| 1360 ATP_GET_OPERATOR((cmd_line_p), \ | |
| 1361 &result_operator); \ | |
| 1362 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1363 (value_p), \ | |
| 1364 '0'); \ | |
| 1365 } | |
| 1366 | |
| 1367 /* Define a macro used to get the <text> associated with CONNECT <text> result */ | |
| 1368 /* code (See ITU-T Recommendation V.250 ter page 11). */ | |
| 1369 /* */ | |
| 1370 /* Prototype: */ | |
| 1371 /* ATP_GET_CONNECT_TXT (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1372 /* UINT16 *value_p); */ | |
| 1373 #define ATP_GET_CONNECT_TXT(cmd_line_p, \ | |
| 1374 value_p) \ | |
| 1375 { \ | |
| 1376 ATP_GET_NUMBER((cmd_line_p), \ | |
| 1377 (value_p), \ | |
| 1378 '0'); \ | |
| 1379 } | |
| 1380 | |
| 1381 /* Define a macro used to get the <error> of +CME ERROR (See See GSM TS 07.07, */ | |
| 1382 /* Section 9.2) and +CMS ERROR (See GSM TS 07.05, Section 3.2.5)) result codes. */ | |
| 1383 /* */ | |
| 1384 /* Prototype: */ | |
| 1385 /* ATP_PLUS_ERROR_STRING (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1386 /* T_ATP_TXT_CMD error_p, */ | |
| 1387 /* UINT8 *error_length_p, */ | |
| 1388 /* const char termination_char); */ | |
| 1389 #define ATP_PLUS_ERROR_STRING(cmd_line_p, \ | |
| 1390 error_p, \ | |
| 1391 error_length_p, \ | |
| 1392 termination_char) \ | |
| 1393 { \ | |
| 1394 for (*(error_length_p) = 0x00; \ | |
| 1395 (*(cmd_line_p) != termination_char) && \ | |
| 1396 (*(error_length_p) < MAX_PLUS_ERROR_LEN); \ | |
| 1397 (*(error_length_p))++) \ | |
| 1398 { \ | |
| 1399 (error_p)[*(error_length_p)] = *(cmd_line_p)++; \ | |
| 1400 } \ | |
| 1401 } | |
| 1402 | |
| 1403 | |
| 1404 /************************** MACRO DEDICATED TO RAW DATA *************************/ | |
| 1405 /* */ | |
| 1406 /* Define a macro used to get the length of unknown commands from raw data, */ | |
| 1407 /* <CR> not included. Note that all characters appearing on the same command */ | |
| 1408 /* line are considered part of the unknown command, up to the end of the */ | |
| 1409 /* command line. */ | |
| 1410 /* */ | |
| 1411 /* Prototype: */ | |
| 1412 /* ATP_GET_UNKNOWN_CMD_LEN (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1413 /* UINT8 *cmd_length_p); */ | |
| 1414 /* const char termination_char); */ | |
| 1415 #define ATP_GET_UNKNOWN_CMD_LEN(cmd_line_p, \ | |
| 1416 cmd_length_p, \ | |
| 1417 termination_char) \ | |
| 1418 { \ | |
| 1419 for (*(cmd_length_p) = 0x00; \ | |
| 1420 (cmd_line_p)[*(cmd_length_p)] != termination_char; \ | |
| 1421 (*(cmd_length_p))++) \ | |
| 1422 { \ | |
| 1423 } \ | |
| 1424 } | |
| 1425 | |
| 1426 /* Define a macro used to get the length of unknown AT commands from raw data, */ | |
| 1427 /* <CR> or semicolon not included. Note that all characters appearing on the */ | |
| 1428 /* same command line are considered part of the unknown command, up to a */ | |
| 1429 /* semicolon character or the end of the command line. */ | |
| 1430 /* */ | |
| 1431 /* Prototype: */ | |
| 1432 /* ATP_GET_UNKNOWN_AT_CMD_LEN (T_ATP_TXT_CMD cmd_line_p, */ | |
| 1433 /* UINT8 *cmd_length_p); */ | |
| 1434 /* const char termination_char); */ | |
| 1435 #define ATP_GET_UNKNOWN_AT_CMD_LEN(cmd_line_p, \ | |
| 1436 cmd_length_p, \ | |
| 1437 termination_char) \ | |
| 1438 { \ | |
| 1439 for (*(cmd_length_p) = 0x00; \ | |
| 1440 ((cmd_line_p)[*(cmd_length_p)] != termination_char) && \ | |
| 1441 ((cmd_line_p)[*(cmd_length_p)] != ';'); \ | |
| 1442 (*(cmd_length_p))++) \ | |
| 1443 { \ | |
| 1444 } \ | |
| 1445 } | |
| 1446 | |
| 1447 #endif |
