comparison gsm-fw/g23m-aci/aci/cmh_gmmq.c @ 775:eedbf248bac0

gsm-fw/g23m-aci subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 12 Oct 2014 01:45:14 +0000
parents
children
comparison
equal deleted inserted replaced
774:40a721fd9854 775:eedbf248bac0
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 query functions related to the
18 | protocol stack adapter for GPRS mobility management ( GMM ).
19 +-----------------------------------------------------------------------------
20 */
21
22 #if defined (GPRS) && defined (DTI)
23
24 #ifndef CMH_GMMQ_C
25 #define CMH_GMMQ_C
26 #endif
27
28 #include "aci_all.h"
29
30 /*==== INCLUDES ===================================================*/
31 #include "dti.h" /* functionality of the dti library */
32 #include "aci_cmh.h"
33 #include "ati_cmd.h"
34 #include "aci_cmd.h"
35
36 #include "dti_conn_mng.h"
37
38 #include "pcm.h"
39
40 #include "gaci.h"
41 #include "gaci_cmh.h"
42 #include "psa.h"
43 #include "psa_gmm.h"
44
45 #include "cmh.h"
46 #include "cmh_gmm.h"
47
48 /*==== CONSTANTS ==================================================*/
49
50 /*==== EXPORT =====================================================*/
51
52 /*==== VARIABLES ==================================================*/
53
54 /*==== FUNCTIONS ==================================================*/
55
56 /*
57 +--------------------------------------------------------------------+
58 | PROJECT : GPRS (8441) MODULE : CMH_GMMQ |
59 | STATE : finished ROUTINE : qAT_PlusCGATT |
60 +--------------------------------------------------------------------+
61
62 PURPOSE : This is the functional counterpart to the +CGATT? AT
63 command which returns the current state of GPRS attachment.
64 */
65
66 GLOBAL T_ACI_RETURN qAT_PlusCGATT ( T_ACI_CMD_SRC srcId, T_CGATT_STATE *state )
67 {
68 TRACE_FUNCTION ("qAT_PlusCGATT()");
69
70 if ( !cmh_IsVldCmdSrc (srcId) )
71 {
72 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
73 return( AT_FAIL );
74 }
75
76 switch ( cmhGMM_Get_state() )
77 {
78 case AS_ATTACHED:
79 case AS_SUSPENTED:
80 *state = CGATT_STATE_ATTACHED;
81 break;
82 case AS_INVALID_STATE:
83 case AS_MOBILE_OFF:
84 case AS_DETACHED:
85 case AS_ATTACHING:
86 case AS_DETACHING:
87 default:
88 *state = CGATT_STATE_DETACHED;
89 break;
90 }
91
92 return( AT_CMPL );
93 }
94
95 /*
96 +--------------------------------------------------------------------+
97 | PROJECT : GPRS (8441) MODULE : CMH_GMMQ |
98 | STATE : code ROUTINE : qAT_PlusCGCLASS |
99 +--------------------------------------------------------------------+
100
101 PURPOSE : This is the functional counterpart to the +CGCLASS? AT
102 command which returns current GACI mobile class.
103 */
104
105 GLOBAL T_ACI_RETURN qAT_PlusCGCLASS ( T_ACI_CMD_SRC srcId, T_CGCLASS_CLASS *m_class )
106 {
107 TRACE_FUNCTION ("qAT_PlusCGCLASS()");
108
109 /*
110 *-------------------------------------------------------------------
111 * check command source - should be Serial link ?
112 *-------------------------------------------------------------------
113 */
114 if ( !cmh_IsVldCmdSrc (srcId) ) {
115 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
116 return( AT_FAIL );
117 }
118
119 /*
120 *-------------------------------------------------------------------
121 * fill in parameters
122 *-------------------------------------------------------------------
123 */
124 switch ( gmmShrdPrm.mobile_class )
125 {
126 case GMMREG_CLASS_A:
127 *m_class = CGCLASS_CLASS_A; /* mobile class A (highest) */
128 break;
129 case GMMREG_CLASS_B:
130 case GMMREG_CLASS_BC:
131 case GMMREG_CLASS_BG:
132 *m_class = CGCLASS_CLASS_B; /* mobile class B */
133 break;
134 case GMMREG_CLASS_CG:
135 *m_class = CGCLASS_CLASS_CG; /* mobile class CG (GPRS only mode) */
136 break;
137 case GMMREG_CLASS_CC:
138 *m_class = CGCLASS_CLASS_CC; /* mobile class CC (circuit switched only mode - lowest) */
139 break;
140 default: /*bad user command */
141 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
142 return AT_FAIL;
143 }
144
145 return( AT_CMPL );
146 }
147
148 /*
149 +--------------------------------------------------------------------+
150 | PROJECT : GPRS (8441) MODULE : CMH_GMMQ |
151 | STATE : finished ROUTINE : qAT_PercentCGAATT |
152 +--------------------------------------------------------------------+
153
154 PURPOSE : This command get the mode of automatic attach / detach.
155 */
156
157 GLOBAL T_ACI_RETURN qAT_PercentCGAATT ( T_ACI_CMD_SRC srcId, T_CGAATT_ATTACH_MODE *att_m, T_CGAATT_DETACH_MODE *det_m )
158
159 {
160 TRACE_FUNCTION ("qAT_PercentCGAATT()");
161
162 *att_m = automatic_attach_mode;
163 *det_m = automatic_detach_mode;
164
165 return( AT_CMPL );
166 }
167
168 GLOBAL T_ACI_RETURN qAT_PlusCGREG( T_ACI_CMD_SRC srcId, T_CGREG_STAT *stat, USHORT *lac, USHORT *ci )
169 {
170 TRACE_FUNCTION ("qAT_PlusCGREG()");
171
172 *stat = gmmShrdPrm.cgreg_stat;
173 *lac = gmmShrdPrm.lac;
174 *ci = gmmShrdPrm.cid;
175
176 return( AT_CMPL );
177 }
178
179 GLOBAL T_ACI_RETURN qAT_PercentCGREG ( T_ACI_CMD_SRC srcId, T_P_CGREG_STAT *stat, USHORT *lac, USHORT *ci )
180 {
181 TRACE_FUNCTION ("qAT_PercentCGREG()");
182
183 *stat = gmmShrdPrm.p_cgreg_stat;
184 *lac = gmmShrdPrm.lac;
185 *ci = gmmShrdPrm.cid;
186
187 return( AT_CMPL );
188 }
189
190 /*
191 +--------------------------------------------------------------------+
192 | PROJECT : GPRS (8441) MODULE : CMH_GMMQ |
193 | STATE : code ROUTINE : qAT_PercentCGCLASS |
194 +--------------------------------------------------------------------+
195
196 PURPOSE : This is the functional counterpart to the %CGCLASS? AT
197 command which returns current GPRS mobile class.
198 */
199 GLOBAL T_ACI_RETURN qAT_PercentCGCLASS ( T_ACI_CMD_SRC srcId, T_PERCENT_CGCLASS *m_class, T_PERCENT_CGCLASS *currentClass )
200 {
201 TRACE_FUNCTION ("qAT_PercentCGCLASS()");
202
203 *m_class = *currentClass = gaciMobileClass.current;
204 if( PERCENT_CGCLASS_BX EQ gaciMobileClass.current)
205 {
206 switch ( gmmShrdPrm.mobile_class )
207 {
208 case GMMREG_CLASS_BC:
209 *currentClass = PERCENT_CGCLASS_BC;
210 break;
211 case GMMREG_CLASS_BG:
212 *currentClass = PERCENT_CGCLASS_BG;
213 break;
214 }
215 }
216
217 return( AT_CMPL );
218 }
219 #endif /* GPRS */
220 /*==== EOF ========================================================*/