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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 //#include <jutils.h> |
|
20 |
|
21 #include "com_nokia_amms_control_PanControl.h" |
|
22 #include <mmafunctionserver.h> |
|
23 #include "cammspancontrolgroup.h" |
|
24 |
|
25 /** |
|
26 * wrapper for CAMMSPanControlGroup::Pan() |
|
27 */ |
|
28 static TInt GetPan(CAMMSPanControlGroup* aControl) |
|
29 { |
|
30 return aControl->Pan(); |
|
31 } |
|
32 |
|
33 /** |
|
34 * wrapper for CAMMSPanControlGroup::SetPanL() |
|
35 */ |
|
36 static void SetPanL(CAMMSPanControlGroup* aControl, TInt aPan, TInt *aReturnedPan) |
|
37 { |
|
38 aControl->SetPanL(aPan, *aReturnedPan); |
|
39 } |
|
40 |
|
41 /* |
|
42 * Class: com_nokia_amms_control_PanControl |
|
43 * Method: _getPan |
|
44 * |
|
45 */ |
|
46 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PanControl__1getPan( |
|
47 JNIEnv*, |
|
48 jclass, |
|
49 jint aEventSource, |
|
50 jint aControl) |
|
51 { |
|
52 MMAFunctionServer* eventSource = |
|
53 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
54 |
|
55 CAMMSPanControlGroup* control = static_cast< CAMMSPanControlGroup* >( |
|
56 reinterpret_cast< CAMMSControlGroup* >(aControl)); |
|
57 |
|
58 return eventSource->Execute(GetPan, control); |
|
59 } |
|
60 |
|
61 /* |
|
62 * Class: com_nokia_amms_control_PanControl |
|
63 * Method: _setPan |
|
64 * |
|
65 */ |
|
66 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_PanControl__1setPan( |
|
67 JNIEnv* aJniEnv, |
|
68 jclass, |
|
69 jint aEventSource, |
|
70 jint aControl, |
|
71 jint aPan, |
|
72 jintArray aError) |
|
73 { |
|
74 MMAFunctionServer* eventSource = |
|
75 reinterpret_cast< MMAFunctionServer *>(aEventSource); |
|
76 |
|
77 CAMMSPanControlGroup* control = static_cast< CAMMSPanControlGroup* >( |
|
78 reinterpret_cast< CAMMSControlGroup *>(aControl)); |
|
79 |
|
80 TInt error; |
|
81 TInt aReturnedPan; |
|
82 error = eventSource->ExecuteTrap(SetPanL, control, (TInt) aPan, &aReturnedPan); |
|
83 |
|
84 // the returned pan value is between -100 and 100 (and the error code as well) |
|
85 jint javaError[ 1 ] = { error }; |
|
86 aJniEnv->SetIntArrayRegion(aError, 0, 1, javaError); |
|
87 return aReturnedPan; |
|
88 } |
|
89 |
|
90 |
|
91 // End of File |
|