|
1 /* |
|
2 * Copyright (c) 2005-2007 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: JNI file for ControlContainer |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <jutils.h> |
|
20 #include <jdebug.h> |
|
21 |
|
22 #include "com_nokia_amms_ControlContainer.h" |
|
23 |
|
24 #include "cammscontrolgroup.h" |
|
25 #include "cammsmodule.h" |
|
26 |
|
27 /** |
|
28 * JNI function. |
|
29 */ |
|
30 JNIEXPORT jstring JNICALL Java_com_nokia_amms_ControlContainer__1getControlClassName |
|
31 (JNIEnv* aJniEnv, |
|
32 jclass, |
|
33 jint /*aEventSourceHandle*/, |
|
34 jint aNativeHandle) |
|
35 { |
|
36 CAMMSControlGroup* controlGroup = |
|
37 JavaUnhand< CAMMSControlGroup >(aNativeHandle); |
|
38 |
|
39 DEBUG_STR("AMMS::ControlContainer.cpp::getControlClassName name = %S", |
|
40 controlGroup->ClassName()); |
|
41 |
|
42 return CreateJavaString(*aJniEnv, controlGroup->ClassName()); |
|
43 } |
|
44 |
|
45 /** |
|
46 * JNI function. |
|
47 */ |
|
48 JNIEXPORT jint JNICALL Java_com_nokia_amms_ControlContainer__1getControlsCount |
|
49 (JNIEnv*, |
|
50 jclass, |
|
51 jint /*aEventSourceHandle*/, |
|
52 jint aNativeHandle) |
|
53 { |
|
54 CAMMSModule* module = JavaUnhand< CAMMSModule >(aNativeHandle); |
|
55 |
|
56 DEBUG_INT("AMMS::ControlContainer.cpp::getControlsCount count = %d", |
|
57 module->Count()); |
|
58 return module->Count(); |
|
59 } |
|
60 |
|
61 /** |
|
62 * JNI function. |
|
63 */ |
|
64 JNIEXPORT jint JNICALL Java_com_nokia_amms_ControlContainer__1getControlHandle |
|
65 (JNIEnv*, |
|
66 jclass, |
|
67 jint /*aEventSourceHandle*/, |
|
68 jint aNativeHandle, |
|
69 jint aIndex) |
|
70 { |
|
71 DEBUG_INT("AMMS::ControlContainer.cpp::getControlHandle index = %d", |
|
72 aIndex); |
|
73 CAMMSModule* module = JavaUnhand< CAMMSModule >(aNativeHandle); |
|
74 |
|
75 // Java handles must be created from CBase derived classes. |
|
76 // Casting here is safe because all groups in the modules are derived from |
|
77 // CAMMSControlGroup. |
|
78 CAMMSControlGroup* group = static_cast< CAMMSControlGroup* >( |
|
79 module->At(aIndex)); // CSI: 1 Wrong index means implementation error # |
|
80 |
|
81 return JavaMakeHandle(group); |
|
82 } |
|
83 |
|
84 // End of File |
|
85 |
|
86 |
|
87 |