uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
branchRCL_3
changeset 13 3a60ebea00d0
parent 12 f93c875b566e
child 15 cd0ae4656946
equal deleted inserted replaced
12:f93c875b566e 13:3a60ebea00d0
   232     iCompositionSessions.Close();
   232     iCompositionSessions.Close();
   233     iCompositionHostSessions.Close();
   233     iCompositionHostSessions.Close();
   234     iCompositionTokens.Close();
   234     iCompositionTokens.Close();
   235     iWindowServerSessions.Close();
   235     iWindowServerSessions.Close();
   236     iAlfTargets.Close();
   236     iAlfTargets.Close();
       
   237     iOptionalGRAM.Close();
   237     }
   238     }
   238 
   239 
   239 void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost)
   240 void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost)
   240     {
   241     {
   241     if(!aHost)
   242     if(!aHost)
   407             }
   408             }
   408         }
   409         }
   409     __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<")
   410     __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<")
   410     }
   411     }
   411 
   412 
       
   413 void CAlfStreamerServer::FormAQueueL(TInt aOp, TInt aSecureId, TInt aWindowGroup)
       
   414     {
       
   415     __ALFLOGSTRING3("CAlfStreamerServer::FormAQueueL( %d, %d, %d )",aOp, aSecureId, aWindowGroup)
       
   416     if (aOp == EAlfVolunteerForGoomTarget)
       
   417         {
       
   418         TAlfCompParams param = {aSecureId, aSecureId, aWindowGroup, aWindowGroup};
       
   419         if (iOptionalGRAM.Find(param) != KErrNotFound)
       
   420             {
       
   421             __ALFLOGSTRING("CAlfStreamerServer::FormAQueueL: Already added");
       
   422             return;
       
   423             }    
       
   424         User::LeaveIfError(iOptionalGRAM.Append(param));
       
   425         }
       
   426     else
       
   427         {
       
   428         for(TInt i = iOptionalGRAM.Count()-1; i >= 0; i-- )
       
   429             {
       
   430             if ( iOptionalGRAM[i].iWindowGroup == aWindowGroup )
       
   431                 {
       
   432                 iOptionalGRAM.Remove(i);
       
   433                 }       
       
   434             }    
       
   435         }    
       
   436     }
   412 void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp)
   437 void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp)
   413     {
   438     {
   414     __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>")
   439     __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>")
   415     for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- )
   440     for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- )
   416         {
   441         {
   674             break;
   699             break;
   675             }    
   700             }    
   676         }
   701         }
   677     }
   702     }
   678     
   703     
   679 void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso)
   704 void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TInt aActiveAlso)
   680     {
   705     {
   681     RArray<TAlfCompParams>& arrayRef = aActiveAlso?iAlfTargets:iInactiveSurfaces;
   706     TBool optionalOnly(aActiveAlso==EAlfVolunteersForCommonGood);  // to lessen ambiquity..
   682         
   707         
       
   708     RArray<TAlfCompParams>* arrayPtr = 0;
       
   709     switch (aActiveAlso)
       
   710         {
       
   711         case EAlfInactiveWgs:
       
   712             arrayPtr = &iInactiveSurfaces;
       
   713             break;
       
   714         case EAlfAllWgsWithSurface:
       
   715             arrayPtr = &iAlfTargets;
       
   716             break;
       
   717         case EAlfVolunteersForCommonGood:
       
   718         default:
       
   719             arrayPtr = &iOptionalGRAM;      
       
   720             break;
       
   721         }
       
   722     
       
   723     RArray<TAlfCompParams>& arrayRef =  *arrayPtr; // :)
       
   724             
   683     TInt count = arrayRef.Count();    
   725     TInt count = arrayRef.Count();    
   684    __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count)
   726     __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count);
   685     if ( count == 0)
   727     if ( count == 0)
   686         {
   728         {
   687         aMessage.Complete(KErrNotFound);
   729         aMessage.Complete(KErrNotFound);
   688         return;
   730         return;
   689         }
   731         }
   690                 
   732                 
   691     TInt maxLength = aMessage.GetDesMaxLength(0);
   733     TInt maxLength = aMessage.GetDesMaxLength(0);
   692     TInt* array = new (ELeave) TInt [maxLength/4];
   734     TInt* arrayStart = new (ELeave) TInt [maxLength/4];
   693     
   735     TInt* array = arrayStart;
   694     count = Min(maxLength/4-1, count);
   736 	
       
   737     TInt payloadSize = optionalOnly?8:4; // what a waste
       
   738     count = Min(maxLength/payloadSize-1, count);
       
   739     
   695     for ( TInt i = 0; i<count; i++ ) 
   740     for ( TInt i = 0; i<count; i++ ) 
   696         {
   741         {
   697         __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayRef[i].iWindowGroup);
   742         __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayPtr[i].iWindowGroup);
   698         array[i] = arrayRef[i].iWindowGroup;
   743         *array = arrayRef[i].iWindowGroup;
       
   744         array++;
       
   745         if (optionalOnly)
       
   746             {           
       
   747             *array = arrayRef[i].iSecureId;
       
   748             array++;
       
   749             }
   699         }
   750         }
   700         
   751         
   701     array[count] = 0;
   752     *array = 0;
   702         
   753         
   703     TPtr8 ptr((TUint8*)array,maxLength,maxLength);
   754     TPtr8 ptr((TUint8*)arrayStart,maxLength,maxLength);
   704     aMessage.WriteL(0, ptr);
   755     aMessage.WriteL(0, ptr);
   705     delete[] array;
   756     delete[] arrayStart;
   706     aMessage.Complete(KErrNone);
   757     aMessage.Complete(KErrNone);
   707    __ALFLOGSTRING("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL <<")
   758    __ALFLOGSTRING("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL <<")
   708     }
   759     }
   709 
   760 
   710 void CAlfStreamerServer::AddSignal(CAlfStreamerServerSession* aSession, const RMessage2& aMessage)
   761 void CAlfStreamerServer::AddSignal(CAlfStreamerServerSession* aSession, const RMessage2& aMessage)
   992             TInt state = (TInt)aMessage.Int2();
  1043             TInt state = (TInt)aMessage.Int2();
   993             aMessage.Complete(KErrNone);    
  1044             aMessage.Complete(KErrNone);    
   994             server->Bridge()->AddData( EAlfDSSetDistractionWindow, windowGroupId, windowHandle, (TAny*)state );
  1045             server->Bridge()->AddData( EAlfDSSetDistractionWindow, windowGroupId, windowHandle, (TAny*)state );
   995             break;
  1046             break;
   996             }
  1047             }
       
  1048         case EAlfVolunteerForGoomTarget:  
       
  1049         case EAlfExcludeFromGoomTargets:
       
  1050             { // all these volunteers, just get into a line..
       
  1051             server->FormAQueueL(op, aMessage.Int0(), aMessage.Int1());    
       
  1052             break;    
       
  1053             }            
       
  1054             
       
  1055             
   997         default:
  1056         default:
   998             {
  1057             {
   999             aMessage.Complete(KErrNotSupported);
  1058             aMessage.Complete(KErrNotSupported);
  1000             break;
  1059             break;
  1001             }        
  1060             }