在ios掃瞄公共區域內wifi資訊中,寫了實現wifi掃瞄的一種方法,但是那種方法掃瞄出來的wifi資訊不全,下面是掃瞄全部wifi資訊的實現方法:
#import
#import
#import
#include
#include
#include
@inte***ce
msnetworksmanager : nsobject
+ (msnetworksmanager
*)sharednetworksmanager;
+ (nsnumber
*)numberfrombssid:(
nsstring
*) bssid;
- (nsmutabledictionary
*)networks;
- (nsdictionary
*)networks:(
int) type;
- (nsdictionary
*)network:(
nsstring
*) anetwork;
- (id
)init;
- (void
)dealloc;
- (int
)numberofnetworks;
- (int
)numberofnetworks:(
int) type;
- (int
)autoscaninterval;
- (void
)scan;
- (void
)removenetwork:(
nsstring
*)anetwork;
- (void
)removeallnetworks;
- (void
)removeallnetworks:(
int) type;
- (void
)autoscan:(
bool
)scan;
- (bool
)autoscan;
- (void
)scanselector:(
id)param;
- (void
)setautoscaninterval:(
int) scaninterval;
- (int
)associatenetwork: (
nsdictionary
*)bss: (
nsstring
*)password;
- (int
)getpower: (
char
char
*)power;
- (int
)setpower: (
char
char
*)power;
- (nsstring
*) localipaddress;
@end
.m檔案:
#import "msnetworksmanager.h"
static
msnetworksmanager
*networksmanager;
@implementation
msnetworksmanager
+ (msnetworksmanager
*)sharednetworksmanager
+ (nsnumber
*)numberfrombssid:(
nsstring
*) bssid
else
free(bs_in);
return
[nsnumber
numberwithunsignedlonglong
:longmac];
} - (nsdictionary
*)networks
- (nsdictionary
*)networks:(
int) type
- (nsdictionary
*)network:(
nsstring
*) anetwork
- (id
)init
- (void
)dealloc
- (int
)numberofnetworks
- (int
)numberofnetworks:(
int) type
- (int
)autoscaninterval
- (void
)scan
nslog(@"scan finished…"
);
} - (void
)removenetwork:(
nsstring
*)anetwork
- (void
)removeallnetworks
- (void
)removeallnetworks:(
int) type
- (void
)autoscan:(
bool
) bscan
nslog(@"warn: automatic scanning not fully supported yet. %@"
,self
);
} - (bool
)autoscan
- (void
)scanselector:(
id)param
} - (void
)setautoscaninterval:(
int) scaninterval
- (int
)associatenetwork:(
nsdictionary
*)bss: (
nsstring
*)password
else
return-1
;
} - (int
)getpower: (
char
char
*)power
- (int
)setpower: (
char
char
*)power
- (nsstring
*) localipaddress
}
temp_addr = temp_addr->ifa_next;
}
}
// free memory
freeifaddrs(inte***ces);
return
address;
} @end
新增到專案中即可。
區域內點的個數
problem description x晚上睡不著的時候不喜歡玩手機,也不喜歡打遊戲,他喜歡數星星。input 多組輸入。每組先輸入乙個整數n n 10000 接著輸入兩個點代表矩形的左下點b x,y 和右上點t x,y 然後輸入n個 x,y 代表 顆星星。問有多少顆星星在窗子內部,在窗邊上的不計...
區域內點的個數
problem description x晚上睡不著的時候不喜歡玩手機,也不喜歡打遊戲,他喜歡數星星。input 多組輸入。每組先輸入乙個整數n n 10000 接著輸入兩個點代表矩形的左下點b x,y 和右上點t x,y 然後輸入n個 x,y 代表 顆星星。問有多少顆星星在窗子內部,在窗邊上的不計...
連通區域內求1的個數
include include using namespace std struct number int searchnumber int i,int j,int l,struct number phead void clearfunction struct number phead int ma...