sysstatemgmt/systemstatemgr/sus/src/susemergencycallrfadaptation.cpp
branchRCL_3
changeset 61 8cb079868133
parent 60 ccb4f6b3db21
equal deleted inserted replaced
60:ccb4f6b3db21 61:8cb079868133
   276 	{
   276 	{
   277     __ASSERT_DEBUG((iCurrentMessage != NULL), User::Panic(KPanicSsmSus, EEmergencyAdaptationMessageNullPtrError));
   277     __ASSERT_DEBUG((iCurrentMessage != NULL), User::Panic(KPanicSsmSus, EEmergencyAdaptationMessageNullPtrError));
   278 	DEBUGPRINT2A("CEmergencyCallRfAdaptationRequests processed the request with funtion id: %d", iCurrentMessage->Function());
   278 	DEBUGPRINT2A("CEmergencyCallRfAdaptationRequests processed the request with funtion id: %d", iCurrentMessage->Function());
   279 	iCurrentMessage->Complete(iStatus.Int());
   279 	iCurrentMessage->Complete(iStatus.Int());
   280 	DeleteAdaptationMessage();
   280 	DeleteAdaptationMessage();
       
   281 	iCurrentMessage = NULL;  
       
   282 
   281 	if( (iPendingEmergencyRequestsQueue.Count()) > 0 )
   283 	if( (iPendingEmergencyRequestsQueue.Count()) > 0 )
   282 		{
   284 		{
   283         CEmergencyAdaptationMessage *messageCopy = NULL;
   285         CEmergencyAdaptationMessage *messageCopy = NULL;
   284         Dequeue(messageCopy);				
   286         Dequeue(messageCopy);				
   285 		Submit(messageCopy);
   287 		Submit(messageCopy);
   291 	
   293 	
   292 	if(iCurrentMessage != NULL)	
   294 	if(iCurrentMessage != NULL)	
   293 		{
   295 		{
   294         iCurrentMessage->Complete(aError);
   296         iCurrentMessage->Complete(aError);
   295 		DeleteAdaptationMessage();
   297 		DeleteAdaptationMessage();
       
   298 		iCurrentMessage = NULL;
   296 		}
   299 		}
   297 	
   300 	
   298 	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
   301 	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
   299         {
   302         {
   300         Dequeue(iCurrentMessage);
   303         Dequeue(iCurrentMessage);
   301         iCurrentMessage->Complete(aError);
   304         iCurrentMessage->Complete(aError);
   302         DeleteAdaptationMessage();
   305         DeleteAdaptationMessage();
       
   306         iCurrentMessage = NULL;
   303         }
   307         }
   304 	
   308 	
   305 	return KErrNone;
   309 	return KErrNone;
   306 		
   310 		
   307 	}
   311 	}
   310 	{
   314 	{
   311 	if(iCurrentMessage != NULL)	
   315 	if(iCurrentMessage != NULL)	
   312 		{
   316 		{
   313 		iCurrentMessage->Complete(KErrCancel);
   317 		iCurrentMessage->Complete(KErrCancel);
   314 		DeleteAdaptationMessage();
   318 		DeleteAdaptationMessage();
       
   319 		iCurrentMessage = NULL;
   315 		}
   320 		}
   316 		
   321 		
   317 	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
   322 	while( (iPendingEmergencyRequestsQueue.Count() > 0 ))
   318 		{
   323 		{
   319         Dequeue(iCurrentMessage);
   324         Dequeue(iCurrentMessage);
   320         iCurrentMessage->Complete(KErrCancel);
   325         iCurrentMessage->Complete(KErrCancel);
   321         DeleteAdaptationMessage();
   326         DeleteAdaptationMessage();
       
   327         iCurrentMessage = NULL;
   322 		}
   328 		}
   323 	}
   329 	}
   324 
   330 
   325 /**
   331 /**
   326  * Sets the Priority Client Session
   332  * Sets the Priority Client Session
   341 /**
   347 /**
   342  * Reset the AdaptationMessage if it is created using reserved pointer or delete the pointer
   348  * Reset the AdaptationMessage if it is created using reserved pointer or delete the pointer
   343  */
   349  */
   344 void CEmergencyCallRfAdaptation::DeleteAdaptationMessage()
   350 void CEmergencyCallRfAdaptation::DeleteAdaptationMessage()
   345     {
   351     {
   346 	//Do not delete iCurrentMessage if it is owned by iAdaptationReservedMessageArray.
   352     if(iCurrentMessage->IsMessageReserved())
   347 	if(iCurrentMessage->IsMessageReserved())
       
   348         {
   353         {
   349         iCurrentMessage->UnsetMessageStatus(EMsgInUse);
   354         iCurrentMessage->UnsetMessageStatus(EMsgInUse);
   350         ++iReserveMsgCount;
   355         ++iReserveMsgCount;
   351         }
   356         }
   352     else
   357     else
   353         {
   358         {
   354         delete iCurrentMessage;
   359         delete iCurrentMessage;
   355 		}
   360         }    
   356 	iCurrentMessage = NULL;
       
   357     }
   361     }
   358 
   362 
   359 void CEmergencyCallRfAdaptation::Dequeue(CEmergencyAdaptationMessage *&aCurrentMessage)
   363 void CEmergencyCallRfAdaptation::Dequeue(CEmergencyAdaptationMessage *&aCurrentMessage)
   360     {
   364     {
   361     aCurrentMessage = iPendingEmergencyRequestsQueue[0];
   365     aCurrentMessage = iPendingEmergencyRequestsQueue[0];