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