FreeCalypso > hg > tcs211-fcmodem
comparison g23m/condat/ms/src/bmi/mmiEm.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 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Basic MMI | |
13 $Project code: BMI (6349) | |
14 $Module: MMI | |
15 $File: MmiEm.c | |
16 $Revision: 1.0 | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: 23/09/02 | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: | |
24 | |
25 MMI engineering mode handling | |
26 | |
27 ******************************************************************************** | |
28 $History: MmiExtras.c | |
29 | |
30 23/09/02 Original Condat(UK) BMI version. | |
31 | |
32 $End | |
33 | |
34 *******************************************************************************/ | |
35 | |
36 | |
37 | |
38 | |
39 /******************************************************************************* | |
40 | |
41 Include Files | |
42 | |
43 *******************************************************************************/ | |
44 #define ENTITY_MFW | |
45 | |
46 /* includes */ | |
47 #include <string.h> | |
48 #include <stdio.h> | |
49 #include <stdlib.h> | |
50 | |
51 #if defined (NEW_FRAME) | |
52 | |
53 #include "typedefs.h" | |
54 #include "vsi.h" | |
55 #include "pei.h" | |
56 #include "custom.h" | |
57 #include "gsm.h" | |
58 | |
59 #else | |
60 | |
61 #include "STDDEFS.H" | |
62 #include "custom.h" | |
63 #include "gsm.h" | |
64 #include "vsi.h" | |
65 | |
66 #endif | |
67 #include "mfw_sys.h" | |
68 | |
69 #include "prim.h" | |
70 #include "cus_aci.h" | |
71 | |
72 #include "mfw_mfw.h" | |
73 #include "mfw_win.h" | |
74 #include "mfw_kbd.h" | |
75 /* SPR#1428 - SH - New Editor changes */ | |
76 #ifndef NEW_EDITOR | |
77 #include "mfw_edt.h" | |
78 #endif | |
79 #include "mfw_lng.h" | |
80 #include "mfw_tim.h" | |
81 #include "mfw_icn.h" | |
82 #include "mfw_mnu.h" | |
83 #include "mfw_phb.h" | |
84 #include "mfw_cm.h" | |
85 #include "mfw_sim.h" | |
86 #include "mfw_nm.h" | |
87 #include "mfw_sat.h" | |
88 #include "mfw_ss.h" /*for convert*/ | |
89 #include "mfw_phb.h" | |
90 #include "ksd.h" | |
91 #include "psa.h" | |
92 #include "mfw_sms.h" | |
93 #include "mfw_cphs.h" | |
94 #include "mfw_sat.h" | |
95 #include "Mfw_band.h" | |
96 #include "mfw_ffs.h" | |
97 | |
98 #include "dspl.h" | |
99 | |
100 #include "MmiMmi.h" | |
101 #include "MmiDialogs.h" | |
102 #include "MmiLists.h" | |
103 #include "MmiBand.h" | |
104 #include "MmiCPHS.h" | |
105 /* SPR#1428 - SH - New Editor changes */ | |
106 #ifdef NEW_EDITOR | |
107 #include "ATBCommon.h" | |
108 #include "ATBDisplay.h" | |
109 #include "ATBEditor.h" | |
110 #include "AUIEditor.h" | |
111 #else | |
112 #include "MmiEditor.h" | |
113 #endif | |
114 #include"MmiBookShared.h" | |
115 | |
116 | |
117 #include "Mfw_em.h" | |
118 #include "MmiEm.h" | |
119 | |
120 #include "mmiColours.h" | |
121 | |
122 | |
123 #define EM_UPDATE_RATE 1000 | |
124 | |
125 #define EM_EDITOR_SIZE 300 /*SPR 1757, increased size of editor buffer*/ | |
126 /* | |
127 **************************************Datatypes**************************************** | |
128 */ | |
129 typedef struct _tEmData_ | |
130 { | |
131 /* administrative data */ | |
132 | |
133 T_MMI_CONTROL mmi_control; | |
134 T_MFW_HND win; | |
135 T_MFW_HND parent_win; | |
136 | |
137 /* associated handlers */ | |
138 | |
139 T_MFW_HND kbd; /*keyboard handler*/ | |
140 T_MFW_HND tim; /*timer handler*/ | |
141 | |
142 /* SPR#1428 - SH - New Editor changes */ | |
143 #ifdef NEW_EDITOR | |
144 T_ED_DATA * editor; | |
145 T_ED_ATTR editor_attr; | |
146 #else /* NEW_EDITOR */ | |
147 T_MFW_HND edt; /*mfw editor handler*/ | |
148 MfwEdtAttr editor_data; /*editor config data*/ | |
149 #endif /* NEW_EDITOR */ | |
150 | |
151 /* internal data */ | |
152 char edtBuffer[EM_EDITOR_SIZE*2];/*SPR 1757*//*editor contentbuffer*/ | |
153 MfwEmDataType CurrentWindow; /*type of data being displayed*/ | |
154 | |
155 } tEmData; | |
156 | |
157 | |
158 /* | |
159 **************************************Prototypes**************************************** | |
160 */ | |
161 int Mmi_em_event_cb(T_MFW_EVENT event, T_MFW_HND para); //Handles events from the MFW | |
162 T_MFW_HND Mmi_em_create(T_MFW_HND parent_window, MfwEmDataType data_type); //Create a window to display the information, specifying the keyboard, display and timer handlers. | |
163 void Mmi_em_destroy(T_MFW_HND own_window); //Deallocate window data and delete window. | |
164 int Mmi_em_kbd_cb(T_MFW_EVENT event,T_MFW_KBD * kc ); //Handles key presses in the display window | |
165 int Mmi_em_win_cb(T_MFW_EVENT event,T_MFW_WIN * win );// Handles the information display. | |
166 void Mmi_em_tim_cb(T_MFW_EVENT event,T_MFW_TIM * t); //Handles the timer events. | |
167 | |
168 | |
169 | |
170 | |
171 /* | |
172 **************************************Public functions**************************************** | |
173 */ | |
174 | |
175 | |
176 /******************************************************************************* | |
177 | |
178 $Function: mmi_em_init() | |
179 | |
180 $Description: initialise Engineering Mode module | |
181 | |
182 $Returns: None | |
183 | |
184 $Arguments: None | |
185 | |
186 *******************************************************************************/ | |
187 void mmi_em_init() | |
188 { | |
189 Mfw_em_init(); | |
190 | |
191 } | |
192 | |
193 /******************************************************************************* | |
194 | |
195 $Function: mmi_em_enit() | |
196 | |
197 $Description: exit Engineering Mode module | |
198 | |
199 $Returns: None | |
200 | |
201 $Arguments: None | |
202 | |
203 *******************************************************************************/ | |
204 void mmi_em_exit() | |
205 { | |
206 Mfw_em_exit(); | |
207 } | |
208 | |
209 /******************************************************************************* | |
210 | |
211 $Function: mmi_em_start_eng_mode_menus() | |
212 | |
213 $Description: starts the emergency mode menu | |
214 | |
215 $Returns: None | |
216 | |
217 $Arguments: parent window | |
218 | |
219 *******************************************************************************/ | |
220 void mmi_em_start_eng_mode_menus(T_MFW_HND parent) | |
221 { | |
222 TRACE_EVENT("mmi_em_start_eng_mode_menus"); | |
223 bookMenuStart(parent, EngModeAttributes(), NULL); | |
224 | |
225 } | |
226 | |
227 /******************************************************************************* | |
228 | |
229 $Function: Mmi_em_display_mobile_info_data() | |
230 | |
231 $Description: Called from menu; begins process to display Mobile Information | |
232 | |
233 $Returns: status integer | |
234 | |
235 $Arguments: menu and item (not used) | |
236 | |
237 *******************************************************************************/ | |
238 | |
239 | |
240 int Mmi_em_display_mobile_info_data(MfwMnu* m, MfwMnuItem* i) | |
241 { T_MFW_HND parent = mfwParent( mfw_header()); | |
242 TRACE_EVENT_P1("Mmi_em_display_mobile_info(), parent win %d", parent); | |
243 TRACE_EVENT_P1("Memory left:%d", mfwCheckMemoryLeft()); | |
244 Mmi_em_create(parent, EM_MOBILE_INFO); | |
245 | |
246 return MFW_EVENT_CONSUMED; | |
247 } | |
248 /******************************************************************************* | |
249 | |
250 $Function: Mmi_em_display_serving_cell_params() | |
251 | |
252 $Description: Called from menu; begins process to display Serving Cell parameters | |
253 | |
254 $Returns: status integer | |
255 | |
256 $Arguments: menu and item (not used) | |
257 | |
258 *******************************************************************************/ | |
259 | |
260 int Mmi_em_display_serving_cell_params(MfwMnu* m, MfwMnuItem* i) | |
261 { T_MFW_HND parent = mfwParent( mfw_header()); | |
262 TRACE_EVENT_P1("MMiEm, Memory left:%d", mfwCheckMemoryLeft()); | |
263 Mmi_em_create(parent, EM_SERVING_CELL_PARAMS); | |
264 | |
265 return MFW_EVENT_CONSUMED; | |
266 } | |
267 /******************************************************************************* | |
268 | |
269 $Function: Mmi_em_display_neighbour_cell_params() | |
270 | |
271 $Description: Called from menu; begins process to display Neighbouring Cell parameters | |
272 | |
273 $Returns: status integer | |
274 | |
275 $Arguments: menu and item (not used) | |
276 | |
277 *******************************************************************************/ | |
278 int Mmi_em_display_neighbour_cell_params(MfwMnu* m, MfwMnuItem* i) | |
279 { T_MFW_HND parent = mfwParent( mfw_header()); | |
280 TRACE_EVENT_P1("MMiEm, Memory left:%d", mfwCheckMemoryLeft()); | |
281 Mmi_em_create(parent, EM_NEIGHBOURING_CELL_PARAMS); | |
282 | |
283 return MFW_EVENT_CONSUMED; | |
284 } | |
285 | |
286 /******************************************************************************* | |
287 | |
288 $Function: Mmi_em_display_location_params() | |
289 | |
290 $Description: Called from menu; begins process to display Locationparameters | |
291 | |
292 $Returns: status integer | |
293 | |
294 $Arguments: menu and item (not used) | |
295 | |
296 *******************************************************************************/ | |
297 int Mmi_em_display_location_params(MfwMnu* m, MfwMnuItem*i ) | |
298 { T_MFW_HND parent = mfwParent( mfw_header()); | |
299 | |
300 Mmi_em_create(parent, EM_LOCATION_PARAMS); | |
301 | |
302 return MFW_EVENT_CONSUMED; | |
303 } | |
304 | |
305 /******************************************************************************* | |
306 | |
307 $Function: Mmi_em_display_ciph_hop_DTX_params() | |
308 | |
309 $Description: Called from menu; begins process to display Ciphering, hopping and | |
310 discontinuous transmission parameters | |
311 | |
312 $Returns: status integer | |
313 | |
314 $Arguments: menu and item (not used) | |
315 | |
316 *******************************************************************************/ | |
317 int Mmi_em_display_ciph_hop_DTX_params(MfwMnu* m, MfwMnuItem* i) | |
318 { T_MFW_HND parent = mfwParent( mfw_header()); | |
319 TRACE_EVENT_P1("MMiEm, Memory left:%d", mfwCheckMemoryLeft()); | |
320 Mmi_em_create(parent, EM_CIPH_HOP_DTX_PARAMS); | |
321 | |
322 return MFW_EVENT_CONSUMED; | |
323 } | |
324 | |
325 /******************************************************************************* | |
326 | |
327 $Function: Mmi_em_display_GPRS_params() | |
328 | |
329 $Description: Called from menu; begins process to display GPRS specific parameters | |
330 | |
331 $Returns: status integer | |
332 | |
333 $Arguments: menu and item (not used) | |
334 | |
335 *******************************************************************************/ | |
336 | |
337 int Mmi_em_display_GPRS_params(MfwMnu* m, MfwMnuItem* i) | |
338 { T_MFW_HND parent = mfwParent( mfw_header()); | |
339 TRACE_EVENT_P1("MMiEm, Memory left:%d", mfwCheckMemoryLeft()); | |
340 Mmi_em_create(parent, EM_GPRS_PARAMS); | |
341 | |
342 return MFW_EVENT_CONSUMED; | |
343 } | |
344 | |
345 /* | |
346 ************************************Internal Functions************************************** | |
347 */ | |
348 | |
349 /******************************************************************************* | |
350 | |
351 $Function: Mmi_em_create() | |
352 | |
353 $Description: Creates emergency mode display window | |
354 | |
355 $Returns: window handle | |
356 | |
357 $Arguments: parent window, kind of data to be displayed | |
358 | |
359 *******************************************************************************/ | |
360 | |
361 T_MFW_HND Mmi_em_create(T_MFW_HND parent_window, MfwEmDataType data_type) | |
362 { | |
363 tEmData * data = (tEmData *)ALLOC_MEMORY (sizeof (tEmData )); | |
364 T_MFW_WIN * win; | |
365 | |
366 if (data EQ NULL) | |
367 { | |
368 return NULL; | |
369 } | |
370 | |
371 // Create window handler | |
372 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (MfwCb)Mmi_em_win_cb); | |
373 if (data->win EQ NULL) | |
374 { | |
375 | |
376 return NULL; | |
377 } | |
378 TRACE_EVENT_P1("Mmi_em_create(), data->win %d", data->win); | |
379 //no window event handler needed | |
380 data->mmi_control.dialog = (T_DIALOG_FUNC)NULL; | |
381 data->mmi_control.data = data; | |
382 | |
383 data->kbd = kbd_create (data->win, KEY_ALL, (T_MFW_CB)Mmi_em_kbd_cb); | |
384 | |
385 /*Mobile Info is the only data screen which doesn't need to be updated every second*/ | |
386 if (data_type != EM_MOBILE_INFO) | |
387 { data->tim = tim_create(data->win, EM_UPDATE_RATE, (T_MFW_CB)Mmi_em_tim_cb); | |
388 timStart(data->tim);//start timer | |
389 } | |
390 | |
391 | |
392 /*populate the user data*/ | |
393 win = ((T_MFW_HDR *)data->win)->data; | |
394 win->user = (void *)data; | |
395 data->parent_win = parent_window; | |
396 | |
397 /* SPR#1428 - SH - New Editor changes */ | |
398 #ifdef NEW_EDITOR | |
399 /*SPR 1757, removed code for Chinese special case*/ | |
400 AUI_edit_SetAttr(&data->editor_attr, EM_CREATE_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT, ED_MODE_READONLY, ED_CURSOR_NONE, ATB_DCS_ASCII, (UBYTE *)data->edtBuffer,EM_EDITOR_SIZE); | |
401 data->editor = ATB_edit_Create(&data->editor_attr,0); | |
402 /*Clear editor buffer*/ | |
403 memset(data->edtBuffer, 0, sizeof(EM_EDITOR_SIZE*2)); | |
404 ATB_edit_Init(data->editor); | |
405 #else /* NEW_EDITOR */ | |
406 /*SPR 1757, removed code for Chinese special case*/ | |
407 bookSetEditAttributes(EM_CREATE_EDITOR,COLOUR_EDITOR_XX,0,edtCurNone,0,data->edtBuffer,EM_EDITOR_SIZE*2,&data->editor_data); | |
408 data->edt = edtCreate(data->win, &data->editor_data, NULL, NULL); | |
409 edtUnhide( data->edt ); | |
410 /*Clear editor buffer*/ | |
411 memset(data->edtBuffer, 0, sizeof(EM_EDITOR_SIZE*2)); | |
412 #endif /* NEW_EDITOR */ | |
413 | |
414 /*Make sure we store the kind of window we want to show*/ | |
415 data->CurrentWindow = data_type; | |
416 | |
417 /*bind the MFW event handler to any events from the MFW Eng Mode module*/ | |
418 Mfw_em_create(data->win, 0xFF, (MfwCb)Mmi_em_event_cb); | |
419 Mfw_em_get_data(data_type);/*ask MFW for the required data*/ | |
420 win_show(data->win);/*show the screen*/ | |
421 return data->win; | |
422 | |
423 } | |
424 | |
425 /******************************************************************************* | |
426 | |
427 $Function: Mmi_em_event_cb() | |
428 | |
429 $Description: Handles events coming from the MFW | |
430 | |
431 $Returns: status integer | |
432 | |
433 $Arguments: event type, pointer to data | |
434 | |
435 *******************************************************************************/ | |
436 int Mmi_em_event_cb(T_MFW_EVENT event,void* para) | |
437 { T_MFW_HND win = mfw_parent (mfw_header()); | |
438 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
439 tEmData * data = (tEmData *)win_data->user; | |
440 | |
441 MFW_EM_Mobile_Info* mob_info; | |
442 MFW_EM_Serving_Cell_Parameters* sc_info; | |
443 MFW_EM_Neighbour_Cell_Parameters* nc_info; | |
444 MFW_EM_Location_Parameters* loc_info; | |
445 MFW_EM_Ciph_hop_DTX_Parameters* ciph_hop_dtx_info; | |
446 MFW_EM_GPRS_Parameter* gprs_info; | |
447 char * DTX_Status; | |
448 char temp_buffer[EM_EDITOR_SIZE];/*SPR 1757 temporary buffer to hold information*/ | |
449 #ifdef NEW_EDITOR | |
450 T_ATB_TEXT temp_text;/*SPR 1757*/ | |
451 #endif | |
452 TRACE_EVENT_P1("Mmi_em_event_cb(), event:%d", event); | |
453 | |
454 memset(temp_buffer, 0, EM_EDITOR_SIZE); | |
455 | |
456 /*if event matches current window type*/ | |
457 if (event == data->CurrentWindow) | |
458 { switch (event) | |
459 { | |
460 case EM_MOBILE_INFO: | |
461 { mob_info = (MFW_EM_Mobile_Info*)para;/*cast parameter to appropriate type*/ | |
462 /*copy data to editor buffer*/ | |
463 /*MC, SPR 1554 Added all SW versions to editor string*/ | |
464 sprintf(temp_buffer, "SIM_VERSION:%d CC_VERSION:%d SS_VERSION:%d SMS_VERSION:%d MM_VERSION:%d RR_VERSION:%d DL_VERSION:%d ALR_VERSION:%d IMEI:%s IMSI:%s TMSI:%u", | |
465 mob_info->SIM_version, mob_info->CC_version, mob_info->SS_version, | |
466 mob_info->SMS_version, mob_info->MM_version, mob_info->RR_version, | |
467 mob_info->DL_version, mob_info->ALR_version,mob_info->IMEI, mob_info->IMSI, | |
468 mob_info->TMSI); | |
469 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
470 #ifdef NEW_EDITOR | |
471 /*SPR 1757 Insert temp buffer into editor*/ | |
472 temp_text.data = (UBYTE*)temp_buffer; | |
473 temp_text.dcs = ATB_DCS_ASCII; | |
474 ATB_string_Length(&temp_text); | |
475 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
476 ATB_edit_ClearAll(data->editor); | |
477 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
478 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
479 ATB_edit_Refresh(data->editor); | |
480 #else /* !NEW_EDITOR */ | |
481 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
482 #endif | |
483 win_show(data->win);/*show data*/ | |
484 } | |
485 break; | |
486 case EM_SERVING_CELL_PARAMS: | |
487 { | |
488 sc_info = (MFW_EM_Serving_Cell_Parameters*)para;/*cast parameter to appropriate type*/ | |
489 sprintf(temp_buffer, "ARFCN:%d RSSI:%d RXQ:%d RLT:%d C1:%d C2:%d LAC:%d BSIC:%d TAV:%d",\ | |
490 sc_info->arfcn, sc_info->RSSI, sc_info->RXQ, sc_info->RLT, sc_info->C1, sc_info->C2,\ | |
491 sc_info->LAC, sc_info->BSIC, sc_info->TAV); | |
492 | |
493 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
494 #ifdef NEW_EDITOR | |
495 /*SPR 1757 Insert temp buffer into editor*/ | |
496 temp_text.data = (UBYTE*)temp_buffer; | |
497 temp_text.dcs = ATB_DCS_ASCII; | |
498 ATB_string_Length(&temp_text); | |
499 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
500 ATB_edit_ClearAll(data->editor); | |
501 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
502 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
503 ATB_edit_Refresh(data->editor); | |
504 #else /* !NEW_EDITOR */ | |
505 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
506 #endif | |
507 win_show(data->win); | |
508 } | |
509 break; | |
510 case EM_NEIGHBOURING_CELL_PARAMS: | |
511 { nc_info = (MFW_EM_Neighbour_Cell_Parameters*)para;/*cast parameter to appropriate type*/ | |
512 /*copy data to editor buffer*/ | |
513 sprintf(temp_buffer, "NUM:%d\nARFCN:RSSI:C2:LAC:BSIC\n %5d%5d%5d%6d%5d\n %5d%5d%5d%6d%5d\n %5d%5d%5d%6d%5d\n %5d%5d%5d%6d%5d\n %5d%5d%5d%6d%5d\n %5d%5d%5d%6d%5d\n SC%4d%5d%5d%6d%5d",\ | |
514 nc_info->NUM,\ | |
515 nc_info->arfcn[0], nc_info->RSSI[0], nc_info->C2[0], nc_info->LAC_NC[0], nc_info->BSIC_NC[0],\ | |
516 nc_info->arfcn[1], nc_info->RSSI[1], nc_info->C2[1], nc_info->LAC_NC[1], nc_info->BSIC_NC[1],\ | |
517 nc_info->arfcn[2], nc_info->RSSI[2], nc_info->C2[2], nc_info->LAC_NC[2], nc_info->BSIC_NC[2],\ | |
518 nc_info->arfcn[3], nc_info->RSSI[3], nc_info->C2[3], nc_info->LAC_NC[3], nc_info->BSIC_NC[3],\ | |
519 nc_info->arfcn[4], nc_info->RSSI[4], nc_info->C2[4], nc_info->LAC_NC[4], nc_info->BSIC_NC[4],\ | |
520 nc_info->arfcn[5], nc_info->RSSI[5], nc_info->C2[5], nc_info->LAC_NC[5], nc_info->BSIC_NC[5],\ | |
521 nc_info->arfcn[6], nc_info->RSSI[6], nc_info->C2[6], nc_info->LAC_NC[6], nc_info->BSIC_NC[6]); | |
522 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
523 #ifdef NEW_EDITOR | |
524 /*SPR 1757 Insert temp buffer into editor*/ | |
525 temp_text.data = (UBYTE*)temp_buffer; | |
526 temp_text.dcs = ATB_DCS_ASCII; | |
527 ATB_string_Length(&temp_text); | |
528 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
529 ATB_edit_ClearAll(data->editor); | |
530 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
531 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
532 ATB_edit_Refresh(data->editor); | |
533 #else /* !NEW_EDITOR */ | |
534 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
535 #endif | |
536 /*show the window*/ | |
537 win_show(data->win); | |
538 } | |
539 break; | |
540 case EM_LOCATION_PARAMS: | |
541 { loc_info = (MFW_EM_Location_Parameters*)para;/*cast parameter to appropriate type*/ | |
542 /*copy data to editor buffer*/ | |
543 /*MC, SPR 1554 Removed Cell id from editor string*/ | |
544 sprintf(temp_buffer, "LUP:%d MCC:%s MNC:%s LAC:%d ", loc_info->LUP, loc_info->MCC, loc_info->MNC, loc_info->LAC); | |
545 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
546 #ifdef NEW_EDITOR | |
547 /*SPR 1757 Insert temp buffer into editor*/ | |
548 temp_text.data = (UBYTE*)temp_buffer; | |
549 temp_text.dcs = ATB_DCS_ASCII; | |
550 ATB_string_Length(&temp_text); | |
551 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
552 ATB_edit_ClearAll(data->editor); | |
553 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
554 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
555 ATB_edit_Refresh(data->editor); | |
556 #else /* !NEW_EDITOR */ | |
557 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
558 #endif | |
559 /*show the window*/ | |
560 win_show(data->win); | |
561 } | |
562 break; | |
563 case EM_CIPH_HOP_DTX_PARAMS: | |
564 { ciph_hop_dtx_info = (MFW_EM_Ciph_hop_DTX_Parameters*)para;/*cast parameter to appropriate type*/ | |
565 /*convert DTX status to string*/ | |
566 if (ciph_hop_dtx_info->DTX_status == FALSE) | |
567 DTX_Status = "Off"; | |
568 else | |
569 DTX_Status = "On"; | |
570 //copy data to editor | |
571 sprintf(temp_buffer, "STATUS:%d HSN:%d DTX:%s ", ciph_hop_dtx_info->ciph_status, ciph_hop_dtx_info->HSN, DTX_Status); | |
572 /*show the window*/ | |
573 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
574 #ifdef NEW_EDITOR | |
575 /*SPR 1757 Insert temp buffer into editor*/ | |
576 temp_text.data = (UBYTE*)temp_buffer; | |
577 temp_text.dcs = ATB_DCS_ASCII; | |
578 ATB_string_Length(&temp_text); | |
579 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
580 ATB_edit_ClearAll(data->editor); | |
581 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
582 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
583 ATB_edit_Refresh(data->editor); | |
584 #else /* !NEW_EDITOR */ | |
585 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
586 #endif | |
587 win_show(data->win); | |
588 } | |
589 break; | |
590 case EM_GPRS_PARAMS: | |
591 { gprs_info = (MFW_EM_GPRS_Parameter*)para;//cast parameter to appropriate type | |
592 /*MC, SPR 1554 Changed ediotr string to show Network Mode of Operation*/ | |
593 sprintf(temp_buffer, "NMO:%d NDTS:%d RAC:%d C31:%d C32:%d",\ | |
594 gprs_info->NMO, gprs_info->NDTS, gprs_info->RAC, gprs_info->C31, gprs_info->C32); | |
595 //show the window | |
596 /* SPR#1428 - SH - New Editor - string has changed, update word wrap */ | |
597 #ifdef NEW_EDITOR | |
598 /*SPR 1757 Insert temp buffer into editor*/ | |
599 temp_text.data = (UBYTE*)temp_buffer; | |
600 temp_text.dcs = ATB_DCS_ASCII; | |
601 ATB_string_Length(&temp_text); | |
602 ATB_edit_ResetMode(data->editor, ED_MODE_READONLY); /* Switch off read only to add text */ | |
603 ATB_edit_ClearAll(data->editor); | |
604 ATB_edit_InsertString(data->editor, &temp_text); /* Insert name string */ | |
605 ATB_edit_SetMode(data->editor, ED_MODE_READONLY); /* Switch on read only again */ | |
606 ATB_edit_Refresh(data->editor); | |
607 #else /* !NEW_EDITOR */ | |
608 strncpy(data->edtBuffer, temp_buffer, EM_EDITOR_SIZE);/*SPR 1757*/ | |
609 #endif | |
610 win_show(data->win); | |
611 } | |
612 break; | |
613 } | |
614 } | |
615 | |
616 } | |
617 | |
618 /******************************************************************************* | |
619 | |
620 $Function: Mmi_em_destroy() | |
621 | |
622 $Description: Delete the window | |
623 | |
624 $Returns: none | |
625 | |
626 $Arguments: window handle | |
627 | |
628 *******************************************************************************/ | |
629 void Mmi_em_destroy(T_MFW_HND own_window) | |
630 { | |
631 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
632 tEmData * data = (tEmData *)win->user; | |
633 | |
634 TRACE_EVENT ("Mmi_em_destroy()"); | |
635 | |
636 if (own_window == NULL) | |
637 { | |
638 TRACE_EVENT ("Error :- Called with NULL Pointer"); | |
639 return; | |
640 } | |
641 | |
642 if (data) | |
643 { | |
644 /* | |
645 * Exit TIMER & KEYBOARD Handle | |
646 */ | |
647 kbd_delete (data->kbd); | |
648 tim_delete (data->tim); | |
649 /* SPR#1428 - SH - New Editor changes */ | |
650 #ifdef NEW_EDITOR | |
651 ATB_edit_Destroy(data->editor); | |
652 #else | |
653 edt_delete(data->edt); | |
654 #endif | |
655 /* | |
656 * Delete WIN Handler | |
657 */ | |
658 win_delete (data->win); | |
659 /* | |
660 * Free Memory | |
661 */ | |
662 FREE_MEMORY ((void *)data, sizeof (tEmData)); | |
663 } | |
664 TRACE_EVENT_P1("MMiEm END, Memory left:%d", mfwCheckMemoryLeft()); | |
665 } | |
666 | |
667 /******************************************************************************* | |
668 | |
669 $Function: Mmi_em_kbd_cb() | |
670 | |
671 $Description: Keyboard handler | |
672 | |
673 $Returns: status int | |
674 | |
675 $Arguments: event, keyboard data | |
676 | |
677 *******************************************************************************/ | |
678 int Mmi_em_kbd_cb(T_MFW_EVENT event,T_MFW_KBD * kc ) | |
679 { T_MFW_HND win = mfw_parent (mfw_header()); | |
680 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
681 tEmData * data = (tEmData *)win_data->user; | |
682 | |
683 TRACE_EVENT_P2("Mmi_em_kbd_cb, key:%d, win;%d", kc->code, data->win); | |
684 | |
685 switch(kc->code) | |
686 { | |
687 | |
688 case KCD_MNUUP:/*scroll up */ | |
689 /* SPR#1428 - SH - New Editor changes */ | |
690 #ifdef NEW_EDITOR | |
691 ATB_edit_MoveCursor(data->editor, ctrlUp, TRUE); | |
692 #else /* NEW_EDITOR */ | |
693 edtChar(data->edt,ecUp); | |
694 #endif /* NEW_EDITOR */ | |
695 | |
696 break; | |
697 | |
698 case KCD_MNUDOWN:/*scroll down*/ | |
699 /* SPR#1428 - SH - New Editor changes */ | |
700 #ifdef NEW_EDITOR | |
701 ATB_edit_Char(data->editor,ctrlDown, TRUE); | |
702 #else /* NEW_EDITOR */ | |
703 edtChar(data->edt,ecDown); | |
704 #endif /* NEW_EDITOR */ | |
705 | |
706 break; | |
707 case KCD_HUP: /*destroy window*/ | |
708 case KCD_RIGHT: | |
709 Mmi_em_destroy(data->win); | |
710 break; | |
711 default: | |
712 break; | |
713 } | |
714 return MFW_EVENT_CONSUMED; | |
715 } | |
716 | |
717 /******************************************************************************* | |
718 | |
719 $Function: Mmi_em_win_cb() | |
720 | |
721 $Description: Display handler | |
722 | |
723 $Returns: status int | |
724 | |
725 $Arguments: event, window handle | |
726 | |
727 *******************************************************************************/ | |
728 int Mmi_em_win_cb(T_MFW_EVENT event,T_MFW_WIN * win ) | |
729 { | |
730 tEmData * data = (tEmData *)win->user; | |
731 | |
732 | |
733 | |
734 TRACE_EVENT_P1("EM window: %d", win); | |
735 TRACE_EVENT_P1("Mmi_em_win_cb(), data->CurrentWindow %d", data->CurrentWindow); | |
736 | |
737 switch( event ) | |
738 { | |
739 case MfwWinVisible: | |
740 /*clear screen*/ | |
741 dspl_ClearAll(); | |
742 | |
743 /*Show editor content*/ | |
744 /* SPR#1428 - SH - New Editor changes */ | |
745 #ifdef NEW_EDITOR | |
746 ATB_edit_Show(data->editor); | |
747 #else /* NEW_EDITOR */ | |
748 edtShow(data->edt); | |
749 #endif /* NEW_EDITOR */ | |
750 | |
751 displaySoftKeys(TxtNull, TxtSoftBack); /*show the softkeys*/ | |
752 break; | |
753 default: | |
754 return MFW_EVENT_PASSED; | |
755 break; | |
756 } | |
757 | |
758 return MFW_EVENT_CONSUMED; | |
759 | |
760 } | |
761 | |
762 /******************************************************************************* | |
763 | |
764 $Function: Mmi_em_tim_cb() | |
765 | |
766 $Description: Timer handler (every second) | |
767 | |
768 $Returns: none | |
769 | |
770 $Arguments: event, timer data | |
771 | |
772 *******************************************************************************/ | |
773 void Mmi_em_tim_cb(T_MFW_EVENT event,T_MFW_TIM * t) | |
774 { T_MFW_HND win = mfw_parent (mfw_header()); | |
775 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
776 tEmData * data = (tEmData *)win_data->user; | |
777 TRACE_EVENT_P1("Mmi_em_tim_cb(), win:%d", data->win); | |
778 /*Request the data from MFW again*/ | |
779 Mfw_em_get_data(data->CurrentWindow); | |
780 /*restart timer*/ | |
781 timStart(data->tim); | |
782 } |