comparison g23m-aci/aci/cmh_phbt.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_PHBT
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 test functions related to the
18 | protocol stack adapter for the phonebook management.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef CMH_PHBT_C
23 #define CMH_PHBT_C
24 #endif
25
26 #include "config.h"
27 #include "fixedconf.h"
28 #include "condat-features.h"
29 #include "aci_conf.h"
30
31 #include "aci_all.h"
32 /*==== INCLUDES ===================================================*/
33 #include "aci_cmh.h"
34
35 #ifdef FAX_AND_DATA
36 #include "aci_fd.h"
37 #endif /* of #ifdef FAX_AND_DATA */
38
39 #include "psa.h"
40 #include "phb.h"
41 #include "cmh.h"
42 #include "cmh_phb.h"
43
44 /*==== CONSTANTS ==================================================*/
45
46 #define PHB_CMH_FIRST_IDX (1) /* first index in phonebook */
47
48 /*==== EXPORT =====================================================*/
49
50 /*==== VARIABLES ==================================================*/
51
52 /*==== FUNCTIONS ==================================================*/
53 /*
54 +--------------------------------------------------------------------+
55 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
56 | STATE : code ROUTINE : cmhPHB_get_phonebook_info|
57 +--------------------------------------------------------------------+
58
59 PURPOSE : This function is used to get the basic adjustments of the
60 current selected phonebook storage.
61
62 <firstIdx>: first supported index
63 <lastIdx>: last supported index
64 <nlength>: maximum length of phone number
65 <tlength>: maximum length of associated text
66 */
67 LOCAL T_ACI_RETURN cmhPHB_get_phonebook_info( T_ACI_CMD_SRC srcId,
68 SHORT* firstIdx,
69 SHORT* lastIdx,
70 UBYTE* nlength,
71 UBYTE* tlength )
72 {
73 T_PHB_CMD_PRM * pPHBCmdPrm; /* points to PHB command parameter */
74 SHORT maxIdx; /* maximum record index */
75 UBYTE numLen; /* maximum num length */
76 UBYTE tagLen; /* maximum tag length */
77 SHORT dmyUsed; /* dummy variable, not used */
78 SHORT dmyMaxExt;
79 SHORT dmyUsedExt;
80 #ifndef TI_PS_FFS_PHB
81 UBYTE dmySrvc; /* dummy variable, not used */
82 SHORT dmyAvail; /* dummy variable, not used */
83 #endif
84
85 TRACE_FUNCTION("cmhPHB_get_phonebook_info( )");
86
87 /*
88 *-----------------------------------------------------------------
89 * check command source
90 *-----------------------------------------------------------------
91 */
92 if( ! cmh_IsVldCmdSrc (srcId) )
93 {
94 return( AT_FAIL );
95 }
96
97 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm;
98
99 /*
100 *-----------------------------------------------------------------
101 * fill in parameter <firstIdx>, <lastIdx>, <nlength> and <tlength>
102 *-----------------------------------------------------------------
103 */
104
105 if ( pPHBCmdPrm -> cmhStor EQ PB_STOR_NotPresent )
106 {
107 *firstIdx = ACI_NumParmNotPresent;
108 *lastIdx = ACI_NumParmNotPresent;
109 *nlength = 0;
110 *tlength = 0;
111 return(AT_CMPL);
112 }
113
114 #ifdef TI_PS_FFS_PHB
115 if (pb_read_sizes ((T_PHB_TYPE)pPHBCmdPrm -> phbStor,
116 &maxIdx,
117 &dmyUsed,
118 &numLen,
119 &tagLen,
120 &dmyMaxExt,
121 &dmyUsedExt) NEQ PHB_OK)
122 #else
123 numLen = 2 * PHB_PACKED_NUM_LEN;
124 if ( pb_read_status ( pPHBCmdPrm -> phbStor,
125 &dmySrvc,
126 &maxIdx,
127 &dmyUsed,
128 &tagLen,
129 &dmyAvail,
130 &dmyMaxExt,
131 &dmyUsedExt ) EQ PHB_FAIL )
132 #endif
133 {
134 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown );
135 return( AT_FAIL );
136 }
137
138 *firstIdx = PHB_CMH_FIRST_IDX;
139 *lastIdx = maxIdx;
140 *nlength = numLen;
141 *tlength = tagLen; /* excluding null termination */
142
143 return ( AT_CMPL );
144 }
145
146 /*
147 +--------------------------------------------------------------------+
148 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
149 | STATE : code ROUTINE : tAT_PlusCPBR |
150 +--------------------------------------------------------------------+
151
152 PURPOSE : This is the functional counterpart to the +CPBR=?
153 AT command which is responsible to test for all supported
154 memory indices, the length of phone numbers and
155 the length of texts associated with these numbers.
156
157 <firstIdx>: first supported index
158 <lastIdx>: last supported index
159 <nlength>: maximum length of phone number
160 <tlength>: maximum length of associated text
161 */
162 GLOBAL T_ACI_RETURN tAT_PlusCPBR ( T_ACI_CMD_SRC srcId,
163 SHORT* firstIdx,
164 SHORT* lastIdx,
165 UBYTE* nlength,
166 UBYTE* tlength )
167 {
168 TRACE_FUNCTION ("tAT_PlusCPBR ()");
169
170 return(cmhPHB_get_phonebook_info(srcId, firstIdx, lastIdx, nlength, tlength));
171 }
172
173 /*
174 +--------------------------------------------------------------------+
175 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
176 | STATE : code ROUTINE : tAT_PlusCPBF |
177 +--------------------------------------------------------------------+
178
179 PURPOSE : This is the functional counterpart to the +CPBF=?
180 AT command which is responsible to test for the length of
181 phone numbers and the length of texts associated with
182 these numbers.
183
184 <nlength>: maximum length of phone number
185 <tlength>: maximum length of associated text
186 */
187 GLOBAL T_ACI_RETURN tAT_PlusCPBF ( T_ACI_CMD_SRC srcId,
188 UBYTE* nlength,
189 UBYTE* tlength )
190 {
191 SHORT firstIdx; /* dummy variable, not used */
192 SHORT lastIdx; /* dummy variable, not used */
193
194 TRACE_FUNCTION ("tAT_PlusCPBF ()");
195
196 return(cmhPHB_get_phonebook_info(srcId, &firstIdx, &lastIdx, nlength, tlength));
197 }
198
199 /*
200 +--------------------------------------------------------------------+
201 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
202 | STATE : code ROUTINE : tAT_PlusCPBW |
203 +--------------------------------------------------------------------+
204
205 PURPOSE : This is the functional counterpart to the +CPBW=?
206 AT command which is responsible to test for all supported
207 memory indices, the length of phone numbers and
208 the length of texts associated with these numbers.
209
210 <firstIdx>: first supported index
211 <lastIdx>: last supported index
212 <nlength>: maximum length of phone number
213 <tlength>: maximum length of associated text
214 */
215 GLOBAL T_ACI_RETURN tAT_PlusCPBW ( T_ACI_CMD_SRC srcId,
216 SHORT* firstIdx,
217 SHORT* lastIdx,
218 UBYTE* nlength,
219 UBYTE* tlength )
220 {
221 TRACE_FUNCTION ("tAT_PlusCPBW ()");
222
223 return(cmhPHB_get_phonebook_info(srcId, firstIdx, lastIdx, nlength, tlength));
224 }
225
226 /*==== EOF ========================================================*/