installationservices/swcomponentregistry/source/client/scrclientsubsessions.cpp
changeset 24 84a16765cd86
child 25 98b66e4fb0be
equal deleted inserted replaced
6:aba6b8104af3 24:84a16765cd86
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Implementation for the subsessions of RSoftwareComponentRegistry. 
       
    16 * See class and function declarations for more detail.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include "scr.h"
       
    22 #include "scrclient.inl"
       
    23 #include "scrcommon.h"
       
    24 #include "usiflog.h"
       
    25 #include <scs/streamingarray.h>
       
    26 
       
    27 using namespace Usif;
       
    28 
       
    29 //
       
    30 // RSoftwareComponentRegistryView
       
    31 //
       
    32 
       
    33 TInt RSoftwareComponentRegistryView::SendSyncMessage(TInt aFunction, const TIpcArgs& aArgs) const
       
    34 	{
       
    35 	return CallSubsessionFunction(aFunction, aArgs);
       
    36 	}
       
    37 
       
    38 EXPORT_C RSoftwareComponentRegistryView::RSoftwareComponentRegistryView()
       
    39 /**
       
    40 	This constructor provides a single point of definition from
       
    41 	which the superclass constructor is called.
       
    42  */
       
    43 	: RScsClientSubsessionBase()
       
    44 	{
       
    45 	// empty
       
    46 	}
       
    47 
       
    48 EXPORT_C void RSoftwareComponentRegistryView::Close()
       
    49 	{
       
    50 	RScsClientSubsessionBase::Close();
       
    51 	}
       
    52 
       
    53 EXPORT_C void RSoftwareComponentRegistryView::OpenViewL(const RSoftwareComponentRegistry& aCompReg, CComponentFilter* aFilter)
       
    54 	{
       
    55 	DEBUG_PRINTF(_L("Creating a subsession to the SCR server for the components view."));
       
    56 	
       
    57 	TInt err = CreateSubsession(aCompReg, ESubSessCreateComponentsView, TIpcArgs());
       
    58 	if(KErrNone != err)
       
    59 		{
       
    60 		DEBUG_PRINTF2(_L("Failed to create the subsession to the SCR server for the components view (Error:%d)"), err);
       
    61 		User::Leave(err);
       
    62 		}
       
    63 	
       
    64 	RBuf8 buf;
       
    65 	buf.CleanupClosePushL();
       
    66 	ExternalizeObjectL(aFilter, buf);
       
    67 	
       
    68 	DEBUG_PRINTF(_L("Sending the request to create a component view on the server side."));
       
    69 	TIpcArgs args(&buf);
       
    70 	User::LeaveIfError(CallSubsessionFunction(EOpenComponentsView, args));
       
    71 	CleanupStack::PopAndDestroy(&buf);
       
    72 	}
       
    73 
       
    74 EXPORT_C CComponentEntry* RSoftwareComponentRegistryView::NextComponentL(TLanguage aLocale) const
       
    75 	{
       
    76 	CComponentEntry* entry = CComponentEntry::NewLC();
       
    77 	if(!NextComponentL(*entry, aLocale))
       
    78 		{
       
    79 		CleanupStack::PopAndDestroy(entry);
       
    80 		return NULL;
       
    81 		}
       
    82 	CleanupStack::Pop(entry);
       
    83 	return entry;
       
    84 	}
       
    85 
       
    86 EXPORT_C TBool RSoftwareComponentRegistryView::NextComponentL(CComponentEntry& aEntry, TLanguage aLocale) const
       
    87 	{
       
    88 	DEBUG_PRINTF(_L("Sending the request to retrieve the next component from the component view."));
       
    89 	TIpcArgs args(aLocale);
       
    90 	TInt argNum = 1;
       
    91 	return GetObjectL(*this, aEntry, EGetNextComponentSize, EGetNextComponentData, argNum, args);
       
    92 	}
       
    93 
       
    94 EXPORT_C void RSoftwareComponentRegistryView::NextComponentSetL(TInt aMaxCount, RPointerArray<CComponentEntry>& aComponentList, TLanguage aLocale) const
       
    95 	{
       
    96 	DEBUG_PRINTF(_L("Sending the request to retrieve the next set of components from the component view."));
       
    97 	TIpcArgs args(aMaxCount, aLocale);
       
    98 	TInt argNum = 2;
       
    99 	GetObjectArrayL(*this, EGetNextComponentSetSize, EGetNextComponentSetData, argNum, args, aComponentList);
       
   100 	}
       
   101 
       
   102 //
       
   103 // RSoftwareComponentRegistryFilesList
       
   104 //
       
   105 
       
   106 TInt RSoftwareComponentRegistryFilesList::SendSyncMessage(TInt aFunction, const TIpcArgs& aArgs) const
       
   107 	{
       
   108 	return CallSubsessionFunction(aFunction, aArgs);
       
   109 	}
       
   110 
       
   111 EXPORT_C RSoftwareComponentRegistryFilesList::RSoftwareComponentRegistryFilesList()
       
   112 /**
       
   113 	This constructor provides a single point of definition from
       
   114 	which the superclass constructor is called.
       
   115  */
       
   116 	: RScsClientSubsessionBase()
       
   117 	{
       
   118 	// empty
       
   119 	}
       
   120 
       
   121 EXPORT_C void RSoftwareComponentRegistryFilesList::OpenListL(const RSoftwareComponentRegistry& aCompReg, TComponentId aComponentId)
       
   122 	{
       
   123 	DEBUG_PRINTF(_L("Creating a subsession to the SCR server for the file list."));
       
   124 		
       
   125 	TInt err = CreateSubsession(aCompReg, ESubSessCreateFileList, TIpcArgs());
       
   126 	if(KErrNone != err)
       
   127 		{
       
   128 		DEBUG_PRINTF2(_L("Failed to create the subsession to the SCR server for the file list (Error:%d)."), err);
       
   129 		User::Leave(err);
       
   130 		}
       
   131 	
       
   132 	DEBUG_PRINTF(_L("Sending a request to create a file list on the server side."));
       
   133 	TIpcArgs args(aComponentId);
       
   134 	User::LeaveIfError(CallSubsessionFunction(EOpenFileList, args));
       
   135 	}
       
   136 
       
   137 EXPORT_C HBufC* RSoftwareComponentRegistryFilesList::NextFileL() const
       
   138 	{
       
   139 	TIpcArgs args(TIpcArgs::ENothing);
       
   140 	TInt argNum = 0;
       
   141 	return GetObjectL<HBufC>(*this, EGetNextFileSize, EGetNextFileData, argNum, args);
       
   142 	}
       
   143 
       
   144 EXPORT_C void RSoftwareComponentRegistryFilesList::NextFileSetL(TInt aMaxCount, RPointerArray<HBufC>& aFileList) const
       
   145 	{
       
   146 	DEBUG_PRINTF(_L("Sending the request to retrieve the next set of components from the component view."));
       
   147 	TIpcArgs args(aMaxCount);
       
   148 	TInt argNum = 1;
       
   149 	GetObjectArrayL(*this, EGetNextFileSetSize, EGetNextFileSetData, argNum, args, aFileList);
       
   150 	}
       
   151 
       
   152 EXPORT_C void RSoftwareComponentRegistryFilesList::Close()
       
   153 	{
       
   154 	RScsClientSubsessionBase::Close();
       
   155 	}