|
1 /* |
|
2 * Copyright (c) 2008 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: Common JNI implementations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef LAPIJNICOMMON_H |
|
20 #define LAPIJNICOMMON_H |
|
21 #include <jni.h> |
|
22 #include <e32cmn.h> |
|
23 #include <e32base.h> |
|
24 #include <badesca.h> |
|
25 // EXTERNAL INCLUDES |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CLAPILandmark; |
|
29 class TLocality; |
|
30 |
|
31 /** |
|
32 * Sets an error code to an error array |
|
33 * @param aJniEnv A reference to the JNI environment |
|
34 * @param aTo The array to which the error is to be added |
|
35 * @param aFrom The value which will be added to the array |
|
36 */ |
|
37 void SetJavaErrorCode(JNIEnv& aJniEnv, jintArray aTo, TInt aFrom); |
|
38 |
|
39 /** |
|
40 * Creates a position from the passed coordinate information |
|
41 * @param aJniEnv A reference to the JNI environment |
|
42 * @param aCoordinates Latitude and longitude values |
|
43 * @param aCoordinateInfo Altitude, horizontal accuracy and vertical accurazy |
|
44 */ |
|
45 TLocality CreatePosition(JNIEnv& aJniEnv, jdoubleArray aCoordinates, |
|
46 jfloatArray aCoordinateInfo); |
|
47 |
|
48 /** |
|
49 * Creates a position information from the passed position |
|
50 * @param aJniEnv A reference to the JNI environment |
|
51 * @param aCoordinates Latitude and longitude values |
|
52 * @param aCoordinateInfo Altitude, horizontal accuracy and vertical accurazy |
|
53 */ |
|
54 void CreateCoordinateInfos(JNIEnv& aJniEnv, const TLocality& aPosition, |
|
55 jdoubleArray aCoordinates, jfloatArray aCoordinateInfo); |
|
56 |
|
57 /** |
|
58 * Creates a new native string array from java string array |
|
59 * @param aJniEnv A reference to the JNI environment |
|
60 * @param aJavaArray The Java string array from which the new array is created |
|
61 */ |
|
62 RPointerArray<HBufC> CreateNativeStringArrayL(JNIEnv& aJniEnv, |
|
63 jobjectArray aJavaArray); |
|
64 |
|
65 /** |
|
66 * Creates a new java string array from a native string array |
|
67 * @param aJniEnv A reference to the JNI environment |
|
68 * @param aNativeArray The native string array from which the new array is created |
|
69 */ |
|
70 jobjectArray CreateJavaStringArray(JNIEnv& aJniEnv, |
|
71 RPointerArray<HBufC>& aNativeArray); |
|
72 |
|
73 /** |
|
74 * Creates an item handle array from the paased landmarks |
|
75 * @param aJniEnv A pointer to the JNI environment |
|
76 * @param aLandmarks The landmarks from which the handles are created |
|
77 * @return Java integer array. Ownership is transferred to the caller |
|
78 */ |
|
79 jintArray CreateHandleArray(JNIEnv& aJniEnv, |
|
80 const CArrayPtr<CLAPILandmark>& aLandmarks); |
|
81 |
|
82 jobjectArray CopyToNewJavaStringArrayL(JNIEnv& aJni, |
|
83 const CDesCArray& aNativeArray); |
|
84 |
|
85 #endif // LAPIJNICOMMON_H |
|
86 // End of file |