contentcontrolsrv/hsccclient/hsccapiclient/src/hsccapiclient.cpp
branchRCL_3
changeset 64 b276298d5729
parent 18 bd874ee5e5e2
equal deleted inserted replaced
59:a0713522ab97 64:b276298d5729
   327 
   327 
   328     return err;
   328     return err;
   329     }
   329     }
   330 
   330 
   331 // -----------------------------------------------------------------------------
   331 // -----------------------------------------------------------------------------
       
   332 // CHsCcApiClient::ViewListL
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 TInt CHsCcApiClient::ViewListL( 
       
   336     CHsContentInfo& aInfo, CHsContentInfoArray& aArray )
       
   337     {
       
   338     TInt err( KErrNone );
       
   339     
       
   340     // Create ViewListReq API request
       
   341     CCcSrvMsg* reqMsg = CCcSrvMsg::NewL();
       
   342     CleanupStack::PushL( reqMsg );
       
   343     reqMsg->SetMsgId( EHsCcViewListReq );
       
   344     reqMsg->SetTrId( 0 );
       
   345 
       
   346     // Marshal ViewListReq data to a descriptor
       
   347     HBufC8* dataBuf = aInfo.MarshalL();
       
   348     TPtr8 dataPtr( NULL, 0 );
       
   349     dataPtr.Set( dataBuf->Des() );
       
   350     reqMsg->SetData( dataPtr );
       
   351     
       
   352     delete dataBuf;
       
   353     dataBuf = NULL;
       
   354     
       
   355     // Marshal API request
       
   356     HBufC8* msgBuf = reqMsg->MarshalL();
       
   357     CleanupStack::PushL( msgBuf );
       
   358     TPtr8 msgPtr( NULL, 0 );
       
   359     msgPtr.Set( msgBuf->Des() );
       
   360  
       
   361     // Send API request
       
   362     // Sender and receiver address not defined -> message is routed
       
   363     // according to the provider id
       
   364     TPckgBuf<TUint32> provider( ECcHomescreen );
       
   365     TPckgBuf<TUint32> sender;
       
   366     TPckgBuf<TUint32> receiver;
       
   367     err = iSession.Send( ECcApiReq, provider, sender, receiver, msgPtr );
       
   368     
       
   369     if ( !err )
       
   370         {
       
   371         // Internalize response message
       
   372         TUint32 trId;
       
   373         TUint32 dataSize;
       
   374         err = InternalizeRespL( msgPtr, trId, dataSize );
       
   375         if ( !err && dataSize )
       
   376             {
       
   377             // Internalize API response data
       
   378             err = InternalizeContentInfoArrayL( aArray, trId, dataSize );
       
   379             }
       
   380         }
       
   381 
       
   382     // Cleanup
       
   383     CleanupStack::PopAndDestroy( msgBuf );
       
   384     CleanupStack::PopAndDestroy( reqMsg );
       
   385 
       
   386     return err;
       
   387     }
       
   388 
       
   389 // -----------------------------------------------------------------------------
   332 // CHsCcApiClient::AppListL
   390 // CHsCcApiClient::AppListL
   333 // -----------------------------------------------------------------------------
   391 // -----------------------------------------------------------------------------
   334 //
   392 //
   335 TInt CHsCcApiClient::AppListL( CHsContentInfoArray& aArray )
   393 TInt CHsCcApiClient::AppListL( CHsContentInfoArray& aArray )
   336     {
   394     {