comparison g23m/condat/ms/src/aci/cmh_exts.c @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_EXTS
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This module provides the set functions related to the
18 | protocol stack adapter for AT command extensions.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_EXTS_C
23 #define CMH_EXTS_C
24 #endif
25
26 #include "aci_all.h"
27 /*==== INCLUDES ===================================================*/
28
29 /*==== CONSTANTS ==================================================*/
30
31 typedef enum /* ACI functional return codes */
32 {
33 AT_FAIL = -1, /* execution of command failed */
34 AT_CMPL /* execution of command completed */
35 } T_ACI_RETURN;
36
37 EXTERN T_ACI_RETURN rCI_URC ( CHAR * result );
38
39 /*==== EXPORT =====================================================*/
40
41 /*==== VARIABLES ==================================================*/
42
43 /*==== FUNCTIONS ==================================================*/
44
45 /*
46 +--------------------------------------------------------------------+
47 | PROJECT : GSM-PS (6147) MODULE : CMH_EXTS |
48 | STATE : code ROUTINE : sAT_EXT |
49 +--------------------------------------------------------------------+
50
51 PURPOSE : This function is called by the interpreter part of the
52 ACI in case of the detection of an unknown command.
53
54 <command> : remaining unparsed command string.
55 <len> : length of command string. This value must be
56 incremented by the amount of parsed characters
57 by this function.
58 <output> : this parameter can be used to display some
59 strings at the AT command interface.
60 The first char of one string must contain
61 the length of the following string. The
62 special length 0xff must be used to define
63 the end of the string list.
64
65 */
66
67 GLOBAL T_ACI_RETURN sAT_EXT (
68 CHAR *command,
69 USHORT *len,
70 CHAR *output
71 )
72 {
73 /*
74 * example how to send an unsolicited result code via the AT interface
75 */
76 rCI_URC ("<unsolicited result code>");
77
78 /*
79 * example how to process the command AT%H
80 */
81 if (*command++ == '%' && *command == 'H')
82 {
83 *len -= 2;
84
85 /*
86 * here you can perform some actions with drivers etc.
87 */
88
89 /*
90 * and create some additional output at the AT interface
91 * The strings:
92 *"Hello"
93 *""
94 *"World"
95 * will be displayed at the terminal.
96 *
97 * first string Hello
98 */
99 output[0] = strlen ("Hello");
100 memcpy (&output[1], "Hello", 5);
101 /*
102 * add a spare line with an empty string
103 */
104 output [6] = 0;
105 /*
106 * second string World
107 */
108 output [7] = strlen ("World");
109 memcpy (&output[8], "World", 5);
110
111 /*
112 * end of string list
113 */
114 output [13] = (CHAR) 0xff;
115
116 return( AT_CMPL );
117 }
118 else
119 return( AT_FAIL );
120 }
121