FreeCalypso > hg > fc-tourmaline
annotate src/ui/bmi/mmiHomezone.c @ 244:96784b8974eb
Switch_ON(): detect charging mode by CHGPRES bit
Consider the following scenario: the phone is on, the user plugs in
the charger, and then executes the power-off operation. In the Iota
VRPC this sequence translates to a switch-off immediately followed
by another switch-on - but the CHGSTS bit doesn't get set on the second
switch-on cycle! Disassembly of Pirelli's fw shows that they check
the CHGPRES bit, and furthermore, if both CHGPRES and ONBSTS are set,
the code they pass to their modified Power_ON_Button() function is
the one for charging - so let's adopt the same CHGPRES check and
the same priority order for switch-on causes.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 03 May 2021 06:51:29 +0000 |
parents | 60f8c8e710f4 |
children |
rev | line source |
---|---|
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
3 CONDAT (UK) |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
5 ******************************************************************************** |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 This software product is the property of Condat (UK) Ltd and may not be |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
8 disclosed to any third party without the express permission of the owner. |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
9 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 ******************************************************************************** |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
12 $Project name: Basic MMI |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
13 $Project code: BMI |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
14 $Module: |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
15 $File: MmiHomezone.c |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
16 $Revision: 1.0 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
17 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
18 $Author: Condat(UK) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
19 $Date: 15/02/02 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
20 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ******************************************************************************** |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
22 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 Description: Homezone functionality in MMI |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
24 |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
25 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 ******************************************************************************** |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 $History: MmiHomezone.c |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
30 15/02/02 Original Condat(UK) BMI version. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
31 28/05/02 Latest Condat(UK) BMI version |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
33 Sep 14, 2007 REF: OMAPS00145865 Adrian Salido |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
34 Description: FT - MMI: Wrong trace class |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
35 Solution: changed some event traces to function traces because the information content of |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
36 this is low for non-MMI people and against TI coding convention. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
38 Mar 14, 2006 DR: OMAPS00061468 - x0035544. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
39 Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
40 Solution : In the function homezoneUpdateDisplay(), additional parameter has been added to the |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
41 function call addSatMessage() under the flag FF_MMI_SAT_ICON to support SAT Icon for IDLE TEXT display. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 Dec 15, 2005 REF: MMI-FIX-OMAPS00058684 x0035544 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 Description: OMAPS00045726 / MMI-FIX-30439 Follow-Up : ifdef for FF Home Zone forgotten. |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 Solution: Added Feature flag FF_HOMEZONE for the function sms_homezoneCBToggle(U8 Activate_CB) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 in this file as it has got the prototype for this function. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
47 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
48 Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
49 Description: The homezone/cityzone tags were not being displayed properly. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
50 Solution: Modified to save the tags properly in caches and also made the |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
51 appropriate modifications to update the same properly during mobility. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
52 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 $End |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 #include <string.h> |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 #include <stdio.h> |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 #include <stdlib.h> |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 #if defined (NEW_FRAME) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 #include "typedefs.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 #include "vsi.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 #include "pei.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 #include "custom.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 #include "gsm.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 #else |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 #include "STDDEFS.H" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 #include "custom.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 #include "gsm.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 #include "vsi.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 #include "mfw_sys.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 #include "mfw_mfw.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 #include "mfw_win.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 #include "mfw_kbd.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 /* SPR#1428 - SH - New Editor changes */ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 #ifndef NEW_EDITOR |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 #include "mfw_edt.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 #include "mfw_lng.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 #include "mfw_icn.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 #include "mfw_phb.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 #include "mfw_sim.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 #include "mfw_nm.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 #include "ksd.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 #include "psa.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 #include "mfw_sms.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 #include "mfw_smsi.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 #include "mfw_mnu.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 #include "mfw_sat.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 #include "mfw_tim.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 #include "mfw_cphs.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 #include "MmiMmi.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 #include "MmiDummy.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 #include "MmiDialogs.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 #include "MmiLists.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 #include "MmiMain.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 #include "MmiStart.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 #include "MmiPins.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 #include "MmiMenu.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 #include "MmiSoftKeys.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 #include "MmiSounds.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 #include "mmiCall.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 #include "MmiBookController.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 #include "MmiIdle.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 #include "Mmiicons.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 #include "MmiNetwork.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 #include "mmiSmsBroadcast.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 #include "MmiHomezone.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 #include "cus_aci.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 #include "prim.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 #ifndef PCM_2_FFS |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 #include "pcm.h" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
131 // enable HZ trace |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
132 //#undef TRACE_MMIHOMEZONE |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 #define TRACE_MMIHOMEZONE 1 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
135 T_homezone_data homezoneData; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 extern T_SMSCB_DATASTORE g_smscb_data; /* storage for Cell Broadcast lists */ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 static int hzFlag = 0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 //Dec 14, 2005 REF: MMI-FIX-OMAPS00058684 x0035544 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 #ifdef FF_HOMEZONE |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 // Externed the function for activation\deactivation of Homezone. |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 extern void sms_homezoneCBToggle(U8 Activate_CB); |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 /* x0039928 - Lint warning fix */ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 static char *homezoneMNC_MCC[HZ_PERMITTED_NETWORKS] = |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
149 "26207", /* VIAG Interkom */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 }; |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 //void sms_homezoneCBToggle(U8 Activate_CB); |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 LOCALLY REFERENCED FUNCTIONS |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
160 void homezoneReadParams(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
161 void homezoneLocate(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
162 static U32 calculateDecimal( char *string, int length ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
163 static U32 readHexFromSimfile( UBYTE *simFile, int length ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
164 static void writeHexToSimfile( UBYTE *simFile, U32 value, int length ); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
168 $Function: homezoneInit |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
170 $Description: Initialise homezone data structure. Reset the recent cache. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
171 |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
172 $Returns: |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 $Arguments: |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 void homezoneInit() |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
179 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
180 USHORT cacheIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
181 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
182 // Added the following local variables. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
183 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
184 UBYTE version; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
185 USHORT max_rcd; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
186 EF_HZCACHE cache; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
187 //end 30439 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
188 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
189 TRACE_FUNCTION("homezoneInit()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
191 /* Set all data to 0 */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
193 memset((UBYTE *)data, 0, sizeof(T_homezone_data)); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
195 data->current_zone = HZ_NOT_IN_ZONE; // 0xFF = not in a homezone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
196 data->recent_cell_index = HZ_RECENT_MAX-1; // Next entry will loop round & be at start of cache |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
198 /* Set up recent cell cache */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
199 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
200 for (cacheIndex = 0; cacheIndex<HZ_RECENT_MAX; cacheIndex++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
201 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
202 data->recent_cell[cacheIndex] = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
203 data->recent_cell_zone[cacheIndex] = HZ_NOT_IN_ZONE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
204 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
205 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
206 /* Read cache from PCM */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
207 if (pcm_ReadRecord((UBYTE *)EF_HZCACHE_ID, |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 (USHORT)(cacheIndex+1), |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 SIZE_EF_HZCACHE, |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 (UBYTE *)&cache, |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 &version, |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 &max_rcd) NEQ DRV_OK) |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
213 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
214 TRACE_EVENT ("Init cache read from PCM wrong"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
215 break; /* read error */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 } |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
217 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
218 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
219 if (cache.cid[0] != 0xFF AND cache.cid[1] != 0xFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
220 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
221 data->recent_cell[cacheIndex] = readHexFromSimfile(&cache.cid[0],2); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
222 data->recent_cell_zone[cacheIndex] = cache.zone; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
223 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
224 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
225 TRACE_EVENT_P3("Init cache %d: CID %X, zone %X",cacheIndex, data->recent_cell[cacheIndex], data->recent_cell_zone[cacheIndex]); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
226 //end 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
227 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
229 data->new_cell_res = FALSE; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
230 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
231 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
234 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
237 $Function: homezoneReadSim |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
239 $Description: Read homezone data in from SIM. Checks to see if conditions (SIM, |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
240 network) are correct for homezone; switches it off if not. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
241 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
242 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
244 $Arguments: read_again - if this is HZ_READ_ONCE_ONLY, then SIM fields will not |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
245 be read in again if they have already been read in once. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
246 If this is HZ_READ_SIM_AGAIN, they will be read in anyway. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
247 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 void homezoneReadSim(UBYTE read_again) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
252 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
253 char IMSI[17]; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
254 char MNC_MCC[6]; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
255 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
256 USHORT networkIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
257 UBYTE networkOK; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
258 USHORT tries; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
259 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
260 /* Check if homezone is switched off */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
261 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
262 if (data->received == HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
263 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
264 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
265 /* SPR877 - If read_again specifies that SIM data should not be re-read, exit from function |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
266 * provided we have read it once. */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
267 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
268 if (read_again == HZ_READ_ONCE_ONLY && data->received & HZ_RECEIVED_SIMDATA) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
269 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
270 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
271 TRACE_FUNCTION("homezoneReadSim()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
272 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
273 /* Check if network operator is in list */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
274 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
275 networkOK = FALSE; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
276 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
277 tries = 0; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
278 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
279 while ((qAT_PlusCIMI(CMD_SRC_LCL, IMSI)) != AT_CMPL && tries < 5) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
280 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
281 tries++; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
282 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
283 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
284 strncpy(MNC_MCC, IMSI, 5); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
285 MNC_MCC[5] =0; //terminate string |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
286 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
287 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
288 TRACE_EVENT_P1("MNC_MCC: %s", (char *)MNC_MCC); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
289 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
290 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
291 for (networkIndex=0; networkIndex<HZ_PERMITTED_NETWORKS; networkIndex++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
292 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
293 if (!strncmp((char *)MNC_MCC, homezoneMNC_MCC[networkIndex],5)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
294 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
295 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
296 TRACE_EVENT_P1("Matches entry %d", networkIndex); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
297 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
298 networkOK = TRUE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
299 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
300 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
301 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
302 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
303 /* Attempt to read first sim field */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
304 if (read_again == HZ_READ_SIM_AGAIN) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
305 hzFlag = 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
306 //end 30439 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
307 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
308 if (networkOK) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
309 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
310 if (!Read_Sim(HZ_SIM_PARAMETERS, 0, HZ_SIM_PARAMETERS_SIZE, data->buffer)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
311 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
312 TRACE_EVENT("SIM read error 1: Homezone OFF"); /* SIM field not present, switch off homezone */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
313 data->received = HZ_RECEIVED_HZ_OFF; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
314 hzFlag = 0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 - Seting the variable |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
315 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
316 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
317 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
318 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
319 TRACE_EVENT("Wrong network: Homezone OFF"); /* Network not in list, switch off homezone */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
320 data->received = HZ_RECEIVED_HZ_OFF; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
321 hzFlag = 0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 - Seting the variable |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
322 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
323 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
324 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
325 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
326 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
327 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
328 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
329 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
330 $Function: homezoneReadSimCb |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
331 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
332 $Description: Callback, called when read sim has occurred. Fills up the homezone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
333 data structure with the appropriate values retrieved from SIM. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
334 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
335 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
336 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
337 $Arguments: field - the SIM field that was just read |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
338 record - the record in the SIM field that was read |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
339 result - the result code returned - 0 for successful. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
340 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
341 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
342 void homezoneReadSimCb(USHORT field, USHORT record, USHORT result) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
343 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
344 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
345 T_homezone *homezone = data->homezone; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
346 UBYTE *simFile; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
347 USHORT fileIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
348 USHORT hzIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
349 UBYTE keepLooking; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
350 U8 Activate_cb =0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
351 //To activate/deactivate homezoneCB |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
352 TRACE_FUNCTION("homezoneReadSimCb()"); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
353 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
354 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
355 TRACE_EVENT_P2("Have just read SIM file: %x record %d", field, record); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
356 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
357 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
358 /* Read in general homezone data. If reading first SIM field fails, switch homezone off */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
359 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
360 if (field==HZ_SIM_PARAMETERS) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
361 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
362 /* check SIM read result for homezone parameter */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
363 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
364 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
365 //Modified the conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
366 //if (result) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
367 if (result != 0x80FF) |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
368 //end 30439 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
369 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
370 TRACE_EVENT("SIM read error 2: Homezone OFF"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
371 data->received = HZ_RECEIVED_HZ_OFF; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
372 hzFlag = 0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 -Setting the variable |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
373 return; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
374 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
375 homezoneReadParams(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
376 /*homezoneActivateCB();*/ /* Switch on cell broadcast */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
377 /* SH - this is already done at startup */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
378 record = HZ_CACHE_MAX; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
379 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
380 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
381 /* Read in records for each homezone cache */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
382 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
383 /* check SIM read result for hoemzone cache */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
384 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
385 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
386 //Modified the conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
387 //if (field>HZ_SIM_PARAMETERS && !result) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
388 if (field>HZ_SIM_PARAMETERS && (result == 0x80FF)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
389 //end 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
390 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
391 hzIndex = field - HZ_SIM_CELL_CACHE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
392 simFile = data->buffer2; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
393 fileIndex = 0; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
394 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
395 homezone[hzIndex].lac[record-1] = readHexFromSimfile(&simFile[fileIndex],2); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
396 fileIndex+=2; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
397 homezone[hzIndex].cid[record-1] = readHexFromSimfile(&simFile[fileIndex],2); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
398 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
399 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
400 TRACE_EVENT_P2("read lac = %x, cid = %x", homezone[hzIndex].lac[record-1], homezone[hzIndex].cid[record-1]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
401 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
402 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
403 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
404 /* Read in the next record */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
405 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
406 keepLooking = TRUE; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
407 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
408 while (keepLooking) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
409 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
410 /* check SIM read result for hoemzone cache */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
411 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
412 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
413 //Modified the conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
414 //if (record==HZ_CACHE_MAX || result) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
415 if (record==HZ_CACHE_MAX || (result != 0x80FF)) |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
416 //end 30439 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
417 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
418 field++; // Look at next field |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
419 record = 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
420 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
421 // Print the current feild. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
422 TRACE_EVENT_P1("current field = %x", field); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
423 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
424 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
425 record++; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
426 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
427 hzIndex = field-HZ_SIM_CELL_CACHE; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
428 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
429 if (hzIndex==HZ_ZONES_MAX) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
430 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
431 keepLooking = FALSE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
432 /* Have read all sim data, set flag so icon etc will be updated */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
433 data->received |= HZ_RECEIVED_SIMDATA; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
434 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
435 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
436 /* homezone display update after SIM REFRESH (when hzFlag set to 1) */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
437 TRACE_EVENT_P1("hzFlag = %d", hzFlag); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
438 if (hzFlag) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
439 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
440 // hzFlag = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
441 homezoneUpdate(0, 0, 1); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
442 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
443 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
444 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
445 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
446 TRACE_EVENT("activate homezone CB"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
447 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
448 //Call to activate the Homezone CB. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
449 Activate_cb = 1; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
450 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
451 #ifdef FF_HOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
452 sms_homezoneCBToggle(Activate_cb); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
453 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
454 homezoneUpdate(0, 0, 1); /* new VO : speed up update */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
455 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
456 //end 30439 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
457 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
458 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
459 else if (homezone[hzIndex].active) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
460 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
461 keepLooking = FALSE; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
462 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
463 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
464 //TRACE_EVENT_P3("HZ READ HZ %d field %X record %d", hzIndex, field, record); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
465 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
466 if (!Read_Sim_Record(field, record, HZ_SIM_CELL_CACHE_SIZE, data->buffer2)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
467 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
468 TRACE_EVENT("SIM reading error!"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
469 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
470 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
471 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
472 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
473 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
474 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
475 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
476 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
477 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
478 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
479 $Function: homezoneReadParams |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
480 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
481 $Description: Decode the homezone parameters from the first SIM field |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
482 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
483 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
484 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
485 $Arguments: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
486 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
487 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
488 void homezoneReadParams() |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
489 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
490 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
491 T_homezone *homezone = data->homezone; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
492 UBYTE *simFile; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
493 USHORT fileIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
494 USHORT tagIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
495 USHORT hzIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
496 char character; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
497 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
498 TRACE_FUNCTION("homezoneReadParams()"); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
499 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
500 simFile = data->buffer; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
501 fileIndex = HZ_SIM_FIRST_ZONE; // Point to the first homezone data |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
502 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
503 for (hzIndex=0; hzIndex<HZ_ZONES_MAX; hzIndex++) // For each homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
504 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
505 homezone[hzIndex].zoneID = simFile[fileIndex]; // Read in the various parameters |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
506 fileIndex++; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
507 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
508 homezone[hzIndex].X = readHexFromSimfile(&simFile[fileIndex],4); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
509 fileIndex += 4; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
510 homezone[hzIndex].Y = readHexFromSimfile(&simFile[fileIndex],4); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
511 fileIndex += 4; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
512 homezone[hzIndex].Rsquared = readHexFromSimfile(&simFile[fileIndex],4); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
513 fileIndex += 4; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
514 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
515 homezone[hzIndex].active = (BOOL) (simFile[fileIndex] & HZ_ACTIVE_FLAG)/HZ_ACTIVE_FLAG; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
516 homezone[hzIndex].cityzone = (BOOL) (simFile[fileIndex] & HZ_CITYZONE_FLAG)/HZ_CITYZONE_FLAG; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
517 fileIndex++; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
518 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
519 /* Read in the 12-character tag name */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
520 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
521 for (tagIndex = 0; tagIndex<HZ_NAME_LENGTH; tagIndex++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
522 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
523 character = (char) simFile[fileIndex]; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
524 fileIndex++; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
525 if (character<32 /*|| character>127*/) /*a0393213 - lint warnings removal - 'Relational operator '>' always evaluates to 'false'*/ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
526 character = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
527 homezone[hzIndex].Tag[tagIndex] = character; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
528 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
529 homezone[hzIndex].Tag[HZ_NAME_LENGTH] = 0; // Make sure tag is null-terminated |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
530 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
531 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
532 TRACE_EVENT_P1("Homezone %d:", hzIndex); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
533 TRACE_EVENT_P1("ID: %d", homezone[hzIndex].zoneID); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
534 TRACE_EVENT_P1("Active: %d", (UBYTE)homezone[hzIndex].active); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
535 TRACE_EVENT_P1("Cityzone: %d", (UBYTE)homezone[hzIndex].cityzone); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
536 TRACE_EVENT_P1("X: %X", homezone[hzIndex].X); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
537 TRACE_EVENT_P1("Y: %X", homezone[hzIndex].Y); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
538 TRACE_EVENT_P1("Rsquared: %X", homezone[hzIndex].Rsquared); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
539 TRACE_EVENT_P1("Homezone name: %s", homezone[hzIndex].Tag); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
540 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
541 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
542 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
543 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
544 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
545 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
546 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
547 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
548 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
549 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
550 $Function: homezoneWriteSim |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
551 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
552 $Description: Write homezone data to the SIM |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
553 SPR 877 - SH - now just writes a single record |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
554 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
555 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
556 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
557 $Arguments: cache, record |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
558 ********************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
559 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
560 void homezoneWriteSim(USHORT field, USHORT record) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
561 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
562 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
563 USHORT hzIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
564 UBYTE *simFile; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
565 USHORT fileIndex; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
566 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
567 /* Check if homezone is already switched off */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
568 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
569 if (data->received==HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
570 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
571 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
572 TRACE_FUNCTION("homezoneWriteSim()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
573 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
574 hzIndex = field-HZ_SIM_CELL_CACHE; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
575 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
576 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
577 TRACE_EVENT_P4("HZ WRITE field: %X record %d lac %X cid %X", field, record, data->homezone[hzIndex].lac[record-1], data->homezone[hzIndex].cid[record-1]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
578 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
579 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
580 if (data->homezone[hzIndex].active) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
581 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
582 simFile = data->buffer2; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
583 fileIndex = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
584 writeHexToSimfile(&simFile[fileIndex], data->homezone[hzIndex].lac[record-1], 2 ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
585 fileIndex += 2; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
586 writeHexToSimfile(&simFile[fileIndex], data->homezone[hzIndex].cid[record-1], 2 ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
587 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
588 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
589 if (!Write_Sim_Record(field, record, HZ_SIM_CELL_CACHE_SIZE, data->buffer2)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
590 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
591 TRACE_EVENT("SIM writing error!"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
592 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
593 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
594 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
595 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
596 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
597 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
598 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
599 $Function: homezoneWriteSimCb |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
600 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
601 $Description: Write homezone data to the SIM. This function is called after a previous |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
602 SIM write (or, in the initial case, by homezoneWriteSim above). |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
603 SPR877 - SH - Previous functionality no longer required here. |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
604 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
605 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
606 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
607 $Arguments: field - the SIM field that is to be written |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
608 record - the SIM record that is to be written |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
609 result - the result of the last write attempt |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
610 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
611 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
612 void homezoneWriteSimCb(USHORT field, USHORT record, USHORT result) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
613 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
614 TRACE_FUNCTION("homezoneWriteSimCb()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
615 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
616 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
617 TRACE_EVENT_P1("RESULT: %d", result); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
618 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
619 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
620 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
621 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
622 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
623 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
624 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
625 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
626 $Function: homezoneCBData |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
627 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
628 $Description: Make sure correct homezone CB channel is set up and activate CB |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
629 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
630 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
631 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
632 $Arguments: message - The text of the cell broadcast message |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
633 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
634 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
635 void homezoneActivateCB(void) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
636 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
637 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
638 USHORT index; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
639 UBYTE stopSearch; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
640 USHORT emptyID; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
641 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
642 /* Check if homezone is already switched off */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
643 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
644 if (data->received==HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
645 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
646 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
647 TRACE_FUNCTION("homezoneActivateCB()"); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
648 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
649 /* Check table to see if correct channel is included */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
650 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
651 stopSearch = FALSE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
652 emptyID = 0xFFFF; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
653 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
654 for (index=0; index<MAX_MIDS && !stopSearch; index++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
655 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
656 TRACE_EVENT_P2("Mid %d is %X", index, g_smscb_data.CBTopics.entry[index].msg_id); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
657 if (g_smscb_data.CBTopics.entry[index].msg_id==HZ_IDENTIFIER) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
658 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
659 stopSearch = TRUE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
660 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
661 else if (g_smscb_data.CBTopics.entry[index].msg_id==NO_MID) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
662 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
663 emptyID = index; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
664 stopSearch = TRUE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
665 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
666 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
667 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
668 TRACE_EVENT_P1("Emtpy ID %d", emptyID); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
669 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
670 if (emptyID!=0xFFFF && emptyID<MAX_MIDS-1) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
671 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
672 strncpy (g_smscb_data.CBTopics.entry[emptyID].name, HZ_CB_NAME, CB_TAG_LENGTH); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
673 g_smscb_data.CBTopics.entry[emptyID].msg_id = HZ_IDENTIFIER; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
674 g_smscb_data.CBTopics.entry[emptyID].dcs = 0; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
675 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
676 // add a new entry |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
677 emptyID += 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
678 g_smscb_data.CBTopics.length = emptyID; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
679 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
680 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
681 smscb_setCBsettings(SMSCB_SWITCH_ON); |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
682 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
683 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
684 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
685 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
686 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
687 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
688 $Function: homezoneCBData |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
689 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
690 $Description: A cell broadcast message has been received, containing information about |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
691 the location of the current cell |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
692 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
693 $Returns: None. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
694 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
695 $Arguments: message - The text of the cell broadcast message |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
696 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
697 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
698 void homezoneCBData(char *message) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
699 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
700 T_homezone_data *data = &homezoneData; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
701 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
702 /* Check if homezone is already switched off */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
703 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
704 if (data->received==HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
705 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
706 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
707 TRACE_FUNCTION("homezoneCellData()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
708 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
709 /* Calculate the current position from the text of the message */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
710 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
711 data->current_X = calculateDecimal( &message[0], HZ_COORD_DIGITS ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
712 data->current_Y = calculateDecimal( &message[HZ_COORD_DIGITS], HZ_COORD_DIGITS ); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
713 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
714 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
715 TRACE_EVENT_P2("current_X: %X, current_Y: %X", data->current_X, data->current_Y); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
716 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
717 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
718 data->received |= HZ_RECEIVED_CB; // We now have received cell broadcast message. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
719 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
720 /* SPR877 - SH - now only call HZ algorithm if a cell res has recently taken place */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
721 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
722 if (data->received==HZ_RECEIVED_ALL && data->new_cell_res) // If we've received everything, call algorithm. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
723 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
724 homezoneLocate(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
725 data->new_cell_res = FALSE; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
726 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
727 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
728 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
729 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
730 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
731 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
732 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
733 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
734 $Function: homezoneLocate |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
735 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
736 $Description: Looks at coordinates from cell broadcast message and calculates if |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
737 they are in a homezone |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
738 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
739 $Returns: None |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
740 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
741 $Arguments: None |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
742 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
743 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
744 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
745 void homezoneLocate() |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
746 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
747 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
748 T_homezone *homezone = data->homezone; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
749 long deltaX; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
750 long deltaY; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
751 USHORT hzIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
752 USHORT cacheIndex=0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
753 U32 Dsquared; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
754 BOOL foundInCache; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
755 USHORT cacheFreeSpace=0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
756 USHORT field; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
757 USHORT record=0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
758 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
759 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
760 EF_HZCACHE cache; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
761 UBYTE exist = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
762 //end 30439 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
763 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
764 /* Check if homezone is already switched off */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
765 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
766 if (data->received==HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
767 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
768 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
769 TRACE_FUNCTION("homezoneLocate()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
770 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
771 data->current_zone = HZ_NOT_IN_ZONE; // We don't know if we're in a homezone yet (homezones = 0 to 3) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
772 field = HZ_NOT_IN_ZONE; // The cache to update |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
773 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
774 /* Work out if we're in a homezone using current_X and current_Y, received from CB message */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
775 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
776 if (data->received == HZ_RECEIVED_ALL) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
777 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
778 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
779 TRACE_EVENT_P2("Current cell X: %X, Y: %X", data->current_X,data->current_Y); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
780 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
781 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
782 /* Check to see if (current_X,current_Y) is in any of the defined homezones */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
783 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
784 for (hzIndex=0; hzIndex<HZ_ZONES_MAX && data->current_zone==HZ_NOT_IN_ZONE; hzIndex++) // For each homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
785 { |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
786 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
787 TRACE_EVENT_P1("Homezone %d...", hzIndex); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
788 TRACE_EVENT_P3("Has coords X: %X, Y: %X, R2: %X", homezone[hzIndex].X, homezone[hzIndex].Y, homezone[hzIndex].Rsquared); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
789 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
790 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
791 if (homezone[hzIndex].active) // Provided the homezone is active |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
792 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
793 #ifdef TRACE_MMIHOMEZONE // Calculate X and Y distance |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
794 TRACE_EVENT("Is active."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
795 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
796 deltaX = labs(data->current_X-homezone[hzIndex].X); // between centre of current cell |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
797 deltaY = labs(data->current_Y-homezone[hzIndex].Y); // and centre of the homezone |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
798 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
799 TRACE_EVENT_P1("deltaX = %d",deltaX); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
800 TRACE_EVENT_P1("deltaY = %d",deltaY); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
801 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
802 if (deltaX<=HZ_DISTANCE_MAX && deltaY<=HZ_DISTANCE_MAX) // If not too far... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
803 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
804 Dsquared = deltaX*deltaX+deltaY*deltaY; // Calculate the resultant distance squared |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
805 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
806 TRACE_EVENT_P1("Dsquared = %d",Dsquared); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
807 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
808 if (Dsquared <= homezone[hzIndex].Rsquared) // If within radius of homezone squared |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
809 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
810 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
811 TRACE_EVENT("Contains the current cell."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
812 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
813 data->current_zone = hzIndex; // Current zone is this homezone |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
814 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
815 if (!homezone[hzIndex].cityzone) // Then: if it's not a cityzone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
816 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
817 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
818 TRACE_EVENT("Is not a cityzone."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
819 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
820 foundInCache = FALSE; // Look through the cache for this |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
821 cacheFreeSpace = HZ_CACHE_MAX; // homezone to see if cell is listed |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
822 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
823 for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX && !foundInCache; cacheIndex++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
824 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
825 if (data->cid==homezone[hzIndex].cid[cacheIndex]) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
826 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
827 foundInCache = TRUE; // We've found it! |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
828 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
829 if (homezone[hzIndex].cid[cacheIndex]==0 && cacheFreeSpace==HZ_CACHE_MAX) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
830 cacheFreeSpace = cacheIndex; // Or we've found an empty space |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
831 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
832 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
833 if (!foundInCache) // If not there, need to add it |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
834 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
835 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
836 TRACE_EVENT("Is not in the cache."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
837 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
838 if (cacheFreeSpace==HZ_CACHE_MAX) // If we didn't find a free space... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
839 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
840 cacheFreeSpace = rand() % HZ_CACHE_MAX; // Choose a random entry |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
841 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
842 homezone[hzIndex].cid[cacheFreeSpace] = data->cid; // And store current cell there |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
843 homezone[hzIndex].lac[cacheFreeSpace] = data->lac; // with its location area code |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
844 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
845 field = hzIndex+HZ_SIM_CELL_CACHE; // We've changed the cache |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
846 record = cacheFreeSpace+1; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
847 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
848 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
849 TRACE_EVENT_P1("Have added to cache, entry %d.",cacheFreeSpace); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
850 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
851 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
852 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
853 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
854 else // If we're not in the homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
855 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
856 foundInCache = FALSE; // Look through the cache for this |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
857 // homezone to see if cell is listed |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
858 for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX && !foundInCache; cacheIndex++) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
859 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
860 if (data->cid==homezone[hzIndex].cid[cacheIndex]) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
861 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
862 foundInCache = TRUE; // We've found it! |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
863 cacheFreeSpace = cacheIndex; // Record where it is |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
864 break; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
865 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
866 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
867 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
868 if (foundInCache) // If it's there... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
869 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
870 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
871 TRACE_EVENT("Is in the cache and shouldn't be."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
872 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
873 homezone[hzIndex].cid[cacheFreeSpace] = 0; // ...remove it |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
874 field = hzIndex+HZ_SIM_CELL_CACHE; // We've changed the cache |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
875 record = cacheFreeSpace+1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
876 data->current_zone = HZ_NOT_IN_ZONE; // We're not in this zone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
877 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
878 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
879 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
880 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
881 TRACE_EVENT("Isn't in the cache and shouldn't be."); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
882 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
883 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
884 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
885 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
886 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
887 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
888 /* check if the cid is already in cache */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
889 for (cacheIndex=0; cacheIndex<HZ_RECENT_MAX; cacheIndex++) /*a0393213 - lint warnings removal - HZ_CACHE_MAX changed to HZ_RECENT_MAX*/ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
890 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
891 if (data->recent_cell[cacheIndex] == data->cid) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
892 exist = 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
893 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
894 /* Replace oldest cell in dynamic cache with new cell */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
895 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
896 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
897 //Added a conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
898 if (!exist) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
899 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
900 data->recent_cell_index++; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
901 if (data->recent_cell_index>=HZ_RECENT_MAX) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
902 data->recent_cell_index = 0; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
903 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
904 TRACE_EVENT_P1("Adding to recent list, index = %d", data->recent_cell_index); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
905 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
906 data->recent_cell[data->recent_cell_index] = data->cid; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
907 data->recent_cell_zone[data->recent_cell_index] = data->current_zone; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
908 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
909 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
910 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
911 /* write cache to PCM */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
912 writeHexToSimfile(&cache.cid[0], data->recent_cell[data->recent_cell_index], 2 ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
913 cache.zone = data->recent_cell_zone[data->recent_cell_index]; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
914 /* write cache to PCM */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
915 pcm_WriteRecord((UBYTE *)EF_HZCACHE_ID, |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
916 (USHORT)(data->recent_cell_index+1), |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
917 SIZE_EF_HZCACHE, |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
918 &cache.cid[0]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
919 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
920 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
921 //end 30439 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
922 #ifdef TRACE_MMIHOMEZONE |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
923 for (cacheIndex = 0; cacheIndex<HZ_RECENT_MAX; cacheIndex++) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
924 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
925 TRACE_EVENT_P3("Recent cache %d: CID %X, zone %X",cacheIndex, data->recent_cell[cacheIndex], data->recent_cell_zone[cacheIndex]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
926 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
927 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
928 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
929 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
930 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
931 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
932 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
933 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
934 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
935 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
936 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
937 TRACE_EVENT("CACHES AFTER UPDATE"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
938 for (hzIndex=0; hzIndex<HZ_ZONES_MAX; hzIndex++) // For each homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
939 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
940 /* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
941 MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
942 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
943 if (homezone[hzIndex].active && !homezone[hzIndex].cityzone) // If it's active, and not a cityzone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
944 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
945 for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX; cacheIndex++) // Check the cache. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
946 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
947 TRACE_EVENT_P3("Cache %d: lac %X, cid %X", cacheIndex, homezone[hzIndex].lac[cacheIndex], homezone[hzIndex].cid[cacheIndex]); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
948 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
949 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
950 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
951 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
952 /* Update icon/text tag. */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
953 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
954 homezoneUpdateDisplay(); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
955 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
956 /* Write data back to SIM if cache has changed & SIM files present */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
957 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
958 if (field!=HZ_NOT_IN_ZONE && (data->received & HZ_RECEIVED_SIMDATA)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
959 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
960 homezoneWriteSim(field, record); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
961 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
962 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
963 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
964 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
965 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
966 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
967 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
968 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
969 $Function: homezoneUpdate |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
970 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
971 $Description: Main homezone function; check whether MS is in a homezone or not |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
972 |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
973 $Returns: |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
974 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
975 $Arguments: lac - the location area code of the current cell (on cell reselection) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
976 cid - the ID of the current cell (on cell reselection) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
977 keep - 1: no change in lac and cid |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
978 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
979 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
980 //begin 30439 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
981 //Added an extra argument in the function -- "keep" |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
982 void homezoneUpdate(USHORT lac, USHORT cid, UBYTE keep) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
983 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
984 T_homezone_data *data = &homezoneData; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
985 T_homezone *homezone = data->homezone; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
986 USHORT hzIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
987 USHORT cacheIndex; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
988 UBYTE inCache = 0; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
989 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
990 /* Check if homezone is already switched off */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
991 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
992 TRACE_EVENT_P1("Data received: %d", data->received); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
993 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
994 if (data->received==HZ_RECEIVED_HZ_OFF) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
995 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
996 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
997 TRACE_FUNCTION("homezoneUpdate()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
998 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
999 data->current_zone = HZ_NOT_IN_ZONE; // We don't know if we're in a homezone yet (homezones = 0 to 3) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1000 data->received |= HZ_RECEIVED_CELLRES; // Have received this event |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1001 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1002 //Modified to add a conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1003 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1004 if (!keep) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1005 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1006 data->lac = lac; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1007 data->cid = cid; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1008 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1009 /* keep the current lac and cid */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1010 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1011 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1012 lac = data->lac; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1013 cid = data->cid; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1014 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1015 //end 30439 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1016 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1017 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1018 TRACE_EVENT_P3("lac: %X, cid: %X, received: %d", lac, cid, data->received); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1019 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1020 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1021 /* If either are zero or -1, the reselection data is invalid */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1022 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1023 //Modified to add a conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1024 if (((lac==0 || cid==0) || (lac==0xFFFF || cid==0xFFFF)) AND !keep) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1025 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1026 TRACE_EVENT_P1("homezoneUpdateDisplay ~HZ_RECEIVED_CELLRES keep=%d", keep); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1027 //end 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1028 data->received &= (~HZ_RECEIVED_CELLRES); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1029 homezoneUpdateDisplay(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1030 return; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1031 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1032 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1033 data->new_cell_res = TRUE; // Cell res just occurred |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1034 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1035 /* Must have received SIM data to continue*/ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1036 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1037 if (!(data->received & HZ_RECEIVED_SIMDATA)) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1038 return; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1039 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1040 /* Check homezone cache for each homezone */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1041 /* Can do this even if we haven't received the CB message */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1042 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1043 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1044 TRACE_EVENT("Checking zone caches..."); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1045 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1046 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1047 for (hzIndex=0; hzIndex<HZ_ZONES_MAX && data->current_zone==HZ_NOT_IN_ZONE; hzIndex++) // For each homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1048 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1049 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1050 /* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1051 MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1052 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1053 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1054 if (homezone[hzIndex].active && !homezone[hzIndex].cityzone) // If it's active, and not a cityzone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1055 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1056 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1057 TRACE_EVENT("Is Active."); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1058 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1059 for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX && data->current_zone==HZ_NOT_IN_ZONE; cacheIndex++) // Check the cache. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1060 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1061 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1062 TRACE_EVENT_P3("Cache %d: lac %X, cid %X", cacheIndex, homezone[hzIndex].lac[cacheIndex], homezone[hzIndex].cid[cacheIndex]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1063 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1064 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1065 if (cid==homezone[hzIndex].cid[cacheIndex]) // If the current cell is in the cache.... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1066 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1067 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1068 TRACE_EVENT_P1("Cell found in cache %d.",cacheIndex); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1069 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1070 data->current_zone = hzIndex; // Then this is our current homezone! |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1071 inCache = 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1072 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1073 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1074 if (!inCache AND hzFlag) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1075 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1076 hzFlag = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1077 TRACE_EVENT ("not in cache, caculate needed"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1078 homezoneLocate(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1079 return; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1080 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1081 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1082 inCache = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1083 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1084 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1085 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1086 //added a conditional statement |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1087 //begin 30439 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1088 /* If we didn't find a homezone, check recent cells cache to see if we're in a cityzone */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1089 for (hzIndex=0; hzIndex<HZ_ZONES_MAX && data->current_zone==HZ_NOT_IN_ZONE; hzIndex++) // For each homezone... |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1090 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1091 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1092 /* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1093 MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1094 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1095 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1096 if (homezone[hzIndex].active && homezone[hzIndex].cityzone) // If it's active, and not a cityzone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1097 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1098 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1099 TRACE_EVENT("Is Active."); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1100 #endif |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1101 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1102 for (cacheIndex=0; cacheIndex<HZ_RECENT_MAX && data->current_zone==HZ_NOT_IN_ZONE; cacheIndex++) // Check the cache. |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1103 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1104 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1105 TRACE_EVENT_P5("Cache %d: lac %X, cid %X, data->recent_cell %X, data->recent_cell_zone %d", cacheIndex, homezone[hzIndex].lac[cacheIndex], homezone[hzIndex].cid[cacheIndex], data->recent_cell[cacheIndex], data->recent_cell_zone[cacheIndex]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1106 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1107 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1108 if (cid==data->recent_cell[cacheIndex] && data->recent_cell_zone[cacheIndex]!=HZ_NOT_IN_ZONE) // If we're in that cell |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1109 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1110 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1111 TRACE_EVENT_P1("FOUND cityzone in cache %d.",cacheIndex); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1112 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1113 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1114 //Modified to directly assign value |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1115 data->current_zone = hzIndex; // Then this is our current homezone! |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1116 inCache = 1; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1117 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1118 if (!inCache AND hzFlag) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1119 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1120 hzFlag = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1121 TRACE_EVENT ("not in cache, caculate needed"); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1122 homezoneLocate(); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1123 return; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1124 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1125 else |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1126 inCache = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1127 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1128 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1129 } |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1130 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1131 homezoneUpdateDisplay(); // Update icon/text tag. |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1132 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1133 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1134 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1135 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1136 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1137 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1138 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1139 $Function: homezoneUpdateDisplay |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1140 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1141 $Description: |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1142 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1143 $Returns: Updates the homezone icon and text string appropriately |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1144 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1145 $Arguments: none |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1146 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1147 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1148 void homezoneUpdateDisplay(void) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1149 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1150 T_homezone_data *data = &homezoneData; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1151 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1152 TRACE_FUNCTION("homezoneUpdateDisplay()"); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1153 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1154 iconsDeleteState(iconIdHomezone); |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1155 |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1156 #ifdef FF_MMI_SAT_ICON |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1157 addSatMessage(NULL, 0, 0, NULL, FALSE, SAT_ICON_NONE); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1158 #else |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1159 addSatMessage(NULL); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1160 #endif |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1161 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1162 if (data->current_zone!=HZ_NOT_IN_ZONE) // If not in a homezone, leave blank |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1163 { |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1164 //x0035544 Mar 14, 2006 DR:OMAPS00061468 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1165 #ifdef FF_MMI_SAT_ICON |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1166 addSatMessage(data->homezone[data->current_zone].Tag, 0, 0, NULL, FALSE, SAT_ICON_NONE); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1167 #else |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1168 addSatMessage(data->homezone[data->current_zone].Tag); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1169 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1170 if (!data->homezone[data->current_zone].cityzone) // Display icon if homezone rather than cityzone |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1171 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1172 iconsSetState(iconIdHomezone); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1173 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1174 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1175 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1176 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1177 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1178 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1179 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1180 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1181 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1182 $Function: calculateDecimal |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1183 |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1184 $Description: |
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1185 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1186 $Returns: Returns a decimal number from a string of ascii digits |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1187 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1188 $Arguments: none |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1189 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1190 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1191 static U32 calculateDecimal( char *string, int length ) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1192 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1193 U32 total = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1194 int index; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1195 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1196 /* decode each decimal character in turn */ |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1197 for (index = 0; index < length; index++ ) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1198 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1199 if (string[index]>='0' && string[index]<='9') |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1200 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1201 total = ( total * 10 ) + ( string[index] - '0' ); |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1202 } |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1203 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1204 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1205 return total; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1206 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1207 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1208 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1209 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1210 $Function: readHexFromSimfile |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1211 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1212 $Description: Reads a hex string (MSB first) from a sim file |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1213 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1214 $Returns: The hex number |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1215 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1216 $Arguments: simFile - the point in the simFile at which the string occurs |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1217 length - the length of the string |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1218 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1219 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1220 static U32 readHexFromSimfile( UBYTE *simFile, int length ) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1221 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1222 U32 total = 0; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1223 int index; |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1224 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1225 for ( index = 0; index < length; index++ ) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1226 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1227 total = ( total << 8 ) + simFile[index]; |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1228 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1229 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1230 return total; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1231 } |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1232 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1233 /******************************************************************************* |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1234 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1235 $Function: writeHexToSimfile |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1236 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1237 $Description: Writes a hex string (MSB first) to a sim file |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1238 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1239 $Returns: None |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1240 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1241 $Arguments: simFile - the point in the simFile at which the string occurs |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1242 length - the length of the string |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1243 *******************************************************************************/ |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1244 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1245 static void writeHexToSimfile( UBYTE *simFile, U32 value, int length ) |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1246 { |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1247 int index; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1248 |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1249 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1250 TRACE_EVENT_P1("Hex of %X is:", value); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1251 #endif |
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1252 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1253 /* Note: '-1' below clarification: |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1254 * E.g. index=0, length=4: most significant byte is number shifted 3 bytes right. */ |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1255 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1256 for ( index = 0; index < length; index++ ) |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1257 { |
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1258 simFile[index] = (value >> ((length-index-1)*8)) & 0xFF; /* SPR877 - SH - wrong before, added *8 */ |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1259 #ifdef TRACE_MMIHOMEZONE |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1260 TRACE_EVENT_P2("Simfile %d is %X", index, simFile[index]); |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1261 #endif |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1262 } |
92
c0052fe355d3
src/ui/bmi/*.[ch]: rm trailing white space
Mychaela Falconia <falcon@freecalypso.org>
parents:
3
diff
changeset
|
1263 |
151
60f8c8e710f4
mmiHomezone.c: bogotab fixes
Mychaela Falconia <falcon@freecalypso.org>
parents:
92
diff
changeset
|
1264 return; |
3
67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1265 } |