-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of wlanapi library 0.4
- Loading branch information
0 parents
commit d86627a
Showing
12 changed files
with
2,962 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
COMPILER := g++ | ||
EXECUTABLE := example_list_aps | ||
LIBS := dbus-glib-1 | ||
INCLUDES := /usr/include/dbus-1.0 /usr/lib/dbus-1.0/include /usr/include/glib-2.0 /usr/lib/glib-2.0/include | ||
CFLAGS := -O3 | ||
|
||
SOURCE := example_list_aps.cpp library/wlanapi.cpp library/wlanapi_exception.cpp | ||
|
||
all : $(EXECUTABLE) | ||
|
||
build : $(EXECUTABLE) | ||
|
||
clean : | ||
rm -f $(EXECUTABLE) | ||
|
||
$(EXECUTABLE) : | ||
$(COMPILER) $(CFLAGS) $(SOURCE) -o $(EXECUTABLE) $(addprefix -l,$(LIBS)) $(addprefix -I,$(INCLUDES)) | ||
strip $(EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
COMPILER := g++ | ||
EXECUTABLE := example_list_aps.exe | ||
LIBS := | ||
CFLAGS := -O3 | ||
|
||
SOURCE := example_list_aps.cpp library/wlanapi.cpp library/wlanapi_exception.cpp | ||
|
||
all : $(EXECUTABLE) | ||
|
||
build : $(EXECUTABLE) | ||
|
||
clean : | ||
rm -f $(EXECUTABLE) | ||
|
||
$(EXECUTABLE) : | ||
$(COMPILER) $(CFLAGS) $(SOURCE) -o $(EXECUTABLE) $(addprefix -l,$(LIBS)) | ||
strip $(EXECUTABLE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* wlanapi library 0.4 | ||
* | ||
* Copyright (C) 2008, 2009 Moritz Mertinkat <[email protected]> | ||
* All rights reserved. | ||
* | ||
* wlanapi library is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* wlanapi library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details.* | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with wlanapi library. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <stdexcept> | ||
|
||
#include "library/wlanapi.h" | ||
|
||
using namespace std; | ||
|
||
int main() { | ||
|
||
wlanapi *wi = new wlanapi(); | ||
|
||
try { | ||
|
||
const ADAPTER_LIST &adapter_list = wi->get_adapter_list(); | ||
const AP_LIST &ap_list = wi->get_ap_list(NULL); | ||
|
||
for (AP_LIST::const_iterator it = ap_list.begin(); it < ap_list.end(); ++it) { | ||
|
||
printf("ap name: %s\n", it->name); | ||
printf("ap mac address: %02x-%02x-%02x-%02x-%02x-%02x\n", it->mac_address.u[0], | ||
it->mac_address.u[1], | ||
it->mac_address.u[2], | ||
it->mac_address.u[3], | ||
it->mac_address.u[4], | ||
it->mac_address.u[5]); | ||
printf("ap rssi: %i\n", it->rssi); | ||
printf("\n"); | ||
|
||
} | ||
|
||
} catch (std::exception &e) { | ||
printf("[X] %s\n", e.what()); | ||
} | ||
|
||
printf("Press enter to exit."); | ||
scanf("..."); | ||
|
||
delete wi; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* wlanapi library 0.4 | ||
* | ||
* Copyright (C) 2008, 2009 Moritz Mertinkat <[email protected]> | ||
* All rights reserved. | ||
* | ||
* wlanapi library is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* wlanapi library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details.* | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with wlanapi library. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __DEBUG_H_ | ||
#define __DEBUG_H_ | ||
|
||
#include <string.h> | ||
|
||
#ifdef DEBUG | ||
#define DEBUG_PRINT(...) printf(__VA_ARGS__); | ||
#define DEBUG_WPRINT(...) wprintf(__VA_ARGS__); | ||
#define DEBUG_ENTER(class_name) if (strlen(#class_name) > 0) printf("[>] %s::%s()\n", #class_name, __FUNCTION__); else printf("[>] %s()\n", __FUNCTION__); | ||
#define DEBUG_LEAVE(class_name) if (strlen(#class_name) > 0) printf("[<] %s::%s()\n\n", #class_name, __FUNCTION__); else printf("[<] %s()\n\n", __FUNCTION__); | ||
#define DEBUG_ENTER_PRETTY() printf("[>] %s\n", __PRETTY_FUNCTION__); | ||
#define DEBUG_LEAVE_PRETTY() printf("[<] %s\n\n", __PRETTY_FUNCTION__); | ||
#else | ||
#define DEBUG_PRINT(...) | ||
#define DEBUG_WPRINT(...) | ||
#define DEBUG_ENTER(class_name) | ||
#define DEBUG_LEAVE(class_name) | ||
#define DEBUG_ENTER_PRETTY() | ||
#define DEBUG_LEAVE_PRETTY() | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.