diff src/ui/bmi/mmiHomezone.c @ 92:c0052fe355d3

src/ui/bmi/*.[ch]: rm trailing white space
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 08 Nov 2020 06:39:16 +0000
parents 67bfe9f274f6
children 60f8c8e710f4
line wrap: on
line diff
--- a/src/ui/bmi/mmiHomezone.c	Sun Nov 08 05:12:05 2020 +0000
+++ b/src/ui/bmi/mmiHomezone.c	Sun Nov 08 06:39:16 2020 +0000
@@ -2,28 +2,28 @@
 
 					CONDAT (UK)
 
-********************************************************************************                                                                              
+********************************************************************************
 
  This software product is the property of Condat (UK) Ltd and may not be
- disclosed to any third party without the express permission of the owner.                                 
-                                                                              
+ disclosed to any third party without the express permission of the owner.
+
 ********************************************************************************
 
- $Project name:	Basic MMI                                                      
- $Project code:	BMI                                                            
- $Module:		
+ $Project name:	Basic MMI
+ $Project code:	BMI
+ $Module:
  $File:		    MmiHomezone.c
- $Revision:		1.0                                                       
-                                                                              
- $Author:		Condat(UK)                                                         
- $Date:		    15/02/02                                                      
-                                                                               
+ $Revision:		1.0
+
+ $Author:		Condat(UK)
+ $Date:		    15/02/02
+
 ********************************************************************************
-                                                                              
+
  Description: Homezone functionality in MMI
- 
-   
-                        
+
+
+
 ********************************************************************************
 
  $History: MmiHomezone.c
@@ -32,12 +32,12 @@
 	28/05/02			Latest Condat(UK) BMI version
 
 	Sep 14, 2007	REF: OMAPS00145865  Adrian Salido
-	Description:	FT - MMI: Wrong trace class 
-	Solution:		changed some event traces to function traces because the information content of 
+	Description:	FT - MMI: Wrong trace class
+	Solution:		changed some event traces to function traces because the information content of
 				this is low for non-MMI people and against TI coding convention.
 
 	Mar 14, 2006 DR: OMAPS00061468 - x0035544.
-   	Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails 
+   	Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails
    	Solution : In the function homezoneUpdateDisplay(), additional parameter has been added to the
    	function call addSatMessage() under the flag FF_MMI_SAT_ICON to support SAT Icon for IDLE TEXT display.
 
@@ -45,12 +45,12 @@
        Description: OMAPS00045726 / MMI-FIX-30439 Follow-Up : ifdef for FF Home Zone forgotten.
        Solution: Added Feature flag FF_HOMEZONE for the function sms_homezoneCBToggle(U8 Activate_CB)
        in this file as it has got the prototype for this function.
-       
+
 	Jun 14, 2005 REF: MMI-FIX-30439 x0018858
    	Description: The homezone/cityzone tags were not being displayed properly.
-   	Solution: Modified to save the tags properly in caches and also made the 
+   	Solution: Modified to save the tags properly in caches and also made the
 	appropriate modifications to update the same properly during mobility.
-	   
+
  $End
 
 *******************************************************************************/
@@ -129,7 +129,7 @@
 
 
 //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
-// enable HZ trace 
+// enable HZ trace
 //#undef	TRACE_MMIHOMEZONE
 #define TRACE_MMIHOMEZONE 1
 
@@ -169,8 +169,8 @@
  $Function:    	homezoneInit
 
  $Description:	Initialise homezone data structure.  Reset the recent cache.
- 
- $Returns:		
+
+ $Returns:
 
  $Arguments:
 *******************************************************************************/
@@ -182,11 +182,11 @@
 	//Jun 14, 2005 REF: MMI-FIX-30439 x0018858
 	// Added the following local variables.
 	//begin 30439
-	UBYTE          version; 
+	UBYTE          version;
 	USHORT         max_rcd;
 	EF_HZCACHE     cache;
 	//end 30439
