tags:

views:

82

answers:

1

I can scan and get the Wifi list in iPhoneOS4.0.

At this time, I neet to determine security types of each Wifi access point. How can I do that using the value of "CAPABILITIES" key of scanned result's NSDicionary? Which one is one of NONE, WPA, WPA2, WEP? The value of CAPABILITIES is 1057, 1025,34,33,2,1073,1041 and 3121, etc... It is too various. I don't know what it represents. I am using "WEP" and "WPA_IE" key to obtain Boolean for NSDictionary, but It is not enough.

Anyone know how to do?

+1  A: 

I have found out the solution. Have a look the below. You can do more details using the wep, wpa, rsn. Thanks.

int adhoc = [network objectForKey:@"AP_MODE"];
if (adhoc == 1) {
    ret =@"AdHoc network";
} else {
    id wep = [network objectForKey:@"WEP"];
    id wpa = [network objectForKey:@"WPA_IE"];
    id rsn = [network objectForKey:@"RSN_IE"];

    if(wep) {
        ret =@"Secured network (WEP)";
    } else if (wpa && rsn) {
        ret =@"Secured network (WPA, WPA2)";
    } else if (wpa) {
        ret =@"Secured network (WPA)";
    } else if (rsn) {
        ret =@"Secured network (WPA2)";
    } else {
        ret =@"Open Network";
    }
}
mooongcle