installationservices/swcomponentregistry/source/client/scrclient.cpp
changeset 25 98b66e4fb0be
parent 24 84a16765cd86
child 42 d17dc5398051
equal deleted inserted replaced
24:84a16765cd86 25:98b66e4fb0be
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 
    20 
    21 #include "scr.h"
    21 #include "scr.h"
    22 #include "scrclient.inl"
    22 #include "scrclient.inl"
    23 #include "scrcommon.h"
    23 #include "scrcommon.h"
    24 #include "usiflog.h"
    24 #include "usiflog.h"
       
    25 #include "scr_internal.h"
    25 #include <e32cmn.h>
    26 #include <e32cmn.h>
    26 #include <scs/streamingarray.h>
    27 #include <scs/streamingarray.h>
    27 #include <scs/scscommon.h>
    28 #include <scs/scscommon.h>
    28 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    29 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    29 #include "screntries_internal.h"
    30 #include "screntries_internal.h"
   653 	TIpcArgs args(aComponentId);
   654 	TIpcArgs args(aComponentId);
   654 	TInt argNum = 1;
   655 	TInt argNum = 1;
   655 	GetObjectArrayL(*this, EGetComponentSupportedLocalesListSize, EGetComponentSupportedLocalesListData, argNum, args, aMatchingSupportedLanguages);
   656 	GetObjectArrayL(*this, EGetComponentSupportedLocalesListSize, EGetComponentSupportedLocalesListData, argNum, args, aMatchingSupportedLanguages);
   656 	}
   657 	}
   657 
   658 
       
   659 
       
   660 EXPORT_C void RSoftwareComponentRegistry::AddApplicationEntryL(const TComponentId aComponentId, const CApplicationRegistrationData& aApplicationRegistrationData) 
       
   661     {
       
   662     DEBUG_PRINTF2(_L("Sending a request to add an application to be associated with component (%d) from SCR"), aComponentId);
       
   663 
       
   664     if(aApplicationRegistrationData.AppUid() == KNullUid || !((aApplicationRegistrationData.AppFile()).CompareF(KNullDesC())) ) 
       
   665         {
       
   666         DEBUG_PRINTF(_L8("AppUid is zero or the App filename is absent. In either of the above cases values cannot be inserted into the db"));
       
   667         User::Leave(KErrArgument);
       
   668         }    
       
   669     RBuf8 buf;
       
   670     buf.CleanupClosePushL();
       
   671     ExternalizeObjectL(&aApplicationRegistrationData, buf);
       
   672       
       
   673     TIpcArgs args(aComponentId, &buf);
       
   674     User::LeaveIfError(CallSessionFunction(EAddApplicationEntry, args));
       
   675     CleanupStack::PopAndDestroy(&buf);
       
   676     }
       
   677 
       
   678 EXPORT_C void RSoftwareComponentRegistry::DeleteApplicationEntriesL(TComponentId aComponentId) 
       
   679     {
       
   680     TIpcArgs args(aComponentId);
       
   681     DEBUG_PRINTF2(_L("Sending a request to delete the applications associated with component (%d) from SCR"), aComponentId);
       
   682     User::LeaveIfError(CallSessionFunction(EDeleteApplicationEntries, args));
       
   683     }
       
   684 
       
   685 EXPORT_C void RSoftwareComponentRegistry::DeleteApplicationEntryL(TUid aApplicationUid) 
       
   686     {
       
   687     TIpcArgs args(aApplicationUid.iUid);
       
   688     DEBUG_PRINTF2(_L("Sending a request to delete an application 0x%x from SCR" ), aApplicationUid.iUid);
       
   689     User::LeaveIfError(CallSessionFunction(EDeleteApplicationEntry, args));
       
   690     }
       
   691 
       
   692 EXPORT_C TComponentId RSoftwareComponentRegistry::GetComponentIdForAppL(TUid aAppUid) const
       
   693     {
       
   694     DEBUG_PRINTF2(_L("Sending a request to retrieve the component id for AppUid(%d)."), aAppUid);
       
   695     TPckg<TUid> appUidPckg(aAppUid);
       
   696     TComponentId compId;
       
   697     TPckg<TComponentId> compIdPckg(compId);
       
   698     TIpcArgs args(&appUidPckg, &compIdPckg);
       
   699     User::LeaveIfError(CallSessionFunction(EGetComponentIdForApp, args));
       
   700     return compId;
       
   701     }
       
   702 
       
   703 EXPORT_C void RSoftwareComponentRegistry::GetAppUidsForComponentL(TComponentId aCompId, RArray<TUid>& aAppUids) const
       
   704     {
       
   705     DEBUG_PRINTF2(_L("Sending a request to retrieve the list of apps associated with component(%d)."), aCompId);
       
   706     TIpcArgs args(aCompId);
       
   707     TInt argNum = 1; // size descriptor will be added to this slot
       
   708     GetObjectArrayL(*this, EGetAppUidsForComponentSize, EGetAppUidsForComponentData, argNum, args, aAppUids);    
       
   709     }
       
   710 
       
   711 EXPORT_C void RSoftwareComponentRegistry::GetApplicationLaunchersL(RPointerArray<CLauncherExecutable>& aLaunchers) const
       
   712 	{
       
   713     DEBUG_PRINTF(_L("Getting the list of applicaiton launchers."));
       
   714     TIpcArgs args;
       
   715     TInt argNum = 1;
       
   716     GetObjectArrayL(*this, EGetApplicationLaunchersSize, EGetApplicationLaunchersData, argNum, args, aLaunchers);
       
   717 	}
       
   718 
       
   719 /*
       
   720  * RScrInternalClient Implementation.
       
   721  */
       
   722 EXPORT_C RScrInternalClient::RScrInternalClient()
       
   723     :   RScsClientBase()
       
   724     {
       
   725     // empty
       
   726     }
       
   727 
       
   728 EXPORT_C TInt RScrInternalClient::Connect()
       
   729     {
       
   730     DEBUG_PRINTF2(_L("Connecting to %S using the internal client(RScrInternalClient)."), &KSoftwareComponentRegistryName);
       
   731     TVersion version = ScrServerVersion();
       
   732     TUidType scrFullUid = ScrServerImageFullUid();
       
   733     
       
   734     return RScsClientBase::Connect(KSoftwareComponentRegistryName(), version, KScrServerImageName(), scrFullUid);
       
   735     }
       
   736 
       
   737 EXPORT_C void RScrInternalClient::Close()
       
   738     {
       
   739     DEBUG_PRINTF2(_L("Closing connection to %S using the internal client(RScrInternalClient)."), &KSoftwareComponentRegistryName);
       
   740     RScsClientBase::Close();
       
   741     }
       
   742 
       
   743 
       
   744 EXPORT_C TUid RScrInternalClient::GenerateNewAppUidL() const
       
   745     {
       
   746     DEBUG_PRINTF(_L("Sending a request to generate a new Application Uid for non native applications."));
       
   747 
       
   748     TUid newUid = TUid::Null();
       
   749     TPckg<TUid> appUidPckg(newUid);
       
   750     
       
   751     TIpcArgs args(&appUidPckg);
       
   752     User::LeaveIfError(CallSessionFunction(EGenerateNonNativeAppUid, args));
       
   753     return newUid;
       
   754     }
       
   755