-	
+
 	TRACE_FUNCTION("homezoneInit()");
 
 	/* Set all data to 0 */
@@ -197,7 +197,7 @@
 	data->recent_cell_index = HZ_RECENT_MAX-1;								// Next entry will loop round & be at start of cache
 
 	/* Set up recent cell cache */
-	
+
 	for (cacheIndex = 0; cacheIndex<HZ_RECENT_MAX; cacheIndex++)
 	{
 		data->recent_cell[cacheIndex] = 0;
@@ -228,24 +228,24 @@
 	}
 
 	data->new_cell_res = FALSE;
-	
+
 	return;
 }
 
-			
+
 /*******************************************************************************
 
  $Function:    	homezoneReadSim
 
  $Description:	Read homezone data in from SIM.  Checks to see if conditions (SIM,
  				network) are correct for homezone; switches it off if not.
- 
+
  $Returns:		None.
 
  $Arguments:	read_again	- if this is HZ_READ_ONCE_ONLY, then SIM fields will not
  					be read in again if they have already been read in once.
  					If this is HZ_READ_SIM_AGAIN, they will be read in anyway.
- 					
+
 *******************************************************************************/
 
 void homezoneReadSim(UBYTE read_again)
@@ -253,22 +253,22 @@
 	T_homezone_data		*data = &homezoneData;
 	char IMSI[17];
 	char MNC_MCC[6];
-	
+
 	USHORT				networkIndex;
 	UBYTE				networkOK;
 	USHORT				tries;
 
 	/* Check if homezone is switched off */
-	
+
 	if (data->received == HZ_RECEIVED_HZ_OFF)
 		return;
 
 	/* SPR877 - If read_again specifies that SIM data should not be re-read, exit from function
 	 * provided we have read it once. */
-	 
+
 	if (read_again == HZ_READ_ONCE_ONLY && data->received & HZ_RECEIVED_SIMDATA)
 		return;
-	
+
 	TRACE_FUNCTION("homezoneReadSim()");
 
 	/* Check if network operator is in list */
@@ -276,12 +276,12 @@
 	networkOK = FALSE;
 
 	tries = 0;
-	
+
 	while ((qAT_PlusCIMI(CMD_SRC_LCL, IMSI)) != AT_CMPL  && tries < 5)
 	{
 		tries++;
 	}
-		
+
 	strncpy(MNC_MCC, IMSI, 5);
 	MNC_MCC[5] =0;	//terminate string
 
@@ -321,7 +321,7 @@
 		data->received = HZ_RECEIVED_HZ_OFF;
 		hzFlag = 0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 - Seting the variable
 	}
-	
+
 	return;
 }
 
@@ -332,7 +332,7 @@
 
  $Description:	Callback, called when read sim has occurred.  Fills up the homezone
  				data structure with the appropriate values retrieved from SIM.
- 
+
  $Returns:		None.
 
  $Arguments: 	field - the SIM field that was just read
@@ -348,10 +348,10 @@
 	USHORT			fileIndex;
 	USHORT			hzIndex;
 	UBYTE			keepLooking;
-	U8	Activate_cb =0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858 
+	U8	Activate_cb =0; //Jun 14, 2005 REF: MMI-FIX-30439 x0018858
 						//To activate/deactivate homezoneCB
 	TRACE_FUNCTION("homezoneReadSimCb()");
-	
+
 #ifdef TRACE_MMIHOMEZONE
 	TRACE_EVENT_P2("Have just read SIM file: %x record %d", field, record);
 #endif
@@ -359,7 +359,7 @@
 	/* Read in general homezone data.  If reading first SIM field fails, switch homezone off */
 
 	if (field==HZ_SIM_PARAMETERS)
