diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-12-08 11:27:37 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-12-13 14:50:51 -0800 |
commit | 02fb46a297c4f645f2a30b574151401dd0978521 (patch) | |
tree | 9dff4f3b0a188161fcfb0017ea9d86a5fc065189 /core/jni/android_net_wifi_Wifi.cpp | |
parent | ffdd591a829af7fddd36a7b80d2a3b8188c871a6 (diff) | |
download | frameworks_base-02fb46a297c4f645f2a30b574151401dd0978521.zip frameworks_base-02fb46a297c4f645f2a30b574151401dd0978521.tar.gz frameworks_base-02fb46a297c4f645f2a30b574151401dd0978521.tar.bz2 |
WPS fixes and refactor
- Allow IP and proxy set up for WPS
- Use string for WPS pin to avoid losing leading zeros
- Add a seperate WPS state machine and WpsConfiguration class
Change-Id: I87f43fff8bba0ae8ff02e5fc495a8bc628a8c8cf
Diffstat (limited to 'core/jni/android_net_wifi_Wifi.cpp')
-rw-r--r-- | core/jni/android_net_wifi_Wifi.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index 0663e98..6737501 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -173,14 +173,17 @@ static jboolean android_net_wifi_wpsPbcCommand(JNIEnv* env, jobject clazz, jstri return doBooleanCommand(cmdstr, "OK"); } -static jboolean android_net_wifi_wpsPinFromAccessPointCommand(JNIEnv* env, jobject clazz, jstring bssid, int apPin) +static jboolean android_net_wifi_wpsPinFromAccessPointCommand(JNIEnv* env, jobject clazz, + jstring bssid, jstring apPin) { char cmdstr[BUF_SIZE]; jboolean isCopy; const char *bssidStr = env->GetStringUTFChars(bssid, &isCopy); - int numWritten = snprintf(cmdstr, sizeof(cmdstr), "WPS_REG %s %d", bssidStr, apPin); + const char *apPinStr = env->GetStringUTFChars(apPin, &isCopy); + int numWritten = snprintf(cmdstr, sizeof(cmdstr), "WPS_REG %s %s", bssidStr, apPinStr); env->ReleaseStringUTFChars(bssid, bssidStr); + env->ReleaseStringUTFChars(apPin, apPinStr); if ((numWritten == -1) || (numWritten >= (int)sizeof(cmdstr))) { return false; @@ -188,7 +191,7 @@ static jboolean android_net_wifi_wpsPinFromAccessPointCommand(JNIEnv* env, jobje return doBooleanCommand(cmdstr, "OK"); } -static jint android_net_wifi_wpsPinFromDeviceCommand(JNIEnv* env, jobject clazz, jstring bssid) +static jstring android_net_wifi_wpsPinFromDeviceCommand(JNIEnv* env, jobject clazz, jstring bssid) { char cmdstr[BUF_SIZE]; jboolean isCopy; @@ -198,9 +201,9 @@ static jint android_net_wifi_wpsPinFromDeviceCommand(JNIEnv* env, jobject clazz, env->ReleaseStringUTFChars(bssid, bssidStr); if ((numWritten == -1) || (numWritten >= (int)sizeof(cmdstr))) { - return -1; + return NULL; } - return doIntCommand(cmdstr); + return doStringCommand(env, cmdstr); } static jboolean android_net_wifi_setCountryCodeCommand(JNIEnv* env, jobject clazz, jstring country) @@ -648,9 +651,9 @@ static JNINativeMethod gWifiMethods[] = { { "addToBlacklistCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_addToBlacklistCommand }, { "clearBlacklistCommand", "()Z", (void*) android_net_wifi_clearBlacklistCommand }, { "startWpsPbcCommand", "(Ljava/lang/String;)Z", (void*) android_net_wifi_wpsPbcCommand }, - { "startWpsWithPinFromAccessPointCommand", "(Ljava/lang/String;I)Z", + { "startWpsWithPinFromAccessPointCommand", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*) android_net_wifi_wpsPinFromAccessPointCommand }, - { "startWpsWithPinFromDeviceCommand", "(Ljava/lang/String;)I", + { "startWpsWithPinFromDeviceCommand", "(Ljava/lang/String;)Ljava/lang/String;", (void*) android_net_wifi_wpsPinFromDeviceCommand }, { "setSuspendOptimizationsCommand", "(Z)Z", (void*) android_net_wifi_setSuspendOptimizationsCommand}, |