FreeCalypso > hg > tcs211-l1-reconst
comparison g23m/condat/ms/src/aci/psa_lc.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 : PSA_LC | |
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 defines the functions for the protocol | |
18 | stack adapter for location service | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef PSA_LC_C | |
23 #define PSA_LC_C | |
24 #endif | |
25 | |
26 #if defined FF_EOTD | |
27 #ifdef MFW | |
28 #define ENTITY_MFW | |
29 #else | |
30 #ifdef SMI | |
31 #define ENTITY_SMI | |
32 #else | |
33 #define ENTITY_ACI | |
34 #endif | |
35 #endif | |
36 | |
37 #define ACI_MEMBER | |
38 | |
39 #undef TRACING | |
40 | |
41 /*==== INCLUDES ===================================================*/ | |
42 | |
43 #include <string.h> | |
44 #include <stdlib.h> | |
45 #include "typedefs.h" | |
46 #include "pconst.cdg" | |
47 #include "mconst.cdg" | |
48 #include "message.h" | |
49 #include "ccdapi.h" | |
50 #include "vsi.h" | |
51 #include "custom.h" | |
52 #include "gsm.h" | |
53 #include "prim.h" | |
54 #include "cnf_aci.h" | |
55 #include "mon_aci.h" | |
56 #include "pei.h" | |
57 #include "tok.h" | |
58 #include "aci_cmh.h" | |
59 #include "ati_cmd.h" | |
60 #include "aci_cmd.h" | |
61 #include "aci.h" | |
62 #include "psa.h" | |
63 #include "psa_mm.h" | |
64 #include "psa_util.h" | |
65 | |
66 #include "cmh_lc.h" | |
67 #include "l4_tim.h" | |
68 #include "aci_lst.h" | |
69 | |
70 /*==== CONSTANTS ==================================================*/ | |
71 | |
72 | |
73 /*==== TYPES ======================================================*/ | |
74 | |
75 | |
76 /*==== EXPORT =====================================================*/ | |
77 EXTERN T_ACI_LIST *ati_src_list; | |
78 | |
79 /*==== VARIABLES ==================================================*/ | |
80 EXTERN USHORT used_lc_callref; | |
81 EXTERN UBYTE srcId_cb; | |
82 | |
83 /*==== FUNCTIONS ==================================================*/ | |
84 /* for hard coded AT commands | |
85 LOCAL UBYTE search_tim_handl(void); | |
86 */ | |
87 EXTERN UBYTE search_tim_handl(void); | |
88 /* | |
89 +-------------------------------------------------------------------+ | |
90 | PROJECT : GSM-PS (6147) MODULE : PSA_LC | | |
91 | ROUTINE : search_tim_handl | | |
92 +-------------------------------------------------------------------+ | |
93 | |
94 PURPOSE : This function searchs an unused timer handle for LC | |
95 */ | |
96 LOCAL const UBYTE lc_timer_list[]= | |
97 { | |
98 ACI_LC_1, | |
99 ACI_LC_2, | |
100 ACI_LC_3, | |
101 ACI_LC_4, | |
102 ACI_LC_5 | |
103 }; | |
104 /* for hard coded AT commands | |
105 LOCAL UBYTE search_tim_handl(void) | |
106 */ | |
107 EXTERN UBYTE search_tim_handl(void) | |
108 { | |
109 T_LOC_SERV_PARA *lc_list = 0; | |
110 T_LOC_SERV_CLIENT *lc_client = 0; | |
111 BOOL h_flag = FALSE; | |
112 char i; | |
113 | |
114 lc_list = &locServPrm; /* global structure LC parameters */ | |
115 | |
116 for(i= 0;i<5;i++) | |
117 { | |
118 TRACE_EVENT_P1("i=%d",i); | |
119 vsi_t_sleep(VSI_CALLER 10); | |
120 lc_client = lc_list->clients; | |
121 if(lc_client EQ NULL) | |
122 return (0); | |
123 do | |
124 { | |
125 TRACE_EVENT_P2("lc_client=%08x next=%08x",lc_client, lc_client->next); | |
126 vsi_t_sleep(VSI_CALLER 10); | |
127 if(lc_client->period_upd_timer EQ lc_timer_list[i]) | |
128 { | |
129 h_flag = TRUE; | |
130 break; | |
131 } | |
132 lc_client = lc_client->next; | |
133 } | |
134 while(lc_client NEQ NULL); | |
135 | |
136 if(!h_flag) | |
137 return lc_timer_list[i]; | |
138 } | |
139 return(0); | |
140 } | |
141 | |
142 | |
143 /* | |
144 +-------------------------------------------------------------------+ | |
145 | PROJECT : GSM-PS (6147) MODULE : PSA_LC | | |
146 | ROUTINE : psaLC_PosDataInd | | |
147 +-------------------------------------------------------------------+ | |
148 | |
149 PURPOSE : This function processes the primitive MNLC_SMS_MEAS_CNF | |
150 */ | |
151 GLOBAL const void psa_mnlc_sms_meas_cnf | |
152 (T_MNLC_SMS_MEAS_CNF *mnlc_sms_meas_cnf ) | |
153 { | |
154 T_LOC_SERV_PARA *p_lsprm = 0; | |
155 T_LOC_SERV_CLIENT *p_client = 0; | |
156 ULONG timer = 0; | |
157 T_ACI_CME_ERR err; | |
158 T_ATI_SRC_PARAMS *src_params = find_element( ati_src_list, locServPrm.lc_src_id, search_ati_src_id); | |
159 | |
160 TRACE_FUNCTION ("psa_mnlc_sms_meas_cnf()"); | |
161 | |
162 if(mnlc_sms_meas_cnf->data_valid EQ DATA_VALID) | |
163 { | |
164 p_lsprm = &locServPrm; /* global structure LC parameters */ | |
165 if(p_lsprm->lc_callReference EQ mnlc_sms_meas_cnf->reference) | |
166 { | |
167 used_lc_callref = used_lc_callref & ~(0x01 << p_lsprm->lc_callReference); | |
168 p_lsprm->lc_callReference = -1; | |
169 /* send cursorSmsText via sms...destination address */ | |
170 cmhSMS_MEASdeliver(mnlc_sms_meas_cnf->sms_text); | |
171 } | |
172 else | |
173 { | |
174 p_client = p_lsprm->clients; | |
175 if(p_client NEQ NULL) | |
176 { | |
177 do | |
178 { | |
179 TRACE_EVENT_P2("p_client=%08x next=%08x", p_client, p_client->next); | |
180 if(p_client->lc_clientReference EQ mnlc_sms_meas_cnf->reference) | |
181 { /* reset callreference of client */ | |
182 used_lc_callref = used_lc_callref & ~(0x01 << p_client->lc_clientReference); | |
183 p_client->lc_clientReference = -1; | |
184 /* send cursorSmsText via sms...destination address */ | |
185 cmhSMS_MEASdeliver(mnlc_sms_meas_cnf->sms_text); | |
186 /* check wether start of periodic update timer */ | |
187 if(eotd_periodic_update_flag EQ PERIODIC_UPDATE_ON AND | |
188 p_client->period_upd_status EQ PERIODIC_UP_ACTIVE) | |
189 { | |
190 timer = p_client->period_upd_value*60*1000;/* sec */ | |
191 if (p_client->period_upd_timer EQ 0) | |
192 p_client->period_upd_timer = search_tim_handl(); | |
193 if(p_client->period_upd_timer NEQ 0) | |
194 { | |
195 TRACE_EVENT_P2("SMS preriodic timer started index=%d timer=%lu",p_client->period_upd_timer, timer); | |
196 TIMERSTART( timer, p_client->period_upd_timer); | |
197 } | |
198 } | |
199 break; | |
200 } | |
201 p_client = p_client->next; | |
202 } | |
203 while(p_client NEQ NULL); | |
204 } | |
205 } | |
206 } | |
207 else /* !DATA_VALID */ | |
208 { | |
209 p_lsprm = &locServPrm; /* global structure LC parameters */ | |
210 if(p_lsprm->lc_callReference EQ mnlc_sms_meas_cnf->reference) | |
211 { | |
212 used_lc_callref = used_lc_callref & ~(0x01 << p_lsprm->lc_callReference); | |
213 p_lsprm->lc_callReference = -1; | |
214 } | |
215 else | |
216 { | |
217 p_client = p_lsprm->clients; | |
218 if(p_client NEQ NULL) | |
219 { | |
220 do | |
221 { | |
222 TRACE_EVENT_P2("p_client=%08x next=%08x", p_client, p_client->next); | |
223 #if 0 | |
224 if(p_client->lc_clientReference EQ mnlc_sms_meas_cnf->reference) | |
225 #else | |
226 if(p_client->lc_clientReference NEQ -1) | |
227 #endif | |
228 { /* reset callreference of client */ | |
229 used_lc_callref = used_lc_callref & ~(0x01 << p_client->lc_clientReference); | |
230 | |
231 p_client->lc_clientReference = -1; | |
232 /* check wether start of periodic update timer */ | |
233 if(eotd_periodic_update_flag EQ PERIODIC_UPDATE_ON AND | |
234 p_client->period_upd_status EQ PERIODIC_UP_ACTIVE) | |
235 { | |
236 timer = 5000;/* restart timer to repeat measurement when the failing condtion no longer exists */ | |
237 if (p_client->period_upd_timer EQ 0) | |
238 p_client->period_upd_timer = search_tim_handl(); | |
239 if(p_client->period_upd_timer NEQ 0) | |
240 { | |
241 TIMERSTART( timer, p_client->period_upd_timer); | |
242 TRACE_EVENT_P2("SMS timer restarted with index=%d timer=%d",p_client->period_upd_timer, timer); | |
243 } | |
244 } | |
245 break; | |
246 } | |
247 p_client = p_client->next; | |
248 } | |
249 while(p_client NEQ NULL); | |
250 } | |
251 } | |
252 if(src_params->curAtCmd EQ AT_CMD_CLPS) | |
253 { | |
254 srcId_cb = locServPrm.lc_src_id; | |
255 err = CME_ERR_Unknown; | |
256 rCI_PlusCME(AT_CMD_CLPS, err); | |
257 } | |
258 } | |
259 | |
260 PFREE(mnlc_sms_meas_cnf); | |
261 } | |
262 | |
263 | |
264 /* | |
265 +-------------------------------------------------------------------+ | |
266 | PROJECT : GSM-PS (6147) MODULE : PSA_LC | | |
267 | ROUTINE : psaLC_posDataReq | | |
268 +-------------------------------------------------------------------+ | |
269 | |
270 PURPOSE : This function handle the position data request | |
271 when the timer is expired | |
272 */ | |
273 GLOBAL void psaLC_posDataReq (USHORT index) | |
274 { | |
275 T_LOC_SERV_PARA *p_lsprm = 0; | |
276 T_LOC_SERV_CLIENT *p_client = 0; | |
277 USHORT lc_callref; | |
278 | |
279 TRACE_FUNCTION ("psaLC_posDataReq()"); | |
280 | |
281 p_lsprm = &locServPrm; /* global structure LC parameters */ | |
282 p_client = p_lsprm->clients; | |
283 if(p_client NEQ NULL) | |
284 { | |
285 do | |
286 { | |
287 TRACE_EVENT_P4("p_client=%08x next=%08x handle=%d index=%d", | |
288 p_client, p_client->next, p_client->period_upd_timer, index); | |
289 if(p_client->period_upd_timer EQ index) | |
290 { | |
291 p_client->period_upd_timer = 0; | |
292 /* start position data request */ | |
293 lc_callref = (USHORT)lc_callref_init(); | |
294 TRACE_EVENT_P1("lc_callref=%d", lc_callref); | |
295 if(lc_callref NEQ 0) | |
296 { | |
297 p_client->lc_clientReference = lc_callref; | |
298 cmhLC_posDataReq (p_client->client_id.address, | |
299 lc_callref); | |
300 } | |
301 } | |
302 p_client = p_client->next; | |
303 } | |
304 while(p_client NEQ NULL); | |
305 } | |
306 } | |
307 | |
308 | |
309 | |
310 #endif /* FF_EOTD */ | |
311 | |
312 | |
313 /*==== EOF ========================================================*/ | |
314 |