FreeCalypso > hg > leo2moko-debug
comparison g23m/condat/ms/src/aci/ati_lcs.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-F&D (8411) | |
4 | Modul : ATI | |
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 : AT Command Interpreter: Location service related commands. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef ATI_LCS_C | |
22 #define ATI_LCS_C | |
23 | |
24 #ifdef FF_EOTD | |
25 | |
26 #undef DUMMY_ATI_STRINGS | |
27 | |
28 #ifdef MFW | |
29 #define ENTITY_MFW | |
30 #else | |
31 #ifdef SMI | |
32 #define ENTITY_SMI | |
33 #else | |
34 #define ENTITY_ACI | |
35 #endif | |
36 #endif | |
37 #define ACI_MEMBER | |
38 | |
39 | |
40 #if 0 | |
41 #include <string.h> | |
42 #include <stdio.h> | |
43 #include <stdlib.h> | |
44 #include <ctype.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_io.h" | |
61 #include "aci_cmd.h" | |
62 #include "l4_tim.h" | |
63 #include "psa_uart.h" | |
64 #include "ati_io.h" | |
65 #include "aci.h" | |
66 #include "aci_mem.h" | |
67 #endif | |
68 | |
69 #include "aci_all.h" | |
70 /*==== INCLUDES ===================================================*/ | |
71 #include "aci_cmh.h" | |
72 #include "ati_cmd.h" | |
73 #include "aci_cmd.h" | |
74 #include "dti.h" /* functionality of the dti library */ | |
75 | |
76 #include "aci_lst.h" | |
77 #include "dti_conn_mng.h" | |
78 #ifdef UART | |
79 #include "psa_uart.h" | |
80 #include "cmh_uart.h" | |
81 #endif | |
82 #include "aci_io.h" | |
83 #include "aci_mem.h" | |
84 #include "aci.h" | |
85 #include "ati_io.h" | |
86 #include "ati_int.h" | |
87 | |
88 EXTERN T_ACI_LIST *ati_src_list; | |
89 | |
90 /*==== EXPORT ==================================================*/ | |
91 EXTERN CHAR *cmdCmsError ( T_ACI_CMS_ERR e ); | |
92 EXTERN CHAR *cmdExtError (T_ACI_EXT_ERR e); | |
93 EXTERN CHAR *parse(CHAR *b,CHAR *f, ...); | |
94 | |
95 /*==============================================================*/ | |
96 | |
97 | |
98 /* | |
99 +--------------------------------------------------------------------+ | |
100 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
101 | STATE : code ROUTINE : setatPlusCLSA | | |
102 +--------------------------------------------------------------------+ | |
103 | |
104 PURPOSE : +CLSA command | |
105 for test of location service | |
106 set source and destination addresses of | |
107 Mobile Location Center | |
108 */ | |
109 | |
110 GLOBAL T_ATI_RSLT setatPlusCLSA (char *cl, UBYTE srcId) | |
111 { | |
112 T_ACI_RETURN ret; | |
113 char mlcs[MAX_SMS_ADDR_DIG]; /* MLC source address */ | |
114 char mlcd[MAX_SMS_ADDR_DIG]; /* MLC destination address */ | |
115 memset (mlcs, 0, sizeof(mlcs)); | |
116 memset (mlcd, 0, sizeof(mlcd)); | |
117 | |
118 TRACE_FUNCTION("setatPlusCLSA()"); | |
119 | |
120 /* parse source and destination address strings */ | |
121 cl = parse(cl,"qq",(LONG)MAX_SMS_ADDR_DIG,mlcs,(LONG)MAX_SMS_ADDR_DIG,mlcd); | |
122 if (!cl OR (mlcs[0] EQ '\0') OR (mlcd[0] EQ '\0')) | |
123 { | |
124 cmdExtError(EXT_ERR_LCS_CmdNotRec); | |
125 return ATI_FAIL; | |
126 } | |
127 /* store source and destination MLC addresses */ | |
128 ret=sAT_PlusCLSA(srcId,mlcs,mlcd); | |
129 if (ret EQ AT_FAIL) | |
130 { | |
131 cmdCmeError(CME_ERR_Unknown); | |
132 return ATI_FAIL; | |
133 } | |
134 | |
135 return ATI_CMPL; | |
136 } | |
137 | |
138 | |
139 /* | |
140 +--------------------------------------------------------------------+ | |
141 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
142 | STATE : code ROUTINE : queatPlusCLSA | | |
143 +--------------------------------------------------------------------+ | |
144 | |
145 PURPOSE : +CLSA command | |
146 for test of location service | |
147 query source and destination addresses of | |
148 Service Mobile Location Center | |
149 */ | |
150 | |
151 GLOBAL T_ATI_RSLT queatPlusCLSA (char *cl, UBYTE srcId) | |
152 { | |
153 char mlcs[MAX_SMS_ADDR_DIG]; /* MLC source address */ | |
154 char mlcd[MAX_SMS_ADDR_DIG]; /* MLC destination address */ | |
155 memset (mlcs, 0, sizeof(mlcs)); | |
156 memset (mlcd, 0, sizeof(mlcd)); | |
157 | |
158 TRACE_FUNCTION("queatPlusCLSA()"); | |
159 | |
160 if (qAT_PlusCLSA(srcId,mlcs,mlcd) EQ AT_CMPL) | |
161 { | |
162 sprintf(g_sa,"+CLSA:%s,%s",mlcs,mlcd); | |
163 | |
164 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
165 } | |
166 else | |
167 { | |
168 cmdCmeError(CME_ERR_Unknown); | |
169 return ATI_FAIL; | |
170 } | |
171 return ATI_CMPL; | |
172 } | |
173 | |
174 /* | |
175 +--------------------------------------------------------------------+ | |
176 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
177 | STATE : code ROUTINE : setatPlusCLOM | | |
178 +--------------------------------------------------------------------+ | |
179 | |
180 PURPOSE : +CLOM command | |
181 set feature flag Location Service | |
182 handle list of LC clients | |
183 store list in FFS | |
184 */ | |
185 | |
186 GLOBAL T_ATI_RSLT setatPlusCLOM (char *cl, UBYTE srcId) | |
187 { | |
188 T_ACI_RETURN ret; | |
189 char client_id[MAX_SMS_ADDR_DIG]; /* Client identifier */ | |
190 char clom_set; | |
191 | |
192 TRACE_FUNCTION("setatPlusCLOM()"); | |
193 | |
194 memset (client_id, 0, sizeof(client_id)); | |
195 | |
196 /* parse CLOM setting and Client Id (optional) */ | |
197 cl = parse(cl,"xq",&clom_set,(LONG)MAX_SMS_ADDR_DIG,client_id); | |
198 if (!cl) | |
199 { | |
200 cmdExtError(EXT_ERR_LCS_CmdNotRec);; | |
201 return ATI_FAIL; | |
202 } | |
203 /* handle settings and store in FFS */ | |
204 ret=sAT_PlusCLOM(srcId,clom_set,client_id); | |
205 if (ret EQ AT_FAIL) | |
206 { | |
207 cmdCmeError(CME_ERR_Unknown); | |
208 return ATI_FAIL; | |
209 } | |
210 | |
211 return ATI_CMPL; | |
212 } | |
213 | |
214 /* | |
215 +--------------------------------------------------------------------+ | |
216 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
217 | STATE : code ROUTINE : queatPlusCLOM | | |
218 +--------------------------------------------------------------------+ | |
219 | |
220 PURPOSE : +CLOM command | |
221 query current Operational Mode settings of | |
222 Location Service | |
223 */ | |
224 /**************************/ | |
225 EXTERN T_LOC_SERV_PARA locServPrm; /* list of LC clients */ | |
226 EXTERN BOOL location_service_flag; | |
227 EXTERN BOOL eotd_periodic_update_flag; | |
228 /**************************/ | |
229 GLOBAL T_ATI_RSLT queatPlusCLOM (char *cl, UBYTE srcId) | |
230 { | |
231 UBYTE num_clients; | |
232 T_LOC_SERV_PARA *lc_client_list = 0; | |
233 T_LOC_SERV_CLIENT *lc_client = 0; | |
234 | |
235 TRACE_FUNCTION("queatPlusCLOM()"); | |
236 TRACE_EVENT_P4("num_client=%d location_service_flag=%d eotd_periodic_update_flag=%d clients=%08x", | |
237 locServPrm.numb_lc_clients, | |
238 location_service_flag, | |
239 eotd_periodic_update_flag, | |
240 locServPrm.clients); | |
241 if (locServPrm.clients) | |
242 { | |
243 lc_client = locServPrm.clients; | |
244 while (lc_client) | |
245 { | |
246 TRACE_EVENT_P4("client status=%d addr=%s ton=%d npi=%d", lc_client->client_status, | |
247 lc_client->client_id.address, | |
248 lc_client->client_id.toa.ton, | |
249 lc_client->client_id.toa.npi); | |
250 lc_client = lc_client->next; | |
251 } | |
252 lc_client = 0; | |
253 } | |
254 TRACE_EVENT_P6("SC_sAddr=%s ton=%d npi=%d SC_dAddr=%s ton=%d npi=%d", | |
255 locServPrm.mlcsrc.address, locServPrm.mlcsrc.toa.ton, locServPrm.mlcsrc.toa.npi, | |
256 locServPrm.mlcdest.address, locServPrm.mlcdest.toa.ton, locServPrm.mlcdest.toa.npi); | |
257 | |
258 if (qAT_PlusCLOM(srcId,&num_clients,&lc_client_list) EQ AT_CMPL) | |
259 { | |
260 if(lc_client_list EQ NULL) | |
261 { | |
262 cmdCmeError(CME_ERR_Unknown); | |
263 return ATI_FAIL; | |
264 } | |
265 if(!num_clients) /* list of clients is empty */ | |
266 { | |
267 sprintf(g_sa,"+CLOM:%d",num_clients); | |
268 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
269 } | |
270 else | |
271 { | |
272 sprintf(g_sa,"+CLOM:%d",num_clients); | |
273 lc_client = lc_client_list->clients; | |
274 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
275 memset(g_sa,0,(KEY + 2*MAX_SMS_ADDR_DIG)); | |
276 while(num_clients) | |
277 { | |
278 if(lc_client->client_id.toa.ton EQ TON_International) | |
279 sprintf(g_sa,"%d,+%s",lc_client->client_status,lc_client->client_id.address); | |
280 else | |
281 sprintf(g_sa,"%d,%s",lc_client->client_status,lc_client->client_id.address); | |
282 lc_client = lc_client->next; | |
283 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
284 memset(g_sa,0,(KEY + 2*MAX_SMS_ADDR_DIG)); | |
285 num_clients--; | |
286 } | |
287 } | |
288 } | |
289 else | |
290 { | |
291 cmdCmeError(CME_ERR_Unknown); | |
292 return ATI_FAIL; | |
293 } | |
294 return ATI_CMPL; | |
295 } | |
296 | |
297 | |
298 /* | |
299 +--------------------------------------------------------------------+ | |
300 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
301 | STATE : code ROUTINE : setatPlusCLPS | | |
302 +--------------------------------------------------------------------+ | |
303 | |
304 PURPOSE : +CLPS command | |
305 set feature flag Periodic Update Timer | |
306 set timer for specific LC client | |
307 request position data | |
308 */ | |
309 | |
310 GLOBAL T_ATI_RSLT setatPlusCLPS (char *cl, UBYTE srcId) | |
311 { | |
312 T_ACI_RETURN ret; | |
313 char client_id[MAX_SMS_ADDR_DIG]; /* Client identifier */ | |
314 char clps_set; | |
315 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id); | |
316 USHORT lc_timer = 0; | |
317 | |
318 TRACE_FUNCTION("setatPlusCLPS()"); | |
319 | |
320 memset (client_id, 0, sizeof(client_id)); | |
321 | |
322 /* parse CLPS setting,Client Id (optional) and Client timer (optional) */ | |
323 cl = parse(cl,"xqr",&clps_set,(LONG)MAX_SMS_ADDR_DIG,client_id,&lc_timer); | |
324 if (!cl) | |
325 { | |
326 cmdExtError(EXT_ERR_LCS_CmdNotRec); | |
327 return ATI_FAIL; | |
328 } | |
329 /* handle settings and store in FFS */ | |
330 ret=sAT_PlusCLPS(srcId,clps_set,client_id,lc_timer); | |
331 if (ret EQ AT_FAIL) | |
332 { | |
333 cmdCmeError(CME_ERR_Unknown); | |
334 return ATI_FAIL; | |
335 } | |
336 | |
337 return ATI_CMPL; | |
338 } | |
339 | |
340 /* | |
341 +--------------------------------------------------------------------+ | |
342 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
343 | STATE : code ROUTINE : queatPlusCLPS | | |
344 +--------------------------------------------------------------------+ | |
345 | |
346 PURPOSE : +CLPS command | |
347 query periodic update settings | |
348 */ | |
349 | |
350 GLOBAL T_ATI_RSLT queatPlusCLPS (char *cl, UBYTE srcId) | |
351 { | |
352 UBYTE num_clients,num_clients_test,num_per_clients=0; | |
353 T_LOC_SERV_PARA *lc_client_list = 0; | |
354 T_LOC_SERV_CLIENT *lc_client = 0; | |
355 | |
356 TRACE_FUNCTION("queatPlusCLPS()"); | |
357 | |
358 if (qAT_PlusCLPS(srcId,&num_clients,&lc_client_list) EQ AT_CMPL) | |
359 { | |
360 if(lc_client_list EQ NULL) | |
361 { | |
362 cmdCmeError(CME_ERR_Unknown); | |
363 return ATI_FAIL; | |
364 } | |
365 if(!num_clients) /* list of clients is empty */ | |
366 { | |
367 sprintf(g_sa,"+CLPS:%d",num_clients); | |
368 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
369 } | |
370 else | |
371 { | |
372 lc_client = lc_client_list->clients; | |
373 num_clients_test = num_clients; | |
374 while(num_clients_test) | |
375 { | |
376 if(lc_client->period_upd_status EQ PERIODIC_UP_ACTIVE) | |
377 num_per_clients++; | |
378 lc_client = lc_client->next; | |
379 num_clients_test--; | |
380 } | |
381 | |
382 sprintf(g_sa,"+CLPS:%d",num_per_clients); | |
383 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
384 memset(g_sa,0,(KEY + 2*MAX_SMS_ADDR_DIG)); | |
385 lc_client = lc_client_list->clients; | |
386 while(num_clients) | |
387 { | |
388 if(lc_client->client_id.toa.ton EQ TON_International) | |
389 { | |
390 if(lc_client->period_upd_status EQ PERIODIC_UP_ACTIVE) | |
391 sprintf(g_sa,"+%s,%d",lc_client->client_id.address,lc_client->period_upd_value); | |
392 } | |
393 else | |
394 { | |
395 if(lc_client->period_upd_status EQ PERIODIC_UP_ACTIVE) | |
396 sprintf(g_sa,"%s,%d",lc_client->client_id.address,lc_client->period_upd_value); | |
397 } | |
398 lc_client = lc_client->next; | |
399 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
400 memset(g_sa,0,(KEY + 2*MAX_SMS_ADDR_DIG)); | |
401 num_clients--; | |
402 } | |
403 } | |
404 } | |
405 else | |
406 { | |
407 cmdCmeError(CME_ERR_Unknown); | |
408 return ATI_FAIL; | |
409 } | |
410 return ATI_CMPL; | |
411 } | |
412 | |
413 /* | |
414 +--------------------------------------------------------------------+ | |
415 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
416 | STATE : code ROUTINE : setatPlusCLSR | | |
417 +--------------------------------------------------------------------+ | |
418 | |
419 PURPOSE : +CLSR command | |
420 set user privacy data: notify, confirmation | |
421 request position data: currently not supported (RM 10-25-02) | |
422 set up call to client_id and/or to second address: | |
423 currently not supported (RM 10-25-02) | |
424 */ | |
425 | |
426 GLOBAL T_ATI_RSLT setatPlusCLSR (char *cl, UBYTE srcId) | |
427 { | |
428 T_ACI_RETURN ret; | |
429 char client_id[MAX_SMS_ADDR_DIG]; /* Client identifier */ | |
430 char clsr_notify; | |
431 char clsr_confirmation; | |
432 | |
433 TRACE_FUNCTION("setatPlusCLSR()"); | |
434 | |
435 memset (client_id, 0, sizeof(client_id)); | |
436 | |
437 /* parse CLSR settings: Client notify state, Client confirmation state, Client Id */ | |
438 cl = parse(cl,"xxq",&clsr_notify,&clsr_confirmation,(LONG)MAX_SMS_ADDR_DIG,client_id); | |
439 if (!cl) | |
440 { | |
441 cmdExtError(EXT_ERR_LCS_CmdNotRec); | |
442 return ATI_FAIL; | |
443 } | |
444 /* handle settings and store in FFS */ | |
445 ret=sAT_PlusCLSR(srcId,clsr_notify,clsr_confirmation,client_id); | |
446 if (ret EQ AT_FAIL) | |
447 { | |
448 cmdCmeError(CME_ERR_Unknown); | |
449 return ATI_FAIL; | |
450 } | |
451 return ATI_CMPL; | |
452 } | |
453 | |
454 /* | |
455 +--------------------------------------------------------------------+ | |
456 | PROJECT : GSM-F&D (8411) MODULE : ACI_CMD | | |
457 | STATE : code ROUTINE : queatPlusCLSR | | |
458 +--------------------------------------------------------------------+ | |
459 | |
460 PURPOSE : +CLSR command | |
461 query | |
462 */ | |
463 | |
464 GLOBAL T_ATI_RSLT queatPlusCLSR (char *cl, UBYTE srcId) | |
465 { | |
466 return ATI_CMPL; | |
467 } | |
468 | |
469 #endif /* FF_EOTD */ | |
470 | |
471 #endif /* ATI_LCS_C */ |