javauis/mmapi_qt/baseline/src/volumecontrol.cpp
changeset 23 98ccebc37403
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  This class has JNI wrappers for CMMAVolumeControl
       
    15 *
       
    16 */
       
    17 
       
    18 //#include <jutils.h>
       
    19 //#include "mmapiutils.h"
       
    20 
       
    21 #include "com_nokia_microedition_media_control_VolumeControl.h"
       
    22 #include "mmafunctionserver.h"
       
    23 #include "cmmavolumecontrol.h"
       
    24 
       
    25 
       
    26 /*
       
    27  * Class:     com_nokia_microedition_media_control_VolumeControl
       
    28  * Method:    _setLevel
       
    29  * Signature: (III)I
       
    30  */
       
    31 
       
    32 JNIEXPORT int JNICALL Java_com_nokia_microedition_media_control_VolumeControl__1setLevel
       
    33 (JNIEnv *, jclass , jint aEventSource, jint aVolumeControl, jint aLevel)
       
    34 {
       
    35     MMAFunctionServer* eventSource =
       
    36         reinterpret_cast< MMAFunctionServer* >(aEventSource);
       
    37 
       
    38     CMMAVolumeControl* volumeControl =
       
    39         reinterpret_cast< CMMAVolumeControl* >(aVolumeControl);
       
    40 
       
    41     TInt error = eventSource->ExecuteTrap(&CMMAVolumeControl::StaticSetLevelL,
       
    42                                           volumeControl,
       
    43                                           aLevel);
       
    44     return error;
       
    45 }
       
    46 
       
    47 /*
       
    48  * Class:     com_nokia_microedition_media_control_VolumeControl
       
    49  * Method:    _getLevel
       
    50  * Signature: (II)I
       
    51  */
       
    52 
       
    53 JNIEXPORT int JNICALL Java_com_nokia_microedition_media_control_VolumeControl__1getLevel
       
    54 (JNIEnv *, jclass , jint aEventSource, jint aVolumeControl)
       
    55 {
       
    56     MMAFunctionServer* eventSource =
       
    57         reinterpret_cast< MMAFunctionServer* >(aEventSource);
       
    58 
       
    59     CMMAVolumeControl* volumeControl =
       
    60         reinterpret_cast< CMMAVolumeControl* >(aVolumeControl);
       
    61 
       
    62     TInt level(0);
       
    63     TInt error = eventSource->ExecuteTrap(&CMMAVolumeControl::StaticGetLevelL,
       
    64                                           volumeControl, &level);
       
    65     if (error == KErrNone)
       
    66     {
       
    67         return level;
       
    68     }
       
    69     return error;
       
    70 }
       
    71 
       
    72 //  END OF FILE