javamanager/debugapi/src.s60/debugapiimpl.cpp
author hgs
Fri, 15 Oct 2010 12:29:39 +0300
changeset 80 d6dafc5d983f
parent 21 2a9601315dfc
permissions -rw-r--r--
v2.2.19_1

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: DebugApiImpl provides implementation for Degug API methods
*
*/


#include "debugapiimpl.h"

#include "applauncher.h"
#include "appinstaller.h"
#include "appremover.h"

#include "logger.h"
#include "javauid.h"
#include "javaprocessconstants.h"
#include "javasymbianoslayer.h"

using namespace java::debug;
using namespace java::util;


DebugApiImpl::DebugApiImpl()
{
}

DebugApiImpl::~DebugApiImpl()
{
}

int DebugApiImpl::installApp(const std::wstring& aFilename,
                             Uid& aSuiteUid,
                             std::list<Uid>& aAppUids)
{
    JELOG2(EDebugApi);

    AppInstaller installer(aFilename);
    int rc = installer.install();

    if (!rc)
    {
        aSuiteUid = installer.getSuiteUid();
        aAppUids = installer.getAppUids();
    }

    return rc;
}

int DebugApiImpl::uninstallApp(const Uid& aSuiteUid)
{
    JELOG2(EDebugApi);

    AppRemover installer(aSuiteUid);
    int rc = installer.uninstall();

    return rc;
}

int DebugApiImpl::startApp(const Uid& aAppUid, const std::wstring& aUeiParameters, pid_t& aPid)
{
    JELOG2(EDebugApi);

    AppLauncher launcher(aAppUid);
    int rc = launcher.startApp(aUeiParameters);
    aPid = launcher.getPid();
    return rc;
}

int DebugApiImpl::stopApp(const Uid& aAppUid)
{
    JELOG2(EDebugApi);
    AppLauncher launcher(aAppUid);
    return launcher.stopApp();
}