comparison g23m/condat/ms/src/bmi/MmiHomezone.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 #ifndef _DEF_MMI_HOMEZONE_H_
2 #define _DEF_MMI_HOMEZONE_H_
3
4 /*******************************************************************************
5
6 CONDAT (UK)
7
8 ********************************************************************************
9
10 This software product is the property of Condat (UK) Ltd and may not be
11 disclosed to any third party without the express permission of the owner.
12
13 ********************************************************************************
14
15 $Project name: Basic MMI
16 $Project code: BMI
17 $Module: SMS
18 $File: MmiHomezone.h
19 $Revision: 1.0
20
21 $Author: Condat(UK)
22 $Date: 25/10/00
23
24 ********************************************************************************
25
26 Description: Homezone functionality in MMI
27
28
29
30 ********************************************************************************
31
32 $History: MmiHomezone.h
33
34 15/02/02 Original Condat(UK) BMI version.
35
36 Jun 14, 2005 REF: MMI-FIX-30439 x0018858
37 Description: The homezone/cityzone tags were not being displayed properly.
38 Solution: Modified to save the tags properly in caches and also made the
39 appropriate modifications to update the same properly during mobility.
40
41 $End
42
43 *******************************************************************************/
44
45 /****************************************************************************
46 * *
47 * CONSTANTS *
48 * *
49 ****************************************************************************/
50
51 #define HZ_ZONES_MAX 4 // Max number of homezones the user can have
52 #define HZ_RECENT_MAX 5 // Number of recent cells to be stored
53 #define HZ_CACHE_MAX 21 // Size of cache for each homezone
54 #define HZ_DISTANCE_MAX 100000 // Maximum distance in metres that user can be from centre of homezone
55
56 #define HZ_IDENTIFIER 221 // Message ID that identifies a homezone CB
57 #define HZ_COORD_DIGITS 6 // Number of digits in coordinates received in CB message
58 #define HZ_ACTIVE_FLAG 0x01 // If homezone is active, first bit in byte is set
59 #define HZ_CITYZONE_FLAG 0x02 // If homezone is a cityzone, second bit in byte is set
60
61 #define HZ_SIM_PARAMETERS 0x6F60 // Field in SIM storing homezone parameters
62 #define HZ_SIM_PARAMETERS_SIZE 123 // Size of this field in bytes
63 #define HZ_SIM_FIRST_ZONE 17 // Offset from start of parameters file that first zone is found
64 #define HZ_SIM_ZONE_SIZE 27 // Size of each zone in bytes
65 #define HZ_SIM_CELL_CACHE 0x6F61 // First of series of caches storing homezone cells
66 #define HZ_SIM_CELL_CACHE_SIZE 4 // Size of each cache entry (there will be HZ_CACHE_MAX of these per zone)
67 #define HZ_NAME_LENGTH 12 // Length of homezone name tag
68
69 #define HZ_NOT_IN_ZONE 0xFF // Value for current_zone when we aren't in a homezone
70
71 #define HZ_CB_NAME "Homezone" // Homezone cell broadcast channel name
72
73 /****************************************************************************
74 * *
75 * Permitted Network Names *
76 * *
77 ****************************************************************************/
78
79 #define HZ_PERMITTED_NETWORKS 1
80
81 static char *homezoneMNC_MCC[HZ_PERMITTED_NETWORKS] =
82 {
83 "26207", /* VIAG Interkom */
84 };
85
86 /****************************************************************************
87 * *
88 * Information storage for individual homezone *
89 * T_homezone *
90 * *
91 ****************************************************************************/
92
93 typedef struct
94 {
95 UBYTE zoneID; // The ID of the homezone
96 BOOL active; // Whether the homezone is activated at the moment
97 BOOL cityzone; // TRUE if the zone is a cityzone
98 U32 X; // The X position of its centre
99 U32 Y; // The Y position of its centre
100 U32 Rsquared; // The radius of the homezone, squared
101 char Tag[13]; // The text tag to be displayed when in the homezone
102 USHORT lac[HZ_CACHE_MAX]; // The cache of location area codes of cells known to be in this homezone
103 USHORT cid[HZ_CACHE_MAX]; // The cache of cell IDs known to be in this homezone
104 } T_homezone;
105
106
107 /****************************************************************************
108 * *
109 * General homezone information storage *
110 * T_homezone_data *
111 * *
112 ****************************************************************************/
113
114 typedef struct
115 {
116 UBYTE current_zone; // Current zone number (1 to HZ_ZONES_MAX). 0 if none.
117
118 U32 current_X; // Coordinates (received from CB) of centre of current cell
119 U32 current_Y;
120
121 UBYTE received; // Makes sure we have received all necessary data
122 UBYTE new_cell_res; // TRUE if a new cell reselection has just occurred
123 USHORT lac;
124 USHORT cid;
125
126 UBYTE recent_cell_index; // Location of recent cells that are within one of the user's homezones.
127 USHORT recent_cell[HZ_RECENT_MAX]; // These are used for quick lookup
128 UBYTE recent_cell_zone[HZ_RECENT_MAX]; // The homezone/cityzone of the recent cell
129
130 T_homezone homezone[HZ_ZONES_MAX]; // The user's homezones, up to HZ_ZONES_MAX
131
132 UBYTE buffer[HZ_SIM_PARAMETERS_SIZE]; // Buffers for reading from or writing to the SIM
133 UBYTE buffer2[HZ_SIM_CELL_CACHE_SIZE];
134 } T_homezone_data;
135
136 typedef enum
137 {
138 HZ_RECEIVED_CB = 1,
139 HZ_RECEIVED_CELLRES = 2,
140 HZ_RECEIVED_SIMDATA = 4,
141 HZ_RECEIVED_ALL = 7,
142 HZ_RECEIVED_HZ_OFF = 128 /* Homezone is switched off */
143 };
144
145 typedef enum
146 {
147 HZ_READ_ONCE_ONLY = 0, /* Only read SIM first time this function is called */
148 HZ_READ_SIM_AGAIN = 1 /* Read SIM any number of times */
149 };
150
151 /****************************************************************************
152 * *
153 * FUNCTION PROTOTYPES *
154 * *
155 ****************************************************************************/
156
157 void homezoneInit();
158
159 void homezoneCBData(char *message);
160
161 void homezoneReadSim(UBYTE read_again);
162
163 void homezoneReadSimCb(USHORT field, USHORT record, USHORT result);
164
165 void homezoneWriteSim(USHORT field, USHORT record);
166
167 void homezoneWriteSimCb(USHORT field, USHORT record, USHORT result);
168
169 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
170 // Added third argument to the function
171 //begin 30439
172 void homezoneUpdate(USHORT lac, USHORT cid, UBYTE keep);
173 //end 30439
174
175 void homezoneUpdateDisplay(void);
176
177 void homezoneActivateCB(void);
178 #endif