-	{	
+	{
 		/* check SIM read result for homezone parameter */
 		//Jun 14, 2005 REF: MMI-FIX-30439 x0018858
 		//begin 30439
@@ -378,7 +378,7 @@
 		/* SH - this is already done at startup */
 		record = HZ_CACHE_MAX;
 	}
-	
+
 	/* Read in records for each homezone cache */
 
 	/* check SIM read result for hoemzone cache */
@@ -392,7 +392,7 @@
 		hzIndex = field - HZ_SIM_CELL_CACHE;
 		simFile = data->buffer2;
 		fileIndex = 0;
-		
+
 		homezone[hzIndex].lac[record-1] = readHexFromSimfile(&simFile[fileIndex],2);
 		fileIndex+=2;
 		homezone[hzIndex].cid[record-1] = readHexFromSimfile(&simFile[fileIndex],2);
@@ -405,7 +405,7 @@
 	/* Read in the next record */
 
 	keepLooking = TRUE;
-	
+
 	while (keepLooking)
 	{
 		/* check SIM read result for hoemzone cache */
@@ -448,19 +448,19 @@
 				//Jun 14, 2005 REF: MMI-FIX-30439 x0018858
 				//Call to activate the Homezone CB.
 				Activate_cb = 1;
-				
+
 #ifdef FF_HOMEZONE
 				sms_homezoneCBToggle(Activate_cb);
 #endif
 				homezoneUpdate(0, 0, 1); /* new VO : speed up update */
 			}
 			//end 30439
-			 
+
 		}
 		else if (homezone[hzIndex].active)
 		{
 			keepLooking = FALSE;
-			
+
 #ifdef TRACE_MMIHOMEZONE
 	//TRACE_EVENT_P3("HZ READ HZ %d field %X record %d", hzIndex, field, record);
 #endif
@@ -470,7 +470,7 @@
 			}
 		}
 	}
-	
+
 	return;
 }
 
@@ -480,7 +480,7 @@
  $Function:    	homezoneReadParams
 
  $Description:	Decode the homezone parameters from the first SIM field
- 
+
  $Returns:		None.
 
  $Arguments:	None.
@@ -497,7 +497,7 @@
 	char			character;
 
 	TRACE_FUNCTION("homezoneReadParams()");
-	
+
 	simFile = data->buffer;
 	fileIndex = HZ_SIM_FIRST_ZONE;										// Point to the first homezone data
 
@@ -505,21 +505,21 @@
 	{
 		homezone[hzIndex].zoneID = simFile[fileIndex];				// Read in the various parameters
 		fileIndex++;
-		
+
 		homezone[hzIndex].X = readHexFromSimfile(&simFile[fileIndex],4);
 		fileIndex += 4;
 		homezone[hzIndex].Y = readHexFromSimfile(&simFile[fileIndex],4);
 		fileIndex += 4;
 		homezone[hzIndex].Rsquared = readHexFromSimfile(&simFile[fileIndex],4);
 		fileIndex += 4;
-		
+
 		homezone[hzIndex].active = (BOOL) (simFile[fileIndex] & HZ_ACTIVE_FLAG)/HZ_ACTIVE_FLAG;
 		homezone[hzIndex].cityzone = (BOOL) (simFile[fileIndex] & HZ_CITYZONE_FLAG)/HZ_CITYZONE_FLAG;
 		fileIndex++;
-					
+
 		/* Read in the 12-character tag name */
-		
-		for (tagIndex = 0; tagIndex<HZ_NAME_LENGTH; tagIndex++)					
+
+		for (tagIndex = 0; tagIndex<HZ_NAME_LENGTH; tagIndex++)
 		{
 			character = (char) simFile[fileIndex];
 			fileIndex++;
@@ -552,7 +552,7 @@
 
  $Description:	Write homezone data to the SIM
 				SPR 877 - SH - now just writes a single record
- 
+
  $Returns:		None.
 
  $Arguments:	cache, record
@@ -569,17 +569,17 @@
 
 	if (data->received==HZ_RECEIVED_HZ_OFF)
 		return;
-	
+
 	TRACE_FUNCTION("homezoneWriteSim()");
 
 	hzIndex = field-HZ_SIM_CELL_CACHE;
-	
+
 #ifdef TRACE_MMIHOMEZONE
 	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]);
 #endif
 
 	if (data->homezone[hzIndex].active)
-	{	
+	{
 		simFile = data->buffer2;
 		fileIndex = 0;
 		writeHexToSimfile(&simFile[fileIndex], data->homezone[hzIndex].lac[record-1], 2 );
@@ -602,7 +602,7 @@
  $Description:	Write homezone data to the SIM.  This function is called after a previous
  				SIM write (or, in the initial case, by homezoneWriteSim above).
 				SPR877 - SH - Previous functionality no longer required here.
- 
+
  $Returns:		None.
 
  $Arguments:	field - the SIM field that is to be written
@@ -627,7 +627,7 @@
  $Function:    	homezoneCBData
 
  $Description:	Make sure correct homezone CB channel is set up and activate CB
- 
+
  $Returns:		None.
 
  $Arguments:	message		- The text of the cell broadcast message
@@ -644,14 +644,14 @@
 
 	if (data->received==HZ_RECEIVED_HZ_OFF)
 		return;
-	
+
 	TRACE_FUNCTION("homezoneActivateCB()");
-	
+
 	/* Check table to see if correct channel is included */
-	
+
 	stopSearch = FALSE;
 	emptyID = 0xFFFF;
-	
+
 	for (index=0; index<MAX_MIDS && !stopSearch; index++)
 	{
 		TRACE_EVENT_P2("Mid %d is %X", index, g_smscb_data.CBTopics.entry[index].msg_id);
@@ -663,11 +663,11 @@
 		{
 			emptyID = index;
 			stopSearch = TRUE;
-		}		
+		}
 	}
 
 	TRACE_EVENT_P1("Emtpy ID %d", emptyID);
-	
+
 	if (emptyID!=0xFFFF && emptyID<MAX_MIDS-1)
 	{
 		strncpy (g_smscb_data.CBTopics.entry[emptyID].name, HZ_CB_NAME, CB_TAG_LENGTH);
@@ -678,7 +678,7 @@
 	    emptyID += 1;
 	    g_smscb_data.CBTopics.length = emptyID;
 	}
-	
+
     smscb_setCBsettings(SMSCB_SWITCH_ON);
 	return;
 }
@@ -690,7 +690,7 @@
 
  $Description:	A cell broadcast message has been received, containing information about
  				the location of the current cell
- 
+
  $Returns:		None.
 
  $Arguments:	message		- The text of the cell broadcast message
@@ -708,24 +708,24 @@
 	TRACE_FUNCTION("homezoneCellData()");
 
 	/* Calculate the current position from the text of the message */
-	
+
 	data->current_X = calculateDecimal( &message[0], HZ_COORD_DIGITS );
 	data->current_Y = calculateDecimal( &message[HZ_COORD_DIGITS], HZ_COORD_DIGITS );
 
 #ifdef TRACE_MMIHOMEZONE
 	TRACE_EVENT_P2("current_X: %X, current_Y: %X", data->current_X, data->current_Y);
 #endif
-			
+
 	data->received |= HZ_RECEIVED_CB;				// We now have received cell broadcast message.
 
 	/* SPR877 - SH - now only call HZ algorithm if a cell res has recently taken place */
-	
+
 	if (data->received==HZ_RECEIVED_ALL && data->new_cell_res)  // If we've received everything, call algorithm.
 	{
 		homezoneLocate();
 		data->new_cell_res = FALSE;
 	}
-			
+
  	return;
 }
 
@@ -736,11 +736,11 @@
 
  $Description:	Looks at coordinates from cell broadcast message and calculates if
  				they are in a homezone
- 
+
  $Returns:		None
 
  $Arguments:	None
- 
+
 *******************************************************************************/
 
 void homezoneLocate()
@@ -753,7 +753,7 @@
 	USHORT			cacheIndex=0;
 	U32				Dsquared;
 	BOOL			foundInCache;
-	USHORT			cacheFreeSpace=0;	
+	USHORT			cacheFreeSpace=0;
 	USHORT			field;
 	USHORT			record=0;
 	//Jun 14, 2005 REF: MMI-FIX-30439 x0018858
@@ -763,10 +763,10 @@
 	//end 30439
 
 	/* Check if homezone is already switched off */
-	
+
 	if (data->received==HZ_RECEIVED_HZ_OFF)
 		return;
-	
+
 	TRACE_FUNCTION("homezoneLocate()");
 
 	data->current_zone = HZ_NOT_IN_ZONE;							// We don't know if we're in a homezone yet (homezones = 0 to 3)
@@ -779,19 +779,19 @@
 #ifdef TRACE_MMIHOMEZONE
 		TRACE_EVENT_P2("Current cell X: %X, Y: %X", data->current_X,data->current_Y);
 #endif
-	
+
 		/* Check to see if (current_X,current_Y) is in any of the defined homezones */
-		
+
 		for (hzIndex=0; hzIndex<HZ_ZONES_MAX && data->current_zone==HZ_NOT_IN_ZONE; hzIndex++)						// For each homezone...
 		{
-#ifdef TRACE_MMIHOMEZONE		
+#ifdef TRACE_MMIHOMEZONE
 			TRACE_EVENT_P1("Homezone %d...", hzIndex);
 			TRACE_EVENT_P3("Has coords X: %X, Y: %X, R2: %X", homezone[hzIndex].X, homezone[hzIndex].Y, homezone[hzIndex].Rsquared);
 #endif
 
 			if (homezone[hzIndex].active)										// Provided the homezone is active
 			{
-#ifdef TRACE_MMIHOMEZONE														// Calculate X and Y distance 
+#ifdef TRACE_MMIHOMEZONE														// Calculate X and Y distance
 				TRACE_EVENT("Is active.");
 #endif
 				deltaX = labs(data->current_X-homezone[hzIndex].X);				// between centre of current cell
@@ -799,20 +799,20 @@
 #ifdef TRACE_MMIHOMEZONE
 				TRACE_EVENT_P1("deltaX = %d",deltaX);
 				TRACE_EVENT_P1("deltaY = %d",deltaY);
-#endif		
+#endif
 				if (deltaX<=HZ_DISTANCE_MAX && deltaY<=HZ_DISTANCE_MAX) 		// If not too far...
 				{
 					Dsquared = deltaX*deltaX+deltaY*deltaY;						// Calculate the resultant distance squared
 #ifdef TRACE_MMIHOMEZONE
 						TRACE_EVENT_P1("Dsquared = %d",Dsquared);
-#endif							
+#endif
 					if (Dsquared <= homezone[hzIndex].Rsquared)					// If within radius of homezone squared
 					{
 #ifdef TRACE_MMIHOMEZONE
 						TRACE_EVENT("Contains the current cell.");
 #endif
 						data->current_zone = hzIndex;						// Current zone is this homezone
-						
+
 						if (!homezone[hzIndex].cityzone)							// Then: if it's not a cityzone
 						{
 #ifdef TRACE_MMIHOMEZONE
@@ -838,7 +838,7 @@
 #endif
 								if (cacheFreeSpace==HZ_CACHE_MAX)					// If we didn't find a free space...
 								{
-									cacheFreeSpace = rand() % HZ_CACHE_MAX;			// Choose a random entry 
+									cacheFreeSpace = rand() % HZ_CACHE_MAX;			// Choose a random entry
 								}
 								homezone[hzIndex].cid[cacheFreeSpace] = data->cid;	// And store current cell there
 								homezone[hzIndex].lac[cacheFreeSpace] = data->lac;	// with its location area code
@@ -906,7 +906,7 @@
 #endif
 					data->recent_cell[data->recent_cell_index] = data->cid;
 					data->recent_cell_zone[data->recent_cell_index] = data->current_zone;
-					
+
 					//Jun 14, 2005 REF: MMI-FIX-30439 x0018858
 					//begin 30439
 					/* write cache to PCM */
@@ -937,30 +937,30 @@
 #ifdef TRACE_MMIHOMEZONE
 	TRACE_EVENT("CACHES AFTER UPDATE");
 	for (hzIndex=0; hzIndex<HZ_ZONES_MAX; hzIndex++)			// For each homezone...
-	{	
+	{
 		/* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */
 		MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag);
 
 		if (homezone[hzIndex].active && !homezone[hzIndex].cityzone)				// If it's active, and not a cityzone
 		{
 			for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX; cacheIndex++)	// Check the cache.
-			{ 
+			{
 				TRACE_EVENT_P3("Cache %d: lac %X, cid %X", cacheIndex, homezone[hzIndex].lac[cacheIndex], homezone[hzIndex].cid[cacheIndex]);
 			}
 		}
 	}
 #endif
 	/* Update icon/text tag. */
-	
+
 	homezoneUpdateDisplay();
-	
+
 	/* Write data back to SIM if cache has changed & SIM files present */
 
 	if (field!=HZ_NOT_IN_ZONE && (data->received & HZ_RECEIVED_SIMDATA))
 	{
 		homezoneWriteSim(field, record);
 	}
-	
+
 	return;
 }
 
@@ -970,8 +970,8 @@
  $Function:    	homezoneUpdate
 
  $Description:	Main homezone function; check whether MS is in a homezone or not
- 
- $Returns:		
+
+ $Returns:
 
  $Arguments:	lac		- the location area code of the current cell (on cell reselection)
  				cid	- the ID of the current cell (on cell reselection)
@@ -991,10 +991,10 @@
 	/* Check if homezone is already switched off */
 
 	TRACE_EVENT_P1("Data received: %d", data->received);
-	
+
 	if (data->received==HZ_RECEIVED_HZ_OFF)
 		return;
-	
+
 	TRACE_FUNCTION("homezoneUpdate()");
 
 	data->current_zone = HZ_NOT_IN_ZONE;							// We don't know if we're in a homezone yet (homezones = 0 to 3)
@@ -1037,32 +1037,32 @@
 
 	if (!(data->received & HZ_RECEIVED_SIMDATA))
 		return;
-	
+
 	/* Check homezone cache for each homezone */
 	/* Can do this even if we haven't received the CB message */
 
 #ifdef TRACE_MMIHOMEZONE
 	TRACE_EVENT("Checking zone caches...");
 #endif
-	
+
 	for (hzIndex=0; hzIndex<HZ_ZONES_MAX && data->current_zone==HZ_NOT_IN_ZONE; hzIndex++)			// For each homezone...
 	{
 #ifdef TRACE_MMIHOMEZONE
 		/* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */
 		MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag);
 #endif
-		
+
 		if (homezone[hzIndex].active && !homezone[hzIndex].cityzone)				// If it's active, and not a cityzone
 		{
 #ifdef TRACE_MMIHOMEZONE
 		TRACE_EVENT("Is Active.");
-#endif		
+#endif
 			for (cacheIndex=0; cacheIndex<HZ_CACHE_MAX && data->current_zone==HZ_NOT_IN_ZONE; cacheIndex++)	// Check the cache.
-			{ 
+			{
 #ifdef TRACE_MMIHOMEZONE
 					TRACE_EVENT_P3("Cache %d: lac %X, cid %X", cacheIndex, homezone[hzIndex].lac[cacheIndex], homezone[hzIndex].cid[cacheIndex]);
 #endif
-				
+
 				if (cid==homezone[hzIndex].cid[cacheIndex])					// If the current cell is in the cache....
 				{
 #ifdef TRACE_MMIHOMEZONE
@@ -1093,20 +1093,20 @@
 		/* x0083025 on Sep 14, 2007 for OMAPS00145865 (adrian) */
 		MMI_TRACE_EVENT_P2("Zone %d (%s)", hzIndex, homezone[hzIndex].Tag);
 #endif
-		
+
 		if (homezone[hzIndex].active && homezone[hzIndex].cityzone)				// If it's active, and not a cityzone
 		{
 #ifdef TRACE_MMIHOMEZONE
 		TRACE_EVENT("Is Active.");
-#endif		
-		
+#endif
+
 		for (cacheIndex=0; cacheIndex<HZ_RECENT_MAX && data->current_zone==HZ_NOT_IN_ZONE; cacheIndex++)	// Check the cache.
-		{ 
+		{
 #ifdef TRACE_MMIHOMEZONE
 				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]);
 #endif
-				
-			if (cid==data->recent_cell[cacheIndex] && data->recent_cell_zone[cacheIndex]!=HZ_NOT_IN_ZONE) // If we're in that cell 
+
+			if (cid==data->recent_cell[cacheIndex] && data->recent_cell_zone[cacheIndex]!=HZ_NOT_IN_ZONE) // If we're in that cell
 				{
 #ifdef TRACE_MMIHOMEZONE
 				TRACE_EVENT_P1("FOUND cityzone in cache %d.",cacheIndex);
@@ -1139,8 +1139,8 @@
 
  $Function:    	homezoneUpdateDisplay
 
- $Description:	
- 
+ $Description:
+
  $Returns:		Updates the homezone icon and text string appropriately
 
  $Arguments:	none
@@ -1153,13 +1153,13 @@
 	TRACE_FUNCTION("homezoneUpdateDisplay()");
 
 	iconsDeleteState(iconIdHomezone);
-	
+
 #ifdef FF_MMI_SAT_ICON
 	addSatMessage(NULL, 0, 0, NULL, FALSE, SAT_ICON_NONE);
 #else
 	addSatMessage(NULL);
 #endif
-	
+
 	if (data->current_zone!=HZ_NOT_IN_ZONE)										// If not in a homezone, leave blank
 	{
 //x0035544 Mar 14, 2006 DR:OMAPS00061468
@@ -1173,7 +1173,7 @@
 			iconsSetState(iconIdHomezone);
 		}
 	}
-	
+
 	return;
 }
 
@@ -1182,8 +1182,8 @@
 
  $Function:    	calculateDecimal
 
- $Description:	
- 
+ $Description:
+
  $Returns:		Returns a decimal number from a string of ascii digits
 
  $Arguments:	none
@@ -1193,7 +1193,7 @@
 {
 	U32 total = 0;
 	int index;
-	
+
 	/* decode each decimal character in turn */
 	for (index = 0; index < length; index++ )
 	{
@@ -1202,7 +1202,7 @@
 			total = ( total * 10 ) + ( string[index] - '0' );
 		}
 	}
-	
+
 	return total;
 }
 
@@ -1211,7 +1211,7 @@
  $Function:    	readHexFromSimfile
 
  $Description:	Reads a hex string (MSB first) from a sim file
- 
+
  $Returns:		The hex number
 
  $Arguments:	simFile - the point in the simFile at which the string occurs
@@ -1222,12 +1222,12 @@
 {
 	U32 total = 0;
 	int index;
-	
+
 	for ( index = 0; index < length; index++ )
 	{
 		total = ( total << 8 ) + simFile[index];
 	}
-  
+
 	return total;
 }
 
@@ -1236,7 +1236,7 @@
  $Function:    	writeHexToSimfile
 
  $Description:	Writes a hex string (MSB first) to a sim file
- 
+
  $Returns:		None
 
  $Arguments:	simFile - the point in the simFile at which the string occurs
@@ -1253,7 +1253,7 @@
 
 	/* Note: '-1' below clarification:
 	 * E.g. index=0, length=4: most significant byte is number shifted 3 bytes right. */
-	 
+
 	for ( index = 0; index < length; index++ )
 	{
 		simFile[index] = (value >> ((length-index-1)*8)) & 0xFF;	/* SPR877 - SH - wrong before, added *8 */
@@ -1261,6 +1261,6 @@
 		TRACE_EVENT_P2("Simfile %d is %X", index,  simFile[index]);
 #endif
 	}
-  
+
 	return;
 }