javauis/amms_qt/jni/src/prioritycontrol.cpp
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2005 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 "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 *
       
    16 */
       
    17 
       
    18 
       
    19 //#include <jutils.h>
       
    20 
       
    21 #include "com_nokia_amms_control_PriorityControl.h"
       
    22 #include <mmafunctionserver.h>
       
    23 #include "cammsprioritycontrol.h"
       
    24 
       
    25 /**
       
    26  * wrapper for CAMMSPriorityControl::Priority()
       
    27  */
       
    28 static TInt GetPriority(CAMMSPriorityControl* aControl)
       
    29 {
       
    30     return aControl->Priority();
       
    31 }
       
    32 
       
    33 /**
       
    34  * wrapper for CAMMSPriorityControl::SetPriorityL()
       
    35  */
       
    36 static void SetPriorityL(CAMMSPriorityControl* aControl, TInt aPriority)
       
    37 {
       
    38     aControl->SetPriorityL(aPriority);
       
    39 }
       
    40 
       
    41 /*
       
    42  * Class:     com_nokia_amms_control_PriorityControl
       
    43  * Method:    _getPriority
       
    44  *
       
    45  */
       
    46 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1getPriority(
       
    47     JNIEnv*,
       
    48     jclass,
       
    49     jint aEventSource,
       
    50     jint aControl)
       
    51 {
       
    52     MMAFunctionServer* eventSource =
       
    53         reinterpret_cast< MMAFunctionServer* >(aEventSource);
       
    54 
       
    55     CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
       
    56                                         reinterpret_cast< CAMMSControl *>(aControl));
       
    57 
       
    58     return eventSource->Execute(GetPriority, control);
       
    59 }
       
    60 
       
    61 /*
       
    62  * Class:     com_nokia_amms_control_PriorityControl
       
    63  * Method:    _setPriority
       
    64  *
       
    65  */
       
    66 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PriorityControl__1setPriority(
       
    67     JNIEnv*,
       
    68     jclass,
       
    69     jint aEventSource,
       
    70     jint aControl,
       
    71     jint aPriority)
       
    72 {
       
    73     MMAFunctionServer* eventSource =
       
    74         reinterpret_cast< MMAFunctionServer *>(aEventSource);
       
    75 
       
    76     CAMMSPriorityControl* control = static_cast< CAMMSPriorityControl* >(
       
    77                                         reinterpret_cast< CAMMSControl* >(aControl));
       
    78 
       
    79     TInt error = eventSource->ExecuteTrap(
       
    80                      &SetPriorityL, control, (TInt) aPriority);
       
    81 
       
    82     return error;
       
    83 }
       
    84 
       
    85 //  End of File