|
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_audio3d_LocationControl.h" |
|
22 #include <mmafunctionserver.h> |
|
23 #include "cammslocationcontrolgroup.h" |
|
24 #include "ammsconstants.h" |
|
25 |
|
26 /** |
|
27 * wrapper for CAMMSLocationControlGroup::Cartesian() |
|
28 */ |
|
29 static void GetCartesianL( |
|
30 CAMMSLocationControlGroup* control, |
|
31 TInt aLocation[ KAMMSVectorComponents ]) |
|
32 { |
|
33 control->CartesianL(aLocation); |
|
34 } |
|
35 |
|
36 /** |
|
37 * wrapper for CAMMSLocationControlGroup::SetCartesianL() |
|
38 */ |
|
39 static void SetCartesianL( |
|
40 CAMMSLocationControlGroup* control, |
|
41 TInt aX, |
|
42 TInt aY, |
|
43 TInt aZ) |
|
44 { |
|
45 control->SetCartesianL(aX, aY, aZ); |
|
46 } |
|
47 |
|
48 /** |
|
49 * wrapper for CAMMSLocationControlGroup::SetSphericalL() |
|
50 */ |
|
51 static void SetSphericalL( |
|
52 CAMMSLocationControlGroup* control, |
|
53 TInt aAzimuth, |
|
54 TInt aElevation, |
|
55 TInt aRadius) |
|
56 { |
|
57 control->SetSphericalL(aAzimuth, aElevation, aRadius); |
|
58 } |
|
59 |
|
60 /* |
|
61 * Class: com_nokia_amms_control_audio3d_LocationControl |
|
62 * Method: _setSpherical |
|
63 * Signature: (IIIII)I |
|
64 */ |
|
65 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1setSpherical( |
|
66 JNIEnv*, |
|
67 jclass, |
|
68 jint aEventSource, |
|
69 jint aControl, |
|
70 jint aAzimuth, |
|
71 jint aElevation, |
|
72 jint aRadius) |
|
73 { |
|
74 MMAFunctionServer* eventSource = |
|
75 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
76 |
|
77 CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>( |
|
78 reinterpret_cast< CAMMSControlGroup* >(aControl)); |
|
79 |
|
80 TInt error; |
|
81 error = eventSource->ExecuteTrap(SetSphericalL, control, |
|
82 aAzimuth, aElevation, aRadius); |
|
83 |
|
84 return error; |
|
85 } |
|
86 |
|
87 /* |
|
88 * Class: com_nokia_amms_control_audio3d_LocationControl |
|
89 * Method: _getCartesian |
|
90 * Signature: (II)LI |
|
91 */ |
|
92 JNIEXPORT jintArray JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1getCartesian( |
|
93 JNIEnv* aJni, |
|
94 jclass, |
|
95 jint aEventSource, |
|
96 jint aControl, |
|
97 jintArray aError) |
|
98 { |
|
99 MMAFunctionServer* eventSource = |
|
100 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
101 |
|
102 CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>( |
|
103 reinterpret_cast< CAMMSControlGroup* >(aControl)); |
|
104 |
|
105 TInt location[ KAMMSVectorComponents ]; |
|
106 TInt error = eventSource->ExecuteTrap(GetCartesianL, |
|
107 control, |
|
108 location); |
|
109 // allocate new array |
|
110 jintArray javaArray = aJni->NewIntArray(KAMMSVectorComponents); |
|
111 if (javaArray) |
|
112 { |
|
113 aJni->SetIntArrayRegion( |
|
114 /*destination*/ javaArray, |
|
115 /*first*/0, |
|
116 /*count*/KAMMSVectorComponents, |
|
117 /*source*/ &location[ 0 ]); |
|
118 } |
|
119 |
|
120 jint javaError[ 1 ] = { error }; |
|
121 aJni->SetIntArrayRegion(aError, 0, 1, javaError); |
|
122 |
|
123 return javaArray; |
|
124 } |
|
125 |
|
126 /* |
|
127 * Class: com_nokia_amms_control_audio3d_LocationControl |
|
128 * Method: _setCartesian |
|
129 * Signature: (IIIII)I |
|
130 */ |
|
131 JNIEXPORT jint JNICALL Java_com_nokia_amms_control_audio3d_LocationControl__1setCartesian( |
|
132 JNIEnv*, |
|
133 jclass, |
|
134 jint aEventSource, |
|
135 jint aControl, |
|
136 jint aX, |
|
137 jint aY, |
|
138 jint aZ) |
|
139 { |
|
140 MMAFunctionServer* eventSource = |
|
141 reinterpret_cast< MMAFunctionServer* >(aEventSource); |
|
142 |
|
143 CAMMSLocationControlGroup* control = static_cast<CAMMSLocationControlGroup*>( |
|
144 reinterpret_cast< CAMMSControlGroup* >(aControl)); |
|
145 |
|
146 TInt error; |
|
147 error = eventSource->ExecuteTrap( |
|
148 SetCartesianL, |
|
149 control, |
|
150 aX, |
|
151 aY, |
|
152 aZ); |
|
153 |
|
154 return error; |
|
155 } |
|
156 |
|
157 |
|
158 // End of File |