diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-09-02 12:48:20 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-09-02 12:48:20 -0700 |
commit | 25c9bf2396ceb48fc5cfd5c1dd58aa4d4750d056 (patch) | |
tree | 108948322de11a32b727961e56d3a3e99abaebfd /core | |
parent | ee6d676c5b997a1214e96b6ba3755054382717c5 (diff) | |
download | frameworks_base-25c9bf2396ceb48fc5cfd5c1dd58aa4d4750d056.zip frameworks_base-25c9bf2396ceb48fc5cfd5c1dd58aa4d4750d056.tar.gz frameworks_base-25c9bf2396ceb48fc5cfd5c1dd58aa4d4750d056.tar.bz2 |
Add set/get band in WifiNative
Add support for set and get band and set the default
to 2GHz for now till we get a fix on issues
with 11A
Change-Id: Icb9bddc353e4bf013bdb8a08d9b4ee3451c282f4
Diffstat (limited to 'core')
-rw-r--r-- | core/jni/android_net_wifi_Wifi.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index aec537d..c5ccc43 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -411,6 +411,30 @@ static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz) return (jint)power; } +static jboolean android_net_wifi_setBandCommand(JNIEnv* env, jobject clazz, jint band) +{ + char cmdstr[25]; + + int numWritten = snprintf(cmdstr, sizeof(cmdstr), "DRIVER SETBAND %d", band); + int cmdTooLong = numWritten >= (int)sizeof(cmdstr); + + return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK"); +} + +static jint android_net_wifi_getBandCommand(JNIEnv* env, jobject clazz) +{ + char reply[25]; + int band; + + if (doCommand("DRIVER GETBAND", reply, sizeof(reply)) != 0) { + return (jint)-1; + } + // reply comes back in the form "Band X" where X is the + // number we're interested in. + sscanf(reply, "%*s %u", &band); + return (jint)band; +} + static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels) { char cmdstr[256]; @@ -561,6 +585,8 @@ static JNINativeMethod gWifiMethods[] = { { "stopPacketFiltering", "()Z", (void*) android_net_wifi_stopPacketFiltering }, { "setPowerModeCommand", "(I)Z", (void*) android_net_wifi_setPowerModeCommand }, { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand }, + { "setBandCommand", "(I)Z", (void*) android_net_wifi_setBandCommand}, + { "getBandCommand", "()I", (void*) android_net_wifi_getBandCommand}, { "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand }, { "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand }, { "setBluetoothCoexistenceModeCommand", "(I)Z", |