contentcontrolsrv/hsccclient/hsccapiclient/src/hsccapiclient.cpp
branchRCL_3
changeset 16 b276298d5729
parent 11 bd874ee5e5e2
--- a/contentcontrolsrv/hsccclient/hsccapiclient/src/hsccapiclient.cpp	Wed Apr 14 16:16:44 2010 +0300
+++ b/contentcontrolsrv/hsccclient/hsccapiclient/src/hsccapiclient.cpp	Tue Apr 27 16:57:49 2010 +0300
@@ -329,6 +329,64 @@
     }
 
 // -----------------------------------------------------------------------------
+// CHsCcApiClient::ViewListL
+// -----------------------------------------------------------------------------
+//
+TInt CHsCcApiClient::ViewListL( 
+    CHsContentInfo& aInfo, CHsContentInfoArray& aArray )
+    {
+    TInt err( KErrNone );
+    
+    // Create ViewListReq API request
+    CCcSrvMsg* reqMsg = CCcSrvMsg::NewL();
+    CleanupStack::PushL( reqMsg );
+    reqMsg->SetMsgId( EHsCcViewListReq );
+    reqMsg->SetTrId( 0 );
+
+    // Marshal ViewListReq data to a descriptor
+    HBufC8* dataBuf = aInfo.MarshalL();
+    TPtr8 dataPtr( NULL, 0 );
+    dataPtr.Set( dataBuf->Des() );
+    reqMsg->SetData( dataPtr );
+    
+    delete dataBuf;
+    dataBuf = NULL;
+    
+    // Marshal API request
+    HBufC8* msgBuf = reqMsg->MarshalL();
+    CleanupStack::PushL( msgBuf );
+    TPtr8 msgPtr( NULL, 0 );
+    msgPtr.Set( msgBuf->Des() );
+ 
+    // Send API request
+    // Sender and receiver address not defined -> message is routed
+    // according to the provider id
+    TPckgBuf<TUint32> provider( ECcHomescreen );
+    TPckgBuf<TUint32> sender;
+    TPckgBuf<TUint32> receiver;
+    err = iSession.Send( ECcApiReq, provider, sender, receiver, msgPtr );
+    
+    if ( !err )
+        {
+        // Internalize response message
+        TUint32 trId;
+        TUint32 dataSize;
+        err = InternalizeRespL( msgPtr, trId, dataSize );
+        if ( !err && dataSize )
+            {
+            // Internalize API response data
+            err = InternalizeContentInfoArrayL( aArray, trId, dataSize );
+            }
+        }
+
+    // Cleanup
+    CleanupStack::PopAndDestroy( msgBuf );
+    CleanupStack::PopAndDestroy( reqMsg );
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
 // CHsCcApiClient::AppListL
 // -----------------------------------------------------------------------------
 //