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