|
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: Connection Manager |
|
15 * Provides Native to java interface for conection |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "com_nokia_mj_impl_connectionmanager_ConnectionManager.h" |
|
20 #include "connectionmanager.h" |
|
21 #include "javajniutils.h" |
|
22 #include "logger.h" |
|
23 |
|
24 using namespace java::util; |
|
25 |
|
26 |
|
27 |
|
28 //JNIEXPORT jboolean JNICALL |
|
29 //Java_com_nokia_mj_impl_connectionmanager_ConnectionManager__1selectNetworkAccessPoint |
|
30 // (JNIEnv *aJni, jobject /*peer*/, jobjectArray aApn) |
|
31 //{ |
|
32 // LOG(ESOCKET,EInfo,"+ConnectionManagerjni"); |
|
33 // jstring jnistring; |
|
34 // char * apnInfo = new char[256]; |
|
35 // int error = 0; |
|
36 // //jboolean isDeviceDef = ConnectionManager::SelectNetworkAccessPoint(apnInfo, &error); |
|
37 // if(error == KErrNone) |
|
38 // { |
|
39 // LOG1(ESOCKET,EInfo,"+apnInfo = %s",apnInfo); |
|
40 // jnistring = aJni->NewStringUTF(apnInfo); |
|
41 // |
|
42 // aJni->SetObjectArrayElement(aApn,0,jnistring); |
|
43 // aJni->DeleteLocalRef(jnistring); |
|
44 // delete[] apnInfo; |
|
45 // } |
|
46 // else |
|
47 // { |
|
48 // aJni->SetObjectArrayElement(aApn,0,NULL); |
|
49 // delete[] apnInfo; |
|
50 // } |
|
51 // return isDeviceDef; |
|
52 //} |
|
53 |
|
54 JNIEXPORT jstring JNICALL |
|
55 Java_com_nokia_mj_impl_connectionmanager_ConnectionManager__1askNetworkAccessPoint |
|
56 (JNIEnv *aJni, jobject /*peer*/) |
|
57 { |
|
58 char * apnInfo = new char[256]; |
|
59 TRAPD(err,ConnectionManager::PromptUserL(apnInfo)); |
|
60 if (err == KErrNone) |
|
61 { |
|
62 LOG1(ESOCKET,EInfo,"+apnInfo = %s",apnInfo); |
|
63 jstring jnistring = aJni->NewStringUTF(apnInfo); |
|
64 return jnistring; |
|
65 } |
|
66 else |
|
67 { |
|
68 return NULL; |
|
69 } |
|
70 |
|
71 } |
|
72 |
|
73 JNIEXPORT jstring JNICALL |
|
74 Java_com_nokia_mj_impl_connectionmanager_ConnectionManager__1getDeviceDefaultAccessPoint |
|
75 (JNIEnv *aJni, jobject /*peer*/) |
|
76 { |
|
77 char * apnInfo = new char[256]; |
|
78 LOG(ESOCKET,EInfo,"+getDeviceDefaultAccessPoint"); |
|
79 TRAPD(err,ConnectionManager::GetDeviceDefaultAccessPointL(apnInfo)); |
|
80 if (err == KErrNone) |
|
81 { |
|
82 LOG1(ESOCKET,EInfo,"+apnInfo = %s",apnInfo); |
|
83 jstring jnistring = aJni->NewStringUTF(apnInfo); |
|
84 return jnistring; |
|
85 } |
|
86 else |
|
87 { |
|
88 return NULL; |
|
89 } |
|
90 } |