comparison src/g23m-aci/aci/cmh_phbt.c @ 1:fa8dc04885d8

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