comparison g23m/condat/ms/src/aci/cmh_phbt.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_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 #ifndef TI_PS_FFS_PHB
74 UBYTE dmySrvc; /* dummy variable, not used */
75 SHORT dmyAvail; /* dummy variable, not used */
76 #endif
77
78 TRACE_FUNCTION("cmhPHB_get_phonebook_info( )");
79
80 /*
81 *-----------------------------------------------------------------
82 * check command source
83 *-----------------------------------------------------------------
84 */
85 if( ! cmh_IsVldCmdSrc (srcId) )
86 {
87 ACI_ERR_DESC( ACI_ERR_CLASS_Ext, EXT_ERR_Parameter );
88 return( AT_FAIL );
89 }
90
91 pPHBCmdPrm = &cmhPrm[srcId].phbCmdPrm;
92
93 /*
94 *-----------------------------------------------------------------
95 * fill in parameter <firstIdx>, <lastIdx>, <nlength> and <tlength>
96 *-----------------------------------------------------------------
97 */
98
99 if ( pPHBCmdPrm -> cmhStor EQ PB_STOR_NotPresent )
100 {
101 *firstIdx = ACI_NumParmNotPresent;
102 *lastIdx = ACI_NumParmNotPresent;
103 *nlength = 0;
104 *tlength = 0;
105 return(AT_CMPL);
106 }
107
108 #ifdef TI_PS_FFS_PHB
109 if (pb_read_sizes (pPHBCmdPrm -> phbStor,
110 &maxIdx,
111 &dmyUsed,
112 &numLen,
113 &tagLen) NEQ PHB_OK)
114 #else
115 numLen = 2 * PHB_PACKED_NUM_LEN;
116 if ( pb_read_status ( pPHBCmdPrm -> phbStor,
117 &dmySrvc,
118 &maxIdx,
119 &dmyUsed,
120 &tagLen,
121 &dmyAvail ) EQ PHB_FAIL )
122 #endif
123 {
124 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_Unknown );
125 return( AT_FAIL );
126 }
127
128 *firstIdx = PHB_CMH_FIRST_IDX;
129 *lastIdx = maxIdx;
130 *nlength = numLen;
131 *tlength = tagLen; /* excluding null termination */
132
133 return ( AT_CMPL );
134 }
135
136 /*
137 +--------------------------------------------------------------------+
138 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
139 | STATE : code ROUTINE : tAT_PlusCPBR |
140 +--------------------------------------------------------------------+
141
142 PURPOSE : This is the functional counterpart to the +CPBR=?
143 AT command which is responsible to test for all supported
144 memory indices, the length of phone numbers and
145 the length of texts associated with these numbers.
146
147 <firstIdx>: first supported index
148 <lastIdx>: last supported index
149 <nlength>: maximum length of phone number
150 <tlength>: maximum length of associated text
151 */
152 GLOBAL T_ACI_RETURN tAT_PlusCPBR ( T_ACI_CMD_SRC srcId,
153 SHORT* firstIdx,
154 SHORT* lastIdx,
155 UBYTE* nlength,
156 UBYTE* tlength )
157 {
158 TRACE_FUNCTION ("tAT_PlusCPBR ()");
159
160 return(cmhPHB_get_phonebook_info(srcId, firstIdx, lastIdx, nlength, tlength));
161 }
162
163 /*
164 +--------------------------------------------------------------------+
165 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
166 | STATE : code ROUTINE : tAT_PlusCPBF |
167 +--------------------------------------------------------------------+
168
169 PURPOSE : This is the functional counterpart to the +CPBF=?
170 AT command which is responsible to test for the length of
171 phone numbers and the length of texts associated with
172 these numbers.
173
174 <nlength>: maximum length of phone number
175 <tlength>: maximum length of associated text
176 */
177 GLOBAL T_ACI_RETURN tAT_PlusCPBF ( T_ACI_CMD_SRC srcId,
178 UBYTE* nlength,
179 UBYTE* tlength )
180 {
181 SHORT firstIdx; /* dummy variable, not used */
182 SHORT lastIdx; /* dummy variable, not used */
183
184 TRACE_FUNCTION ("tAT_PlusCPBF ()");
185
186 return(cmhPHB_get_phonebook_info(srcId, &firstIdx, &lastIdx, nlength, tlength));
187 }
188
189 /*
190 +--------------------------------------------------------------------+
191 | PROJECT : GSM-PS (6147) MODULE : CMH_PHBT |
192 | STATE : code ROUTINE : tAT_PlusCPBW |
193 +--------------------------------------------------------------------+
194
195 PURPOSE : This is the functional counterpart to the +CPBW=?
196 AT command which is responsible to test for all supported
197 memory indices, the length of phone numbers and
198 the length of texts associated with these numbers.
199
200 <firstIdx>: first supported index
201 <lastIdx>: last supported index
202 <nlength>: maximum length of phone number
203 <tlength>: maximum length of associated text
204 */
205 GLOBAL T_ACI_RETURN tAT_PlusCPBW ( T_ACI_CMD_SRC srcId,
206 SHORT* firstIdx,
207 SHORT* lastIdx,
208 UBYTE* nlength,
209 UBYTE* tlength )
210 {
211 TRACE_FUNCTION ("tAT_PlusCPBW ()");
212
213 return(cmhPHB_get_phonebook_info(srcId, firstIdx, lastIdx, nlength, tlength));
214 }
215
216 /*==== EOF ========================================================*/