datacommsserver/esockserver/CoreProviders/src/coretiernotificationactivity.cpp
changeset 4 928ed51ddc43
parent 0 dfb7c4ff071f
child 67 00c6709d25aa
equal deleted inserted replaced
3:b6139031a239 4:928ed51ddc43
   154 	// now pass control back to the mesh so a separate activity can decide on the required collectors
   154 	// now pass control back to the mesh so a separate activity can decide on the required collectors
   155 
   155 
   156 
   156 
   157 /*virtual*/ void CTierNotificationActivity::StartL(RPointerArray<MDataCollector>& aCollectors)
   157 /*virtual*/ void CTierNotificationActivity::StartL(RPointerArray<MDataCollector>& aCollectors)
   158 	{
   158 	{
   159 	CleanupResetAndDestroyPushL(aCollectors);
       
   160 	if(aCollectors.Count() == 0)
   159 	if(aCollectors.Count() == 0)
   161 		{
   160 		{
   162 		User::Leave(KErrArgument);
   161 		User::Leave(KErrArgument);
   163 		}
   162 		}
   164 
   163 
   165 	iDbSession = CMDBSession::NewL(KCDVersion1_2);
   164 	iDbSession = CMDBSession::NewL(KCDVersion1_2);
   166 
   165 
   167 	iCache = CTierNotificationCache::NewL();
   166 	iCache = CTierNotificationCache::NewL();
   168 
   167 
   169 	// set up a session with each collector
   168 	// set up a session with each collector
   170 	for(TInt sessionId=0 ; sessionId<aCollectors.Count() ; ++sessionId)
   169 	for (TInt sessionId=0 ; sessionId<aCollectors.Count() ; ++sessionId)
   171 		{
   170 		{
   172 		CDataCollectorSession* newCollector = CDataCollectorSession::NewL(aCollectors[sessionId], *this, sessionId );
   171 		CDataCollectorSession* newCollector = CDataCollectorSession::NewL(aCollectors[sessionId], *this, sessionId );
   173 		__ASSERT_DEBUG(newCollector, User::Panic(KSpecAssert_ESockCrPrvTNotAC, 2));
   172 		CleanupStack::PushL(newCollector);
   174 		iCollectorSessions.AppendL(newCollector);
   173 		iCollectorSessions.AppendL(newCollector);
   175 		aCollectors[sessionId] = 0; // now owned by *this so don't want it to be in the cleanup path twice!
   174 		CleanupStack::Pop(newCollector);
   176 		}
   175 		
   177 
   176 		// now owned by the CDataCollectorSession in iCollectorSessions so don't want it to be in the cleanup path twice!
   178 	CleanupStack::PopAndDestroy();
   177 		aCollectors[sessionId] = 0;
       
   178 		}
       
   179 
   179 
   180 
   180 	// Must run session creation and start loops separately in case the initial data fetch is synchronous.
   181 	// Must run session creation and start loops separately in case the initial data fetch is synchronous.
   181 	// Reasoning:
   182 	// Reasoning:
   182 	//  when a full set of data for each collector is received, notification is only allowed if all
   183 	//  when a full set of data for each collector is received, notification is only allowed if all
   183 	//  collectors know they've got their full set.
   184 	//  collectors know they've got their full set.