javauis/amms_qt/jni/src/prioritycontrol.cpp
author William Roberts <williamr@symbian.org>
Wed, 30 Jun 2010 15:21:28 +0100
changeset 44 0105bdca6f9c
parent 23 98ccebc37403
permissions -rw-r--r--
Apply Pasi Pentikainen change to properties.xml, to fix Bug 3029

/*
* Copyright (c) 2005 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:
*
*/


//#include <jutils.h>

#include "com_nokia_amms_control_PriorityControl.h"
#include <mmafunctionserver.h>
#include "cammsprioritycontrol.h"

/**
 * wrapper for CAMMSPriorityControl::Priority()
 */
static TInt GetPriority(CAMMSPriorityControl* aControl)
{
    return aControl->Priority();
}

/**
 * wrapper for CAMMSPriorityControl::SetPriorityL()
 */
static void SetPriorityL(CAMMSPriorityControl* aControl, TInt aPriority)
{
    aControl->SetPriorityL(aPriority);
}

/*
 * Class:     com_nokia_amms_control_PriorityControl
 * Method:    _getPriority
 *
 */
JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1getPriority(
    JNIEnv*,
    jclass,
    jint aEventSource,
    jint aControl)
{
    MMAFunctionServer* eventSource =
        reinterpret_cast< MMAFunctionServer* >(aEventSource);

    CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
                                        reinterpret_cast< CAMMSControl *>(aControl));

    return eventSource->Execute(GetPriority, control);
}

/*
 * Class:     com_nokia_amms_control_PriorityControl
 * Method:    _setPriority
 *
 */
JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1setPriority(
    JNIEnv*,
    jclass,
    jint aEventSource,
    jint aControl,
    jint aPriority)
{
    MMAFunctionServer* eventSource =
        reinterpret_cast< MMAFunctionServer *>(aEventSource);

    CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
                                        reinterpret_cast< CAMMSControl* >(aControl));

    TInt error = eventSource->ExecuteTrap(
                     &SetPriorityL, control, (TInt) aPriority);

    return error;
}

//  End of File