accessoryservices/accessoryserver/src/Server/AccSrvSubAsyComms.cpp
branchRCL_3
changeset 8 8d1d8440b626
parent 0 4e1aa6a622a0
child 20 1ddbe54d0645
equal deleted inserted replaced
7:1fc153c72b60 8:8d1d8440b626
   290     TPckg<TASYBTAccInfo>         valueBTPckg( btInfo );
   290     TPckg<TASYBTAccInfo>         valueBTPckg( btInfo );
   291     TInt asyDataSize ( 0 );
   291     TInt asyDataSize ( 0 );
   292     HBufC8 *asyData = NULL;    
   292     HBufC8 *asyData = NULL;    
   293     CBufFlat* objectBuf = NULL;    
   293     CBufFlat* objectBuf = NULL;    
   294     
   294     
   295     //
   295         		    
   296     // Allocated the buffer which is really needed!
       
   297     // 
       
   298     if ( EProcessResponseTDes == aResponseType && 
       
   299          ECmdGetSupportedBTProfiles != iOutstandingProcessCmdId )
       
   300         {
       
   301     	asyDataSize = aMessage.GetDesLengthL( KAccServParamPosSecond );
       
   302         asyData = HBufC8::NewL( asyDataSize );
       
   303         CleanupStack::PushL( asyData );        
       
   304         }
       
   305 	else if ( EProcessResponseObject == aResponseType )
       
   306 		{
       
   307         objectBuf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
       
   308 	    CleanupStack::PushL( objectBuf );
       
   309 	    TInt bufLength( aMessage.GetDesLength( KAccServParamPosSecond ) );
       
   310 	    objectBuf->ResizeL( bufLength );	      
       
   311 		}
       
   312 	else
       
   313 	   {
       
   314 	   COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - Buffer is not needed!" );
       
   315 	   }
       
   316 		    		    
       
   317     if ( !aTimeOut )
   296     if ( !aTimeOut )
   318         {
   297         {
       
   298        	//
       
   299 	    	// Allocated the buffer which is really needed!
       
   300     		//     
       
   301   	  	if ( EProcessResponseTDes == aResponseType && 
       
   302         	ECmdGetSupportedBTProfiles != iOutstandingProcessCmdId )
       
   303 	        {
       
   304 					COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - Before RMessage with EProcessResponse" );
       
   305 	    		asyDataSize = aMessage.GetDesLengthL( KAccServParamPosSecond );
       
   306 	        asyData = HBufC8::NewL( asyDataSize );
       
   307 	        CleanupStack::PushL( asyData );        
       
   308 					COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - After RMessage with EProcessResponse" );
       
   309 	        }		
       
   310 		  	else if ( EProcessResponseObject == aResponseType )
       
   311 					{
       
   312 					COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - Before RMessage with EProcessResponseObject" );
       
   313 					TInt bufLength = ( aMessage.GetDesLengthL( KAccServParamPosSecond ) );
       
   314 			    objectBuf = CBufFlat::NewL( KAccSrvObjectBaseStreamBufGranularity );
       
   315 				  CleanupStack::PushL( objectBuf );
       
   316 				  objectBuf->ResizeL( bufLength );
       
   317 					COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - After RMessage with EProcessResponseObject" );		
       
   318 					}
       
   319 				else
       
   320 				  {
       
   321 				  COM_TRACE_( "[AccFW:AccServer] CAccSrvSubAsyComms::ProcessResponseL() - Buffer is not needed!" );
       
   322 				  }
       
   323 			
       
   324         	        	
   319         aMessage.ReadL( KAccServParamPosFirst, tridPckgBuf );
   325         aMessage.ReadL( KAccServParamPosFirst, tridPckgBuf );
   320         if ( iOutstandingTrId != tridPckgBuf() )
   326         if ( iOutstandingTrId != tridPckgBuf() )
   321             {
   327             {
   322             // There are no correcponding SetValueL()/GetValueL() pending
   328             // There are no correcponding SetValueL()/GetValueL() pending
   323             User::Leave( KErrNotFound );
   329             User::Leave( KErrNotFound );
   443                                                    errPckgBuf(),
   449                                                    errPckgBuf(),
   444                                                    iOutstandingTrId );
   450                                                    iOutstandingTrId );
   445                     }
   451                     }
   446                 else
   452                 else
   447                     {
   453                     {
   448                     TPtr8 asyDataPtr = asyData->Des();		
   454                     TPtr8 asyDataPtr ( NULL, 0, 0 );                    
       
   455                     if ( NULL != asyData )
       
   456                     	{
       
   457                     	asyDataPtr.Set ( asyData->Des() );
       
   458                     	}
   449                     iConnectionController->NotificationQueue().CompleteValueMessageL(
   459                     iConnectionController->NotificationQueue().CompleteValueMessageL(
   450                                                    messageId,
   460                                                    messageId,
   451                                                    asyDataPtr,
   461                                                    asyDataPtr,
   452                                                    errPckgBuf(),
   462                                                    errPckgBuf(),
   453                                                    iOutstandingTrId );                    
   463                                                    iOutstandingTrId );
   454                     CleanupStack::PopAndDestroy( asyData );                               
   464                     
       
   465                     if ( NULL != asyData )
       
   466                     	{                            
       
   467                     	CleanupStack::PopAndDestroy( asyData );                               
       
   468                     	}	
   455                     }
   469                     }
   456                 break;
   470                 break;
   457             case EProcessResponseObject :
   471             case EProcessResponseObject :
   458                 {
   472                 {                
   459                 TPtr8 objectBufPtr( objectBuf->Ptr(0) );
   473                 TPtr8 objectBufPtr ( NULL, 0, 0 ); 
   460                 iConnectionController->NotificationQueue().CompleteValueMessageL( 
   474                 
   461                                                    messageId,
   475                 if(	NULL != objectBuf )
   462                                                    iOutstandingTrId,
   476                 	{
   463                                                    &objectBufPtr,
   477                 	objectBufPtr.Set ( objectBuf->Ptr(0) );
   464                                                    errPckgBuf() );
   478                 	}	      
   465                 CleanupStack::PopAndDestroy( objectBuf );
   479                 	          
       
   480 	                iConnectionController->NotificationQueue().CompleteValueMessageL( 
       
   481                                    messageId,
       
   482                                    iOutstandingTrId,
       
   483                                    &objectBufPtr,
       
   484                                    errPckgBuf() );                	                	
       
   485 
       
   486                 if( NULL != objectBuf )
       
   487                 	{                                   
       
   488                 	CleanupStack::PopAndDestroy( objectBuf );
       
   489                   }
   466                 }                                                   
   490                 }                                                   
   467             break;
   491             break;
   468                 
   492                 
   469             default:
   493             default:
   470                 {
   494                 {