diff options
author | repo sync <isheriff@google.com> | 2011-06-24 14:23:07 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2011-07-24 10:08:47 -0700 |
commit | 55bc5f3e0408bcb5a39a6732de0b2d1aa99a55be (patch) | |
tree | 1206af1015ea8248a8fefbf2672d8df7bfa56bc8 /core/jni/android_net_wifi_Wifi.cpp | |
parent | 895de9269fa125bf3903c21faf5e8d2750bfb000 (diff) | |
download | frameworks_base-55bc5f3e0408bcb5a39a6732de0b2d1aa99a55be.zip frameworks_base-55bc5f3e0408bcb5a39a6732de0b2d1aa99a55be.tar.gz frameworks_base-55bc5f3e0408bcb5a39a6732de0b2d1aa99a55be.tar.bz2 |
Updated: Wi-Fi p2p framework
First stage. Get the bones in right now even though
we are not ready on the native side.
Once, we have things underneath working - we will further update the
framework
Change-Id: I4a7dab5cd4267373dc5f8989ae4122f91c384ed5
Diffstat (limited to 'core/jni/android_net_wifi_Wifi.cpp')
-rw-r--r-- | core/jni/android_net_wifi_Wifi.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index 0c81634..3cbd912 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -28,6 +28,9 @@ #define WIFI_PKG_NAME "android/net/wifi/WifiNative" #define BUF_SIZE 256 +//TODO: This file can be refactored to push a lot of the functionality to java +//with just a few JNI calls - doBoolean/doInt/doString + namespace android { static jboolean sScanModeActive = false; @@ -537,6 +540,35 @@ static void android_net_wifi_setScanIntervalCommand(JNIEnv* env, jobject, jint s } +static jboolean android_net_wifi_doBooleanCommand(JNIEnv* env, jobject, jstring javaCommand) +{ + ScopedUtfChars command(env, javaCommand); + if (command.c_str() == NULL) { + return JNI_FALSE; + } + return doBooleanCommand("OK", "%s", command.c_str()); +} + +static jint android_net_wifi_doIntCommand(JNIEnv* env, jobject, jstring javaCommand) +{ + ScopedUtfChars command(env, javaCommand); + if (command.c_str() == NULL) { + return -1; + } + return doIntCommand("%s", command.c_str()); +} + +static jstring android_net_wifi_doStringCommand(JNIEnv* env, jobject, jstring javaCommand) +{ + ScopedUtfChars command(env, javaCommand); + if (command.c_str() == NULL) { + return NULL; + } + return doStringCommand(env, "%s", command.c_str()); +} + + + // ---------------------------------------------------------------------------- /* @@ -608,6 +640,9 @@ static JNINativeMethod gWifiMethods[] = { (void*) android_net_wifi_setCountryCodeCommand}, { "enableBackgroundScanCommand", "(Z)V", (void*) android_net_wifi_enableBackgroundScanCommand}, { "setScanIntervalCommand", "(I)V", (void*) android_net_wifi_setScanIntervalCommand}, + { "doBooleanCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_doBooleanCommand}, + { "doIntCommand", "(Ljava/lang/String;)I", (void*) android_net_wifi_doIntCommand}, + { "doStringCommand", "(Ljava/lang/String;)Ljava/lang/String;", (void*) android_net_wifi_doStringCommand}, }; int register_android_net_wifi_WifiManager(JNIEnv* env) |