javauis/amms_akn/src_tuner/native/src/protocol.cpp
branchRCL_3
changeset 83 26b2b12093af
parent 19 04becd199f91
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
       
     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:  Protocol JNI wrapper.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // EXTERNAL INCLUDES
       
    20 #include <jutils.h>
       
    21 #include <jdebug.h>
       
    22 
       
    23 // INTERNAL INCLUDES
       
    24 #include "com_nokia_microedition_media_protocol_capture_radio_Protocol.h"
       
    25 #include <CMMAEventSource.h>
       
    26 #include "CAMMSTunerControl.h"
       
    27 #include "CAMMSTunerPlayer.h"
       
    28 #include "AMMSTunerFactory.h"
       
    29 
       
    30 // Creates native tuner player
       
    31 JNIEXPORT jint JNICALL
       
    32 Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer(
       
    33     JNIEnv* aJniEnv,
       
    34     jobject /*aPeer*/,
       
    35     jint aEventSourceHandle,
       
    36     jstring aLocatorParameters)
       
    37 {
       
    38     DEBUG("AMMS Java_com_nokia_microedition_media_protocol_capture_radio_Protocol__1createNativeTunerPlayer +");
       
    39     CMMAEventSource* eventSource = JavaUnhand< CMMAEventSource >(
       
    40                                        aEventSourceHandle);
       
    41 
       
    42     RJString locatorParams(*aJniEnv, aLocatorParameters);
       
    43 
       
    44     CAMMSTunerPlayer* tunerPlayer = NULL;
       
    45 
       
    46     TInt error = eventSource->ExecuteTrap(
       
    47                      &AMMSTunerFactory::CreatePlayerL,
       
    48                      &tunerPlayer,
       
    49                      (const TDesC*)&locatorParams);
       
    50 
       
    51     DEBUG_INT("AMMS __1createNativeTunerPlayer, error = %d", error);
       
    52 
       
    53     if (error != KErrNone)
       
    54     {
       
    55         return error;
       
    56     }
       
    57 
       
    58     return JavaMakeHandle(tunerPlayer);
       
    59 }
       
    60