javauis/mmapi_qt/baseline/src/stoptimecontrol.cpp
branchRCL_3
changeset 24 0fd27995241b
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     1 /*
       
     2 * Copyright (c) 2002 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 CMMAStopTimeControl
       
    15 *
       
    16 */
       
    17 
       
    18 //#include <jutils.h>
       
    19 //#include "mmapiutils.h"
       
    20 #include "com_nokia_microedition_media_control_StopTimeControl.h"
       
    21 #include "mmafunctionserver.h"
       
    22 #include "cmmastoptimecontrol.h"
       
    23 
       
    24 
       
    25 JNIEXPORT jlong JNICALL Java_com_nokia_microedition_media_control_StopTimeControl__1getStopTime
       
    26 (JNIEnv *, jclass , jint aEventSource, jint aControl)
       
    27 {
       
    28     MMAFunctionServer* eventSource =
       
    29         reinterpret_cast< MMAFunctionServer* >(aEventSource);
       
    30 
       
    31     CMMAStopTimeControl* control =
       
    32         reinterpret_cast< CMMAStopTimeControl* >(aControl);
       
    33 
       
    34     TInt64 time(0);
       
    35     eventSource->ExecuteV(CMMAStopTimeControl::StaticGetStopTime,
       
    36                           control,
       
    37                           &time);
       
    38 
       
    39     return *reinterpret_cast< jlong* >(&time);
       
    40 }
       
    41 
       
    42 
       
    43 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_StopTimeControl__1setStopTime
       
    44 (JNIEnv *, jclass , jint aEventSource, jint aControl, jlong aTime)
       
    45 {
       
    46     MMAFunctionServer* eventSource =
       
    47         reinterpret_cast< MMAFunctionServer* >(aEventSource);
       
    48 
       
    49     CMMAStopTimeControl* control =
       
    50         reinterpret_cast< CMMAStopTimeControl* >(aControl);
       
    51 
       
    52     TInt64 time;
       
    53     time = *((TInt64*)&aTime);     // convert 'long long' to TInt64
       
    54 
       
    55     TInt err = eventSource->ExecuteTrap(CMMAStopTimeControl::StaticSetStopTimeL,
       
    56                                         control,
       
    57                                         &time);
       
    58 
       
    59     return err;
       
    60 }
       
    61 
       
    62 //  END OF FILE