├── WifiMapper.apk
├── bin
├── classes.dex
├── resources.ap_
├── WifiMapper.apk
├── res
│ ├── drawable-hdpi
│ │ ├── lock.png
│ │ ├── star.png
│ │ ├── wifi.png
│ │ ├── label.png
│ │ ├── router.png
│ │ ├── wifi_0.png
│ │ ├── wifi_1.png
│ │ ├── wifi_2.png
│ │ ├── wifi_3.png
│ │ ├── wifi_4.png
│ │ ├── label_new.png
│ │ ├── ic_launcher.png
│ │ ├── router_none.png
│ │ └── tab_divider.9.png
│ ├── drawable-ldpi
│ │ ├── lock.png
│ │ ├── star.png
│ │ ├── wifi.png
│ │ ├── label.png
│ │ ├── router.png
│ │ ├── label_new.png
│ │ ├── ic_launcher.png
│ │ └── router_none.png
│ ├── drawable-mdpi
│ │ ├── lock.png
│ │ ├── star.png
│ │ ├── wifi.png
│ │ ├── label.png
│ │ ├── router.png
│ │ ├── wifi_0.png
│ │ ├── wifi_1.png
│ │ ├── wifi_2.png
│ │ ├── wifi_3.png
│ │ ├── wifi_4.png
│ │ ├── label_new.png
│ │ ├── ic_launcher.png
│ │ └── router_none.png
│ └── drawable-xhdpi
│ │ └── ic_launcher.png
├── classes
│ └── com
│ │ └── skarbo
│ │ └── wifimapper
│ │ ├── R.class
│ │ ├── R$id.class
│ │ ├── R$attr.class
│ │ ├── R$color.class
│ │ ├── R$dimen.class
│ │ ├── R$menu.class
│ │ ├── R$style.class
│ │ ├── R$drawable.class
│ │ ├── R$layout.class
│ │ ├── R$string.class
│ │ ├── BuildConfig.class
│ │ ├── model
│ │ ├── WifiMap.class
│ │ ├── WifiScan.class
│ │ └── WifiMapper.class
│ │ ├── handler
│ │ ├── SDHandler.class
│ │ ├── WifiHandler.class
│ │ └── WifiHandler$1.class
│ │ ├── WifiMapperActivity.class
│ │ ├── activity
│ │ ├── WifiActivity.class
│ │ ├── MainTabActivity.class
│ │ ├── MapperActivity.class
│ │ ├── TaggerActivity$1.class
│ │ ├── TaggerActivity.class
│ │ ├── WifiListActivity.class
│ │ ├── WifiListActivity$1.class
│ │ ├── WifiListActivity$WifiAdapter.class
│ │ ├── MainTabActivity$TagsPresenter$1.class
│ │ ├── MainTabActivity$TagsPresenter.class
│ │ ├── MapperActivity$MapperPresenter.class
│ │ ├── MapperActivity$SensorListener.class
│ │ ├── TaggerActivity$TaggerPresenter.class
│ │ ├── WifiListActivity$WifiPresenter.class
│ │ ├── MainTabActivity$MainTabPresenter.class
│ │ ├── MapperActivity$MapperPresenter$1.class
│ │ ├── MapperActivity$MapperPresenter$2.class
│ │ ├── TaggerActivity$TaggerPresenter$1.class
│ │ ├── TaggerActivity$TaggerPresenter$2.class
│ │ ├── WifiListActivity$WifiPresenter$1.class
│ │ ├── MapperActivity$NumberButtonsHandler.class
│ │ ├── MapperActivity$NumberButtonsHandler$1.class
│ │ ├── MapperActivity$NumberButtonsHandler$2.class
│ │ └── WifiListActivity$WifiAdapter$WifiFilter.class
│ │ ├── listener
│ │ └── WifiListener.class
│ │ ├── WifiMapperActivity$SDHandler.class
│ │ ├── WifiMapperActivity$ViewPresenter.class
│ │ ├── WifiMapperActivity$SensorListener.class
│ │ ├── WifiMapperActivity$ViewPresenter$1.class
│ │ ├── WifiMapperActivity$ViewPresenter$2.class
│ │ ├── WifiMapperActivity$WifiBroadcastReceiver.class
│ │ └── WifiMapperActivity$WifiBroadcastReceiver$1.class
├── jarlist.cache
├── dexedLibs
│ ├── annotations-eff040aacf8b156cf134ee2cd19f0b61.jar
│ ├── annotations-f0d1634a771ab3d3d6db212bc5e4f4ac.jar
│ └── annotations-fdc929163ae344ea076456f1bb32b926.jar
└── AndroidManifest.xml
├── res
├── drawable-hdpi
│ ├── label.png
│ ├── lock.png
│ ├── star.png
│ ├── wifi.png
│ ├── router.png
│ ├── wifi_0.png
│ ├── wifi_1.png
│ ├── wifi_2.png
│ ├── wifi_3.png
│ ├── wifi_4.png
│ ├── label_new.png
│ ├── ic_launcher.png
│ ├── router_none.png
│ └── tab_divider.9.png
├── drawable-ldpi
│ ├── label.png
│ ├── lock.png
│ ├── star.png
│ ├── wifi.png
│ ├── router.png
│ ├── label_new.png
│ ├── ic_launcher.png
│ └── router_none.png
├── drawable-mdpi
│ ├── label.png
│ ├── lock.png
│ ├── star.png
│ ├── wifi.png
│ ├── router.png
│ ├── wifi_0.png
│ ├── wifi_1.png
│ ├── wifi_2.png
│ ├── wifi_3.png
│ ├── wifi_4.png
│ ├── label_new.png
│ ├── ic_launcher.png
│ └── router_none.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── values
│ ├── dimens.xml
│ ├── colors.xml
│ ├── resource.xml
│ └── strings.xml
├── drawable
│ ├── tab_bg_unselected.xml
│ ├── tab_bg_unselected_two.xml
│ ├── tab_selector.xml
│ ├── border.xml
│ ├── tab_bg_selected_two.xml
│ ├── tab_text_selector.xml
│ ├── tab_bg_selected.xml
│ ├── tab_bg_selector.xml
│ └── custom_progress_bar_horizontal.xml
├── layout
│ ├── tag_row.xml
│ ├── tagged_dialog.xml
│ ├── tagger.xml
│ ├── tabs_bg.xml
│ ├── tag_dialog.xml
│ ├── number_buttons.xml
│ ├── main_tab.xml
│ ├── wifi.xml
│ ├── wifi_row.xml
│ ├── mapper.xml
│ └── main.xml
└── menu
│ └── menu.xml
├── gen
└── com
│ └── skarbo
│ └── wifimapper
│ ├── BuildConfig.java
│ └── R.java
├── .settings
└── org.eclipse.jdt.core.prefs
├── src
└── com
│ └── skarbo
│ └── wifimapper
│ ├── activity
│ ├── WifiActivity.java
│ ├── TaggerActivity.java
│ ├── MainTabActivity.java
│ ├── WifiListActivity.java
│ └── MapperActivity.java
│ ├── listener
│ └── WifiListener.java
│ ├── model
│ ├── WifiMap.java
│ ├── WifiScan.java
│ └── WifiMapper.java
│ ├── handler
│ ├── WifiHandler.java
│ └── SDHandler.java
│ └── WifiMapperActivity.java
├── .classpath
├── project.properties
├── .gitignore
├── proguard-project.txt
├── .project
├── AndroidManifest.xml
└── README.md
/WifiMapper.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/WifiMapper.apk
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes.dex
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/resources.ap_
--------------------------------------------------------------------------------
/bin/WifiMapper.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/WifiMapper.apk
--------------------------------------------------------------------------------
/res/drawable-hdpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/label.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/lock.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/star.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/label.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/lock.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/star.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/wifi.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/label.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/lock.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/star.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/lock.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/star.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/lock.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/star.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/wifi.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/lock.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/star.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/star.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/router.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi_0.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi_1.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi_2.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi_3.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/wifi_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/wifi_4.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/router.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/router.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi_0.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi_1.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi_2.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi_3.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/wifi_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/wifi_4.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/label.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/router.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi_0.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi_1.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi_2.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi_3.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/wifi_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/wifi_4.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/label.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/router.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/label.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/label.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/router.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/router.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi_0.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi_1.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi_2.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi_3.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/wifi_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/wifi_4.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/label_new.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/label_new.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/label_new.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/label_new.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/label_new.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/label_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/label_new.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/router_none.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/tab_divider.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-hdpi/tab_divider.9.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-ldpi/router_none.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-mdpi/router_none.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/router_none.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-ldpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-ldpi/router_none.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/drawable-mdpi/router_none.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-mdpi/router_none.png
--------------------------------------------------------------------------------
/bin/res/drawable-hdpi/tab_divider.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-hdpi/tab_divider.9.png
--------------------------------------------------------------------------------
/bin/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$id.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$id.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$attr.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$attr.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$color.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$color.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$dimen.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$dimen.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$menu.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$style.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$style.class
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 2dip
4 |
5 |
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$drawable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$drawable.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$layout.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$layout.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/R$string.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/R$string.class
--------------------------------------------------------------------------------
/bin/jarlist.cache:
--------------------------------------------------------------------------------
1 | # cache for current jar dependency. DO NOT EDIT.
2 | # format is
3 | # Encoding is UTF-8
4 |
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/BuildConfig.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/model/WifiMap.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/model/WifiMap.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/model/WifiScan.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/model/WifiScan.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/handler/SDHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/handler/SDHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/model/WifiMapper.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/model/WifiMapper.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/handler/WifiHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/handler/WifiHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/handler/WifiHandler$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/handler/WifiHandler$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/listener/WifiListener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/listener/WifiListener.class
--------------------------------------------------------------------------------
/bin/dexedLibs/annotations-eff040aacf8b156cf134ee2cd19f0b61.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/dexedLibs/annotations-eff040aacf8b156cf134ee2cd19f0b61.jar
--------------------------------------------------------------------------------
/bin/dexedLibs/annotations-f0d1634a771ab3d3d6db212bc5e4f4ac.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/dexedLibs/annotations-f0d1634a771ab3d3d6db212bc5e4f4ac.jar
--------------------------------------------------------------------------------
/bin/dexedLibs/annotations-fdc929163ae344ea076456f1bb32b926.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/dexedLibs/annotations-fdc929163ae344ea076456f1bb32b926.jar
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$SDHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$SDHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$SensorListener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$SensorListener.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$ViewPresenter$2.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiAdapter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiAdapter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$WifiBroadcastReceiver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$WifiBroadcastReceiver.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$TagsPresenter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$TagsPresenter$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$TagsPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$TagsPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$SensorListener.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$SensorListener.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$WifiBroadcastReceiver$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/WifiMapperActivity$WifiBroadcastReceiver$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$MainTabPresenter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MainTabActivity$MainTabPresenter.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$MapperPresenter$2.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/TaggerActivity$TaggerPresenter$2.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiPresenter$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiPresenter$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler$1.class
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/MapperActivity$NumberButtonsHandler$2.class
--------------------------------------------------------------------------------
/gen/com/skarbo/wifimapper/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.skarbo.wifimapper;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 | org.eclipse.jdt.core.compiler.compliance=1.5
4 | org.eclipse.jdt.core.compiler.source=1.5
5 |
--------------------------------------------------------------------------------
/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiAdapter$WifiFilter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skarbo/WifiMapper/HEAD/bin/classes/com/skarbo/wifimapper/activity/WifiListActivity$WifiAdapter$WifiFilter.class
--------------------------------------------------------------------------------
/res/drawable/tab_bg_unselected.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
8 |
--------------------------------------------------------------------------------
/res/layout/tag_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/res/menu/menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00000000
4 | #999999
5 | #1A1A1A
6 | #009acb
7 | #1A1A1A
8 |
9 |
--------------------------------------------------------------------------------
/res/drawable/tab_bg_unselected_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
10 |
--------------------------------------------------------------------------------
/res/drawable/tab_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/activity/WifiActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.activity;
2 |
3 | public class WifiActivity extends WifiListActivity {
4 |
5 | protected static final String TAG = "WifiActivity";
6 |
7 | @Override
8 | protected boolean isShowTag() {
9 | return true;
10 | }
11 |
12 | public void handleWifiTick(long progress, long max) {
13 | // TODO Auto-generated method stub
14 |
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/listener/WifiListener.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.listener;
2 |
3 | import java.util.List;
4 |
5 | import android.content.Context;
6 |
7 | import com.skarbo.wifimapper.model.WifiScan;
8 |
9 | public interface WifiListener {
10 |
11 | abstract Context getContext();
12 |
13 | abstract void handleWifiScan(List wifiScans);
14 |
15 | abstract void handleWifiTick(long progress, long max);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/res/drawable/border.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
13 |
14 |
--------------------------------------------------------------------------------
/res/drawable/tab_bg_selected_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/res/layout/tagged_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/res/layout/tagger.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/res/drawable/tab_text_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/model/WifiMap.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.model;
2 |
3 | import java.util.List;
4 |
5 | public class WifiMap {
6 |
7 | public WifiMapper mapper;
8 | public int count;
9 | public float[] sensors;
10 | public List scans;
11 |
12 | public WifiMap(WifiMapper mapper, int count, float[] sensors, List scans) {
13 | super();
14 | this.mapper = mapper;
15 | this.count = count;
16 | this.sensors = sensors;
17 | this.scans = scans;
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/res/drawable/tab_bg_selected.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 | -
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/model/WifiScan.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.model;
2 |
3 | import android.net.wifi.ScanResult;
4 |
5 | public class WifiScan {
6 |
7 | private ScanResult scanResult;
8 | private String tag;
9 |
10 | public WifiScan(String tag, ScanResult scanResult) {
11 | this.tag = tag;
12 | this.scanResult = scanResult;
13 | }
14 |
15 | public ScanResult getScanResult() {
16 | return scanResult;
17 | }
18 |
19 | public String getTag() {
20 | return tag;
21 | }
22 |
23 | public void setTag(String tag) {
24 | this.tag = tag;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}\tools\proguard\proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-8
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | *.apk
3 |
4 | # Compiled source #
5 | ###################
6 | *.com
7 | *.class
8 | *.dll
9 | *.exe
10 | *.o
11 | *.so
12 |
13 | # Packages #
14 | ############
15 | # it's better to unpack these files and commit the raw source
16 | # git has its own built in compression methods
17 | *.7z
18 | *.dmg
19 | *.gz
20 | *.iso
21 | *.jar
22 | *.rar
23 | *.tar
24 | *.zip
25 |
26 | # Logs and databases #
27 | ######################
28 | *.log
29 | *.sql
30 | *.sqlite
31 |
32 | # OS generated files #
33 | ######################
34 | .DS_Store
35 | .DS_Store?
36 | ._*
37 | .Spotlight-V100
38 | .Trashes
39 | Icon?
40 | ehthumbs.db
41 | Thumbs.db
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/model/WifiMapper.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.model;
2 |
3 | import android.net.wifi.WifiInfo;
4 |
5 | public class WifiMapper {
6 |
7 | public int session = 0;
8 | public int id = 0;
9 | public int scans = 0;
10 | public int delay = 0;
11 | public WifiInfo connected;
12 | public String device;
13 |
14 | public WifiMapper(int session, int id, int scans, int delay, WifiInfo connected, String device) {
15 | this.session = session;
16 | this.id = id;
17 | this.scans = scans;
18 | this.delay = delay;
19 | this.connected = connected;
20 | this.device = device;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/res/values/resource.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
15 |
16 |
--------------------------------------------------------------------------------
/res/layout/tabs_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/res/drawable/tab_bg_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
10 |
11 |
13 |
14 |
15 |
16 |
18 |
19 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | WifiMapper
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/res/layout/tag_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
20 |
21 |
28 |
29 |
30 |
31 |
32 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/res/layout/number_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
27 |
28 |
29 |
39 |
40 |
--------------------------------------------------------------------------------
/res/drawable/custom_progress_bar_horizontal.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
18 |
19 |
20 | -
21 |
22 |
23 |
24 |
25 |
29 |
30 |
31 |
32 | -
33 |
34 |
35 |
36 |
37 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Hello World, WifiMapperActivity!
5 | Wi-Fi Mapper
6 |
7 | Mapper
8 | Tagger
9 | Wi-Fi\'s
10 |
11 | Filter
12 |
13 | Router
14 | Connected to:
15 | Not connected to a Wi-Fi
16 | Wi-Fi is not enabled
17 | SSID
18 | BSSID
19 | Level
20 | dBm
21 | Frequency
22 | MHz
23 | Wi-Fi
24 | Searching for Wi-Fi\'s
25 | Password
26 | Connected
27 | Tag Wi-Fi
28 | Session
29 | Scans
30 | Delay
31 | Orientation
32 | Status
33 | Register
34 | Stop
35 | Id
36 | Tags
37 |
38 |
--------------------------------------------------------------------------------
/res/layout/main_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
26 |
27 |
32 |
33 |
37 |
38 |
42 |
43 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
18 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
18 |
23 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Wi-Fi Mapper
2 | =================
3 |
4 | A personal Android application for mapping the access point strengths for a current location.
5 | The results will be used to create a fingerprint of an indoor position.
6 |
7 | _____
8 |
9 | Register mapping scans for the current position. Set a unique session id, number of scans to be done, and delay (in seconds) between each scan.
10 |
11 | ![Mapping][1]
12 |
13 | For each scan it will register the phone's orientation (x, y, z) and all visible access points.
14 |
15 | ![Registering scans][4]
16 |
17 | List of all visible access points, sorted by signal strength.
18 |
19 | ![Example Image][2]
20 |
21 |
22 | Tag access points.
23 |
24 |
25 | ![Example Image][3]
26 |
27 | _____
28 |
29 | Scans are stored in 'sdcard/wifimapper/mapper/[id]_[session]_[date].txt'.
30 | SSID, MAC address, signal, and frequency are stored for each access point.
31 |
32 |
33 | #2|1|1344938963|5|5|00:1d:70:98:b9:81|HTC Vision, 4.0.4, 0.85.0005
34 | $1|1344938964
35 | ?[155.0, -56.0, 1.0]
36 | %SSID|00:1d:70:98:b9:81|-66|2412
37 | %SSID|00:21:d8:44:18:71|-75|2437
38 | $2|1344938970
39 | ?[155.0, -56.0, 1.0]
40 | %SSID|00:1d:70:98:b9:81|-66|2412
41 | %SSID|00:21:d8:44:18:71|-69|2437
42 | ...
43 |
44 | Access point tags are stored in 'sdcard/wifimapper/tagger.txt'.
45 |
46 | 00\:1d\:a1\:76\:d6\:51=TAG
47 | 00\:1d\:70\:98\:b9\:81=TAG
48 | 00\:21\:d8\:44\:2e\:71=TAG
49 | ...
50 |
51 |
52 | *This is an old application and has a lot of possible improvements*
53 |
54 | [1]: https://lh3.googleusercontent.com/-wmAuCO7opOA/UbCKnqSYChI/AAAAAAAACSg/SOvvZhbdw3w/s400/Screenshot_2013-06-06-15-07-01.png
55 | [2]: https://lh5.googleusercontent.com/-EI6Bhu_DjiY/UbCKmG2swYI/AAAAAAAACSY/b58685-0gdA/s400/Screenshot_2013-06-06-15-07-33.png
56 | [3]: https://lh4.googleusercontent.com/-lXsKueC7SLk/UbCNoQM---I/AAAAAAAACUU/h2WsSnw2-M4/s400/Screenshot_2013-06-06-15-24-21.png
57 | [4]: https://lh6.googleusercontent.com/-pSWHuiYnvqA/UbCPBRZs4gI/AAAAAAAACUk/E06CkPpexZc/s400/Screenshot_2013-06-06-15-29-49.png
58 |
--------------------------------------------------------------------------------
/res/layout/wifi.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
22 |
23 |
28 |
29 |
35 |
36 |
41 |
42 |
43 |
44 |
48 |
49 |
58 |
59 |
60 |
61 |
62 |
68 |
69 |
70 |
77 |
78 |
82 |
83 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/activity/TaggerActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.activity;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.Dialog;
5 | import android.content.DialogInterface;
6 | import android.os.Bundle;
7 | import android.util.Log;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.widget.AdapterView;
11 | import android.widget.AdapterView.OnItemClickListener;
12 | import android.widget.EditText;
13 | import android.widget.TextView;
14 |
15 | import com.skarbo.wifimapper.R;
16 | import com.skarbo.wifimapper.model.WifiScan;
17 |
18 | public class TaggerActivity extends WifiListActivity {
19 |
20 | protected static final String TAG = "TaggerActivity";
21 | private static final int DIALOG_TAG = 1;
22 | private TaggerPresenter presenter;
23 | private boolean isInit;
24 | protected WifiScan wifiScanSelected;
25 |
26 | // ... ON
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 |
32 | if (!this.isInit) {
33 | doInit();
34 | }
35 | }
36 |
37 | @Override
38 | protected Dialog onCreateDialog(int id) {
39 | switch (id) {
40 | case DIALOG_TAG:
41 | return presenter.getAlertDialog();
42 | }
43 |
44 | return null;
45 | }
46 |
47 | // ... /ON
48 |
49 | // ... IS
50 |
51 | @Override
52 | protected boolean isShowTag() {
53 | return true;
54 | }
55 |
56 | // ... /IS
57 |
58 | // ... DO
59 |
60 | private void doInit() {
61 | // Initiate presenter
62 | this.presenter = new TaggerPresenter();
63 |
64 | // Handle item click
65 | getListView().setOnItemClickListener(new OnItemClickListener() {
66 |
67 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
68 | wifiScanSelected = getScanResults().get(position);
69 |
70 | if (wifiScanSelected != null) {
71 | presenter.updateDialog(wifiScanSelected);
72 | showDialog(DIALOG_TAG);
73 | }
74 | }
75 | });
76 |
77 | this.isInit = true;
78 | }
79 |
80 | // ... /DO
81 |
82 | // ... HANDLE
83 |
84 | private void handleTag(String tag) {
85 | if (this.wifiScanSelected == null) {
86 | return;
87 | }
88 |
89 | try {
90 | if (tag.equalsIgnoreCase("")) {
91 | this.wifiHandler.getSdHandler().removeTag(this.wifiScanSelected.getScanResult());
92 | } else {
93 | this.wifiHandler.getSdHandler().addTag(tag, this.wifiScanSelected.getScanResult());
94 | }
95 | } catch (Exception e) {
96 | Log.e(TAG, e.getMessage());
97 | }
98 |
99 | this.wifiScanSelected.setTag(tag);
100 | this.getAdapter().notifyDataSetChanged();
101 |
102 | }
103 |
104 | // ... /HANDLE
105 |
106 | // ... CLASS
107 |
108 | private class TaggerPresenter {
109 |
110 | private AlertDialog alertDialog;
111 | private View dialogView;
112 | private EditText tagEditText;
113 | private TextView tagSsidTextView;
114 | private TextView tagBssidTextView;
115 |
116 | public TaggerPresenter() {
117 | LayoutInflater factory = LayoutInflater.from(TaggerActivity.this);
118 |
119 | // Get dialog view
120 | this.dialogView = factory.inflate(R.layout.tag_dialog, null);
121 | this.tagEditText = (EditText) this.dialogView.findViewById(R.id.wifi_tag_edittext);
122 | this.tagSsidTextView = (TextView) this.dialogView.findViewById(R.id.wifi_tag_ssid_textview);
123 | this.tagBssidTextView = (TextView) this.dialogView.findViewById(R.id.wifi_tag_bssid_textview);
124 |
125 | // Create alert dialog
126 | this.alertDialog = new AlertDialog.Builder(TaggerActivity.this).setIcon(R.drawable.label_new)
127 | .setTitle(R.string.wifi_tag).setView(this.dialogView)
128 | .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
129 | public void onClick(DialogInterface dialog, int whichButton) {
130 | handleTag(tagEditText.getText().toString());
131 | }
132 | }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
133 | public void onClick(DialogInterface dialog, int whichButton) {
134 | Log.d(TAG, "On click: Cancel");
135 | }
136 | }).create();
137 |
138 | }
139 |
140 | public AlertDialog getAlertDialog() {
141 | return alertDialog;
142 | }
143 |
144 | public void updateDialog(WifiScan scan) {
145 | this.tagSsidTextView.setText(scan.getScanResult().SSID);
146 | this.tagBssidTextView.setText(scan.getScanResult().BSSID);
147 | this.tagEditText.setText(scan.getTag());
148 | }
149 |
150 | }
151 |
152 | public void handleWifiTick(long progress, long max) {
153 | // TODO Auto-generated method stub
154 |
155 | }
156 |
157 | // ... /CLASS
158 |
159 | }
160 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/handler/WifiHandler.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.handler;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 | import java.util.Timer;
6 | import java.util.TimerTask;
7 |
8 | import android.content.BroadcastReceiver;
9 | import android.content.Context;
10 | import android.content.Intent;
11 | import android.content.IntentFilter;
12 | import android.net.ConnectivityManager;
13 | import android.net.NetworkInfo;
14 | import android.net.wifi.ScanResult;
15 | import android.net.wifi.WifiManager;
16 | import android.os.CountDownTimer;
17 | import android.util.Log;
18 |
19 | import com.skarbo.wifimapper.listener.WifiListener;
20 | import com.skarbo.wifimapper.model.WifiScan;
21 |
22 | public class WifiHandler extends BroadcastReceiver {
23 |
24 | private static final String TAG = "WifiHandler";
25 | private static final String WIFI_TIMER = "wifi_timer";
26 | private static final int DELAY_DEFAULT = 5000;
27 |
28 | private WifiListener wifiListener;
29 | private WifiManager wifiManager;
30 | private ConnectivityManager connectivityManager;
31 | private SDHandler sdHandler;
32 | private int delay = DELAY_DEFAULT;
33 | private Timer wifiTimer;
34 | private CountDownTimer wifiCountDownTimer;
35 |
36 | public WifiHandler(final WifiListener wifiListener) {
37 | this.wifiListener = wifiListener;
38 | this.wifiManager = (WifiManager) this.wifiListener.getContext().getSystemService(Context.WIFI_SERVICE);
39 | this.connectivityManager = (ConnectivityManager) this.wifiListener.getContext().getSystemService(
40 | Context.CONNECTIVITY_SERVICE);
41 | this.sdHandler = new SDHandler();
42 | this.wifiTimer = new Timer(WIFI_TIMER);
43 |
44 | this.wifiCountDownTimer = new CountDownTimer(delay, 100) {
45 |
46 | @Override
47 | public void onTick(long millisUntilFinished) {
48 | wifiListener.handleWifiTick(millisUntilFinished, delay);
49 | }
50 |
51 | @Override
52 | public void onFinish() {
53 | try {
54 | doWifiScan(delay);
55 | } catch (Exception e) {
56 | Log.e(TAG, e.getMessage());
57 | }
58 | }
59 | };
60 | }
61 |
62 | // ... GET
63 |
64 | public WifiManager getWifiManager() {
65 | return wifiManager;
66 | }
67 |
68 | public ConnectivityManager getConnectivityManager() {
69 | return connectivityManager;
70 | }
71 |
72 | public SDHandler getSdHandler() {
73 | return sdHandler;
74 | }
75 |
76 | public int getNextUniqueId() {
77 | return sdHandler.getMapperDirectoryCount() + 1;
78 | }
79 |
80 | // ... /GET
81 |
82 | // ... SET
83 |
84 | public void setDelay(int delay) {
85 | this.delay = delay;
86 | }
87 |
88 | public void setDelayDefault() {
89 | this.delay = DELAY_DEFAULT;
90 | }
91 |
92 | // ... /SET
93 |
94 | // ... IS
95 |
96 | public boolean isWifiEnabled() {
97 | return wifiManager.isWifiEnabled();
98 | }
99 |
100 | public boolean isWifiConnected() {
101 | NetworkInfo connectivityNetworkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
102 | return connectivityNetworkInfo.isConnected();
103 | }
104 |
105 | // ... /IS
106 |
107 | // ... DO
108 |
109 | public void doWifiListen() {
110 | // Intent filter
111 | IntentFilter intentFilter = new IntentFilter();
112 | intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
113 |
114 | // Register WiFi receiver
115 | this.wifiListener.getContext().registerReceiver(this, intentFilter);
116 | }
117 |
118 | public void doWifiUnlisten() {
119 | // Unregister WiFio receiver
120 | this.wifiListener.getContext().unregisterReceiver(this);
121 | }
122 |
123 | public void doWifiScan() throws Exception {
124 | doWifiScan(DELAY_DEFAULT);
125 | }
126 |
127 | public void doWifiScan(int delay) throws Exception {
128 | this.delay = delay;
129 | if (isWifiEnabled()) {
130 | if (isWifiConnected()) {
131 | this.wifiManager.startScan();
132 | } else {
133 | throw new Exception("Wifi is not connected");
134 | }
135 | } else {
136 | throw new Exception("Wifi is not enabled");
137 | }
138 | }
139 |
140 | // ... /DO
141 |
142 | // ... ON
143 |
144 | @Override
145 | public void onReceive(Context context, Intent intent) {
146 | if (this.wifiListener != null) {
147 |
148 | // Generate list of WiFi scan
149 | List wifiScans = new ArrayList();
150 | String tag = "";
151 | for (ScanResult scanResult : this.wifiManager.getScanResults()) {
152 | try {
153 | tag = this.sdHandler.getTag(scanResult);
154 | } catch (Exception e) {
155 | tag = "";
156 | Log.e(TAG, e.getMessage());
157 | }
158 | wifiScans.add(new WifiScan(tag, scanResult));
159 | }
160 |
161 | this.wifiListener.handleWifiScan(wifiScans);
162 |
163 | // Schedule new scan
164 | // wifiTimer.schedule(new TimerTask() {
165 | //
166 | // @Override
167 | // public void run() {
168 | // try {
169 | // doWifiScan(delay);
170 | // } catch (Exception e) {
171 | // Log.e(TAG, e.getMessage());
172 | // }
173 | // }
174 | // }, delay);
175 | this.wifiCountDownTimer.start();
176 |
177 | }
178 | }
179 |
180 | // ... /ON
181 |
182 | }
183 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/handler/SDHandler.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.handler;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileInputStream;
6 | import java.io.FileNotFoundException;
7 | import java.io.FileOutputStream;
8 | import java.io.FileWriter;
9 | import java.io.IOException;
10 | import java.util.ArrayList;
11 | import java.util.Arrays;
12 | import java.util.List;
13 | import java.util.Properties;
14 |
15 | import android.net.wifi.ScanResult;
16 | import android.os.Environment;
17 |
18 | import com.skarbo.wifimapper.model.WifiMap;
19 | import com.skarbo.wifimapper.model.WifiMapper;
20 | import com.skarbo.wifimapper.model.WifiScan;
21 |
22 | public class SDHandler {
23 |
24 | private static String DIRECTORY_ROOT = "wifimapper";
25 | private static String DIRECTORY_MAPPER = "mapper";
26 | private static String FILE_EXTENTION = "txt";
27 | private static String FILE_TAGGER = "tagger.%s";
28 | /** "session_id_time" */
29 | private static String FILE_MAPPER = "%d_%d_%s.%s";
30 |
31 | private File taggerFile;
32 | private File mapperDirectory;
33 | private File mapperFile;
34 | private Properties taggerProperties;
35 | private boolean isTaggerLoaded = false;
36 |
37 | public SDHandler() {
38 | this.taggerFile = new File(getDirectory(), String.format(FILE_TAGGER, FILE_EXTENTION));
39 | this.mapperDirectory = new File(getMapperDirectory());
40 | this.taggerProperties = new Properties();
41 | }
42 |
43 | // ... DO
44 |
45 | private void doLoadTagger() throws FileNotFoundException, IOException {
46 | if (!this.isTaggerLoaded) {
47 | // Create tagger file
48 | this.doCreateFile(this.taggerFile);
49 |
50 | // Load tagger properties
51 | this.taggerProperties.load(new FileInputStream(this.taggerFile));
52 |
53 | this.isTaggerLoaded = true;
54 | }
55 | }
56 |
57 | private void doStoreTagger() throws FileNotFoundException, IOException {
58 | this.taggerProperties.store(new FileOutputStream(this.taggerFile), null);
59 | }
60 |
61 | private void doCreateFile(File file) throws IOException {
62 | if (!file.exists()) {
63 | File folder = file.getParentFile();
64 | if (!folder.exists()) {
65 | folder.mkdirs();
66 | }
67 | file.createNewFile();
68 | }
69 | }
70 |
71 | private void doWriteToFile(File file, String string) throws IOException {
72 | FileWriter fstream = new FileWriter(file, true);
73 | BufferedWriter out = new BufferedWriter(fstream);
74 | out.write(string);
75 | out.close();
76 | }
77 |
78 | // ... /DO
79 |
80 | // ... GET
81 |
82 | private String getDirectory() {
83 | return String.format("%s/%s", Environment.getExternalStorageDirectory().toString(), DIRECTORY_ROOT);
84 | }
85 |
86 | private String getMapperDirectory() {
87 | return String.format("%s/%s", getDirectory(), DIRECTORY_MAPPER);
88 | }
89 |
90 | public int getMapperDirectoryCount() {
91 | return mapperDirectory.exists() ? mapperDirectory.list().length : 0;
92 | }
93 |
94 | public List getTags() throws FileNotFoundException, IOException {
95 | this.doLoadTagger();
96 |
97 | List tags = new ArrayList();
98 | String value = "";
99 | for (Object key : this.taggerProperties.keySet()) {
100 | value = this.taggerProperties.getProperty((String) key);
101 | tags.add(String.format("%s (%s)", value, (String) key));
102 | }
103 |
104 | return tags;
105 | }
106 |
107 | public String getTag(ScanResult scanResult) throws FileNotFoundException, IOException {
108 | this.doLoadTagger();
109 | return this.taggerProperties.getProperty(scanResult.BSSID, "");
110 | }
111 |
112 | private long getTimestamp() {
113 | return System.currentTimeMillis() / 1000;
114 | }
115 |
116 | // ... /GET
117 |
118 | // ... ADD
119 |
120 | public void addTag(String tag, ScanResult scanResult) throws FileNotFoundException, IOException {
121 | this.doLoadTagger();
122 | this.taggerProperties.setProperty(scanResult.BSSID, tag);
123 | this.doStoreTagger();
124 | }
125 |
126 | public void addScanToFile(WifiMap wifiMap) throws Exception {
127 | StringBuilder string = new StringBuilder();
128 |
129 | // Append map
130 | string.append(String.format("$%d|%d\n", wifiMap.count, getTimestamp()));
131 |
132 | // Append sensors
133 | string.append(String.format("?%s\n", Arrays.toString(wifiMap.sensors)));
134 |
135 | // For each WiFi scan
136 | for (WifiScan wifiScan : wifiMap.scans) {
137 | // Append WiFi scan
138 | string.append(String.format("%%%s|%s|%s|%s\n", wifiScan.getScanResult().SSID,
139 | wifiScan.getScanResult().BSSID, wifiScan.getScanResult().level, wifiScan.getScanResult().frequency));
140 | }
141 |
142 | // Write to file
143 | doWriteToFile(this.mapperFile, string.toString());
144 | }
145 |
146 | // ... /ADD
147 |
148 | // ... REMOVE
149 |
150 | public void removeTag(ScanResult scanResult) throws FileNotFoundException, IOException {
151 | this.doLoadTagger();
152 | this.taggerProperties.remove(scanResult.BSSID);
153 | this.doStoreTagger();
154 | }
155 |
156 | // ... REMOVE
157 |
158 | // ... CREATE
159 |
160 | public void createMapperFile(WifiMapper mapper) throws Exception {
161 | // Create date time string
162 | String dateTime = android.text.format.DateFormat.format("yyyy_MM_dd_hhmm", new java.util.Date()).toString();
163 |
164 | // Create mapper file name
165 | String fileName = String.format(FILE_MAPPER, mapper.session, mapper.id, dateTime, FILE_EXTENTION);
166 |
167 | // Create mapper file
168 | this.mapperFile = new File(getMapperDirectory(), fileName);
169 |
170 | // Create mapper file
171 | doCreateFile(this.mapperFile);
172 |
173 | // Create first line
174 | String firstLine = String.format("#%d|%d|%s|%d|%d|%s|%s\n", mapper.session, mapper.id, getTimestamp(),
175 | mapper.scans, mapper.delay, mapper.connected != null ? mapper.connected.getBSSID() : "", mapper.device);
176 |
177 | // Write to file
178 | doWriteToFile(this.mapperFile, firstLine);
179 | }
180 |
181 | // ... /CREATE
182 |
183 | }
184 |
--------------------------------------------------------------------------------
/res/layout/wifi_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
26 |
27 |
33 |
34 |
37 |
38 |
39 |
47 |
48 |
53 |
54 |
60 |
61 |
66 |
67 |
74 |
75 |
80 |
81 |
82 |
88 |
89 |
94 |
95 |
100 |
101 |
107 |
108 |
109 |
114 |
115 |
120 |
121 |
127 |
128 |
129 |
130 |
131 |
136 |
137 |
145 |
146 |
153 |
154 |
155 |
156 |
157 |
--------------------------------------------------------------------------------
/gen/com/skarbo/wifimapper/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package com.skarbo.wifimapper;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class color {
14 | public static final int bgcolor=0x7f040002;
15 | public static final int color_light=0x7f040001;
16 | public static final int tab_bgcolor=0x7f040004;
17 | public static final int tab_border_selected=0x7f040003;
18 | public static final int transparent=0x7f040000;
19 | }
20 | public static final class dimen {
21 | public static final int wifi_row_legend=0x7f050000;
22 | }
23 | public static final class drawable {
24 | public static final int border=0x7f020000;
25 | public static final int custom_progress_bar_horizontal=0x7f020001;
26 | public static final int ic_launcher=0x7f020002;
27 | public static final int label=0x7f020003;
28 | public static final int label_new=0x7f020004;
29 | public static final int lock=0x7f020005;
30 | public static final int router=0x7f020006;
31 | public static final int router_none=0x7f020007;
32 | public static final int star=0x7f020008;
33 | public static final int tab_bg_selected=0x7f020009;
34 | public static final int tab_bg_selected_two=0x7f02000a;
35 | public static final int tab_bg_selector=0x7f02000b;
36 | public static final int tab_bg_unselected=0x7f02000c;
37 | public static final int tab_bg_unselected_two=0x7f02000d;
38 | public static final int tab_divider=0x7f02000e;
39 | public static final int tab_selector=0x7f02000f;
40 | public static final int tab_text_selector=0x7f020010;
41 | public static final int wifi=0x7f020011;
42 | public static final int wifi_0=0x7f020012;
43 | public static final int wifi_1=0x7f020013;
44 | public static final int wifi_2=0x7f020014;
45 | public static final int wifi_3=0x7f020015;
46 | public static final int wifi_4=0x7f020016;
47 | }
48 | public static final class id {
49 | public static final int accessPointCountTextView=0x7f09000e;
50 | public static final int accessPointTable=0x7f09000f;
51 | public static final int accessPointTableRow=0x7f090010;
52 | public static final int delayEditText=0x7f090007;
53 | public static final int deviceTextView=0x7f090004;
54 | public static final int directionTextView=0x7f09000b;
55 | public static final int imageView1=0x7f090035;
56 | public static final int map_delay_number_buttons=0x7f09001b;
57 | public static final int map_direction_textview=0x7f09001c;
58 | public static final int map_id_textview=0x7f090018;
59 | public static final int map_register_button=0x7f09001e;
60 | public static final int map_scans_number_buttons=0x7f09001a;
61 | public static final int map_session_number_buttons=0x7f090019;
62 | public static final int map_status_progressbar=0x7f090017;
63 | public static final int map_status_textview=0x7f090016;
64 | public static final int map_stop_button=0x7f09001d;
65 | public static final int number_button_decrease=0x7f09001f;
66 | public static final int number_button_edittext=0x7f090020;
67 | public static final int number_button_increase=0x7f090021;
68 | public static final int registerButton=0x7f090008;
69 | public static final int scansEditText=0x7f090006;
70 | public static final int scrollView1=0x7f090000;
71 | public static final int sessionEditText=0x7f090005;
72 | public static final int statusTextView=0x7f090003;
73 | public static final int stopButton=0x7f090009;
74 | public static final int tabsLayout=0x7f090022;
75 | public static final int tabsText=0x7f090023;
76 | public static final int textView1=0x7f090001;
77 | public static final int textView2=0x7f090015;
78 | public static final int textView3=0x7f09000a;
79 | public static final int textView4=0x7f09000c;
80 | public static final int textView5=0x7f09000d;
81 | public static final int textView7=0x7f090011;
82 | public static final int textView8=0x7f090012;
83 | public static final int textView9=0x7f090013;
84 | public static final int uniqueIdTextView=0x7f090002;
85 | public static final int wifi_connectedto_bssid=0x7f09002a;
86 | public static final int wifi_connectedto_router=0x7f090028;
87 | public static final int wifi_connectedto_ssid=0x7f090029;
88 | public static final int wifi_filter=0x7f09002b;
89 | public static final int wifi_menu_tags=0x7f090037;
90 | public static final int wifi_row_bssid=0x7f090031;
91 | public static final int wifi_row_connected=0x7f09002d;
92 | public static final int wifi_row_frequency=0x7f090033;
93 | public static final int wifi_row_icon=0x7f09002f;
94 | public static final int wifi_row_level=0x7f090032;
95 | public static final int wifi_row_password=0x7f09002e;
96 | public static final int wifi_row_ssid=0x7f090030;
97 | public static final int wifi_row_tag=0x7f090034;
98 | public static final int wifi_row_tag_textview=0x7f090036;
99 | public static final int wifi_scan_progress=0x7f090014;
100 | public static final int wifi_searching=0x7f09002c;
101 | public static final int wifi_tag_bssid_textview=0x7f090025;
102 | public static final int wifi_tag_edittext=0x7f090026;
103 | public static final int wifi_tag_ssid_textview=0x7f090024;
104 | public static final int wifi_tags_list=0x7f090027;
105 | }
106 | public static final class layout {
107 | public static final int main=0x7f030000;
108 | public static final int main_tab=0x7f030001;
109 | public static final int mapper=0x7f030002;
110 | public static final int number_buttons=0x7f030003;
111 | public static final int tabs_bg=0x7f030004;
112 | public static final int tag_dialog=0x7f030005;
113 | public static final int tag_row=0x7f030006;
114 | public static final int tagged_dialog=0x7f030007;
115 | public static final int tagger=0x7f030008;
116 | public static final int wifi=0x7f030009;
117 | public static final int wifi_row=0x7f03000a;
118 | }
119 | public static final class menu {
120 | public static final int menu=0x7f080000;
121 | }
122 | public static final class string {
123 | public static final int app_name=0x7f070001;
124 | public static final int filter=0x7f070005;
125 | public static final int hello=0x7f070000;
126 | public static final int map_delay=0x7f070017;
127 | public static final int map_id=0x7f07001c;
128 | public static final int map_orientation=0x7f070018;
129 | public static final int map_register=0x7f07001a;
130 | public static final int map_scans=0x7f070016;
131 | public static final int map_session=0x7f070015;
132 | public static final int map_status=0x7f070019;
133 | public static final int map_stop=0x7f07001b;
134 | public static final int mapper=0x7f070002;
135 | public static final int tagger=0x7f070003;
136 | public static final int tags=0x7f07001d;
137 | public static final int wifi_bssid=0x7f07000b;
138 | public static final int wifi_connected=0x7f070013;
139 | public static final int wifi_connectedto=0x7f070007;
140 | public static final int wifi_connectedto_none=0x7f070008;
141 | public static final int wifi_connectedto_notenabled=0x7f070009;
142 | public static final int wifi_dbm=0x7f07000d;
143 | public static final int wifi_frequency=0x7f07000e;
144 | public static final int wifi_level=0x7f07000c;
145 | public static final int wifi_mhz=0x7f07000f;
146 | public static final int wifi_password=0x7f070012;
147 | public static final int wifi_router=0x7f070006;
148 | public static final int wifi_searching=0x7f070011;
149 | public static final int wifi_ssid=0x7f07000a;
150 | public static final int wifi_tag=0x7f070014;
151 | public static final int wifi_wifi=0x7f070010;
152 | public static final int wifis=0x7f070004;
153 | }
154 | public static final class style {
155 | public static final int CustomProgressBar=0x7f060001;
156 | public static final int Theme_NoShadow=0x7f060000;
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/activity/MainTabActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.activity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.HashMap;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | import android.app.AlertDialog;
10 | import android.app.Dialog;
11 | import android.app.TabActivity;
12 | import android.content.Context;
13 | import android.content.DialogInterface;
14 | import android.content.Intent;
15 | import android.os.Bundle;
16 | import android.util.Log;
17 | import android.view.LayoutInflater;
18 | import android.view.Menu;
19 | import android.view.MenuInflater;
20 | import android.view.MenuItem;
21 | import android.view.View;
22 | import android.widget.ArrayAdapter;
23 | import android.widget.ListView;
24 | import android.widget.ProgressBar;
25 | import android.widget.TabHost;
26 | import android.widget.TabHost.TabSpec;
27 | import android.widget.TextView;
28 |
29 | import com.skarbo.wifimapper.R;
30 | import com.skarbo.wifimapper.handler.WifiHandler;
31 | import com.skarbo.wifimapper.listener.WifiListener;
32 | import com.skarbo.wifimapper.model.WifiScan;
33 |
34 | public class MainTabActivity extends TabActivity implements WifiListener {
35 | private static final String TAG = "MainTabActivity";
36 | private static final int DIALOG_TAGS = 1;
37 |
38 | private WifiHandler wifiHandler;
39 |
40 | private MainTabPresenter presenter;
41 | private TagsPresenter tagsPresenter;
42 | private boolean isInit = false;
43 |
44 | // ... ON
45 |
46 | /** Called when the activity is first created. */
47 | @Override
48 | public void onCreate(Bundle savedInstanceState) {
49 | super.onCreate(savedInstanceState);
50 | Log.d(TAG, "On create");
51 | setContentView(R.layout.main_tab);
52 |
53 | if (!this.isInit) {
54 | doInit();
55 | }
56 | }
57 |
58 | @Override
59 | protected void onDestroy() {
60 | super.onDestroy();
61 |
62 | this.wifiHandler.doWifiUnlisten();
63 | }
64 |
65 | @Override
66 | public boolean onCreateOptionsMenu(Menu menu) {
67 | MenuInflater inflater = getMenuInflater();
68 | inflater.inflate(R.menu.menu, menu);
69 |
70 | return true;
71 | }
72 |
73 | @Override
74 | public boolean onOptionsItemSelected(MenuItem item) {
75 | switch (item.getItemId()) {
76 | case R.id.wifi_menu_tags:
77 | showDialog(DIALOG_TAGS);
78 | break;
79 |
80 | default:
81 | break;
82 | }
83 |
84 | return false;
85 | }
86 |
87 | @Override
88 | protected Dialog onCreateDialog(int id) {
89 | switch (id) {
90 | case DIALOG_TAGS:
91 | List tags = new ArrayList();
92 | try {
93 | tags = this.wifiHandler.getSdHandler().getTags();
94 | } catch (Exception e) {
95 | Log.e(TAG, e.getMessage(), e);
96 | }
97 | this.tagsPresenter.updateTagsList(tags);
98 | return this.tagsPresenter.getAlertDialog();
99 | }
100 |
101 | return null;
102 | }
103 |
104 | // ... /ON
105 |
106 | // ... GET
107 |
108 | public Context getContext() {
109 | return super.getApplicationContext();
110 | }
111 |
112 | // ... /GET
113 |
114 | // ... DO
115 |
116 | private void doInit() {
117 | // Init presenter
118 | this.presenter = new MainTabPresenter(this.getApplicationContext());
119 | this.tagsPresenter = new TagsPresenter(this.getApplicationContext());
120 |
121 | this.wifiHandler = new WifiHandler(this);
122 |
123 | // Listen to WiFi
124 | this.wifiHandler.doWifiListen();
125 |
126 | // Start WiFi scan
127 | try {
128 | this.wifiHandler.doWifiScan();
129 | } catch (Exception e) {
130 | Log.e(TAG, e.getMessage());
131 | }
132 |
133 | this.isInit = true;
134 | }
135 |
136 | // ... /DO
137 |
138 | // ... HANDLE
139 |
140 | public void handleWifiScan(List wifiScans) {
141 | // Update WiFi tab
142 | this.presenter.updateWifiTabTitle(wifiScans.size());
143 |
144 | this.presenter.updateWifiProgress(0, 0);
145 | }
146 |
147 | public void handleWifiTick(long progress, long max) {
148 | // Update WiFi progress
149 | this.presenter.updateWifiProgress((int) (max - progress), (int) max);
150 | }
151 |
152 | // ... /HANDLE
153 |
154 | // CLASS
155 |
156 | private class MainTabPresenter {
157 |
158 | private static final String TAB_MAPPER = "mapper";
159 | private static final String TAB_WIFIS = "wifis";
160 | private TabHost tabHost;
161 | private Map tabViews;
162 | private ProgressBar wifiScanProgress;
163 |
164 | public MainTabPresenter(Context context) {
165 | // Progress view
166 | this.wifiScanProgress = (ProgressBar) findViewById(R.id.wifi_scan_progress);
167 |
168 | // Setup tab host
169 | doSetupTabHost();
170 |
171 | // Set divider
172 | tabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider);
173 |
174 | // Initiate tab views
175 | this.tabViews = new HashMap();
176 |
177 | // Setup tabs
178 | doSetupTab(TAB_MAPPER, getString(R.string.mapper), new Intent(context, MapperActivity.class));
179 | doSetupTab(TAB_WIFIS, getString(R.string.wifis), new Intent(context, TaggerActivity.class));
180 | // doSetupTab(TAB_WIFIS, getString(R.string.wifis), new
181 | // Intent(context, WifiActivity.class));
182 |
183 | // Set "WiFi" as default tab
184 | tabHost.setCurrentTab(0);
185 | }
186 |
187 | // ... DO
188 |
189 | private void doSetupTabHost() {
190 | tabHost = (TabHost) findViewById(android.R.id.tabhost);
191 | tabHost.setup();
192 | }
193 |
194 | private void doSetupTab(final String tag, final String title, Intent intent) {
195 | View tabview = createTabView(tabHost.getContext(), title);
196 |
197 | TabSpec setContent = tabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent);
198 | tabHost.addTab(setContent);
199 |
200 | // Add tab view
201 | this.tabViews.put(tag, tabview);
202 | }
203 |
204 | // ... /DO
205 |
206 | // ... CREATE
207 |
208 | private View createTabView(final Context context, final String text) {
209 | View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
210 | TextView tv = (TextView) view.findViewById(R.id.tabsText);
211 | tv.setText(text);
212 | return view;
213 | }
214 |
215 | // ... /CREATE
216 |
217 | // ... UPDATE
218 |
219 | public void updateWifiTabTitle(int count) {
220 | View tabview = this.tabViews.get(TAB_WIFIS);
221 | if (tabview != null) {
222 | TextView tabTitle = (TextView) tabview.findViewById(R.id.tabsText);
223 | if (tabTitle != null) {
224 | String title = String.format("%s (%d)", getString(R.string.wifis), count);
225 | tabTitle.setText(title);
226 | }
227 | }
228 | }
229 |
230 | public void updateWifiProgress(int progress, int max)
231 | {
232 | this.wifiScanProgress.setMax(max);
233 | this.wifiScanProgress.setProgress(progress);
234 | }
235 |
236 | // ... /UPDATE
237 |
238 | }
239 |
240 | private class TagsPresenter {
241 |
242 | private View dialogView;
243 | private AlertDialog alertDialog;
244 | private ListView tagsListView;
245 | private ArrayAdapter tagsAdapter;
246 | private List tagsList;
247 |
248 | public TagsPresenter(Context context) {
249 | LayoutInflater factory = LayoutInflater.from(MainTabActivity.this);
250 | this.tagsList = new ArrayList();
251 |
252 | // Get dialog view
253 | this.dialogView = factory.inflate(R.layout.tagged_dialog, null);
254 |
255 | // Tags list
256 | this.tagsListView = (ListView) this.dialogView.findViewById(R.id.wifi_tags_list);
257 | this.tagsAdapter = new ArrayAdapter(MainTabActivity.this, android.R.layout.simple_list_item_1,
258 | tagsList);
259 | this.tagsListView.setAdapter(this.tagsAdapter);
260 |
261 | // Create alert dialog
262 | this.alertDialog = new AlertDialog.Builder(MainTabActivity.this).setIcon(R.drawable.label)
263 | .setTitle(R.string.tags).setView(this.dialogView)
264 | .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
265 | public void onClick(DialogInterface dialog, int whichButton) {
266 |
267 | }
268 | }).create();
269 |
270 | }
271 |
272 | public AlertDialog getAlertDialog() {
273 | return this.alertDialog;
274 | }
275 |
276 | public void updateTagsList(List tags) {
277 | if (this.tagsList != null) {
278 | this.tagsList.clear();
279 | this.tagsList.addAll(tags);
280 | Collections.sort(this.tagsList);
281 | this.tagsAdapter.notifyDataSetChanged();
282 | } else {
283 | Log.e(TAG, "TagsPresenter updateTagsList: tagsList is null");
284 | }
285 | }
286 |
287 | }
288 |
289 | // /CLASS
290 |
291 | }
292 |
--------------------------------------------------------------------------------
/res/layout/mapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
13 |
14 |
19 |
20 |
23 |
24 |
28 |
29 |
38 |
39 |
45 |
46 |
53 |
54 |
60 |
61 |
62 |
63 |
66 |
67 |
75 |
76 |
85 |
86 |
87 |
88 |
92 |
93 |
101 |
102 |
106 |
107 |
108 |
109 |
113 |
114 |
122 |
123 |
127 |
128 |
129 |
130 |
134 |
135 |
143 |
144 |
148 |
149 |
150 |
151 |
155 |
156 |
165 |
166 |
175 |
176 |
177 |
178 |
179 |
182 |
183 |
190 |
191 |
197 |
198 |
199 |
200 |
--------------------------------------------------------------------------------
/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
21 |
22 |
26 |
27 |
30 |
31 |
36 |
37 |
42 |
43 |
48 |
49 |
50 |
53 |
54 |
59 |
60 |
65 |
66 |
71 |
72 |
73 |
74 |
78 |
79 |
84 |
85 |
88 |
89 |
94 |
95 |
100 |
101 |
106 |
107 |
108 |
111 |
112 |
119 |
120 |
121 |
122 |
129 |
130 |
131 |
132 |
139 |
140 |
141 |
142 |
143 |
144 |
150 |
151 |
158 |
159 |
160 |
161 |
164 |
165 |
173 |
174 |
183 |
184 |
185 |
188 |
189 |
197 |
198 |
199 |
202 |
203 |
210 |
211 |
220 |
221 |
222 |
227 |
228 |
232 |
233 |
239 |
240 |
247 |
248 |
255 |
256 |
257 |
258 |
259 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/activity/WifiListActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.activity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.Comparator;
6 | import java.util.List;
7 |
8 | import android.app.ListActivity;
9 | import android.content.Context;
10 | import android.net.wifi.ScanResult;
11 | import android.net.wifi.WifiInfo;
12 | import android.os.Bundle;
13 | import android.text.Editable;
14 | import android.text.TextWatcher;
15 | import android.view.LayoutInflater;
16 | import android.view.View;
17 | import android.view.ViewGroup;
18 | import android.widget.ArrayAdapter;
19 | import android.widget.EditText;
20 | import android.widget.Filter;
21 | import android.widget.Filterable;
22 | import android.widget.ImageView;
23 | import android.widget.LinearLayout;
24 | import android.widget.ListView;
25 | import android.widget.TextView;
26 |
27 | import com.skarbo.wifimapper.R;
28 | import com.skarbo.wifimapper.handler.WifiHandler;
29 | import com.skarbo.wifimapper.listener.WifiListener;
30 | import com.skarbo.wifimapper.model.WifiScan;
31 |
32 | public abstract class WifiListActivity extends ListActivity implements WifiListener {
33 |
34 | protected static final String TAG = "WifiListActivity";
35 |
36 | private static final int WIFI_LEVEL_HIGH = -60;
37 | private static final int WIFI_LEVEL_MEDIUM = -70;
38 | private static final int WIFI_LEVEL_LOW = -75;
39 | private static final int WIFI_LEVEL_LOWEST = -85;
40 |
41 | private static final Comparator WIFISCAN_COMPARATOR = new Comparator() {
42 |
43 | public int compare(WifiScan lhs, WifiScan rhs) {
44 | return Integer.valueOf(rhs.getScanResult().level).compareTo(Integer.valueOf(lhs.getScanResult().level));
45 | // return
46 | // rhs.getScanResult().SSID.compareTo(lhs.getScanResult().SSID);
47 | }
48 | };
49 |
50 | protected WifiHandler wifiHandler;
51 | protected WifiAdapter adapter;
52 |
53 | private boolean isInit = false;
54 | private List scanResults;
55 |
56 | private WifiPresenter presenter;
57 |
58 | // ... ON
59 |
60 | @Override
61 | protected void onCreate(Bundle savedInstanceState) {
62 | super.onCreate(savedInstanceState);
63 | setContentView(R.layout.wifi);
64 |
65 | if (!this.isInit) {
66 | doInit();
67 | }
68 | }
69 |
70 | @Override
71 | protected void onDestroy() {
72 | super.onDestroy();
73 |
74 | this.wifiHandler.doWifiUnlisten();
75 | this.isInit = false;
76 | }
77 |
78 | // ... /ON
79 |
80 | // ... GET
81 |
82 | public Context getContext() {
83 | return this.getApplicationContext();
84 | }
85 |
86 | private int getWifiIcon(ScanResult scanResult) {
87 | if (scanResult.level > WIFI_LEVEL_HIGH) {
88 | return R.drawable.wifi_4;
89 | } else if (scanResult.level > WIFI_LEVEL_MEDIUM) {
90 | return R.drawable.wifi_3;
91 | } else if (scanResult.level > WIFI_LEVEL_LOW) {
92 | return R.drawable.wifi_2;
93 | } else if (scanResult.level > WIFI_LEVEL_LOWEST) {
94 | return R.drawable.wifi_1;
95 | } else {
96 | return R.drawable.wifi_0;
97 | }
98 | }
99 |
100 | protected List getScanResults() {
101 | return scanResults;
102 | }
103 |
104 | protected WifiAdapter getAdapter() {
105 | return adapter;
106 | }
107 |
108 | // ... /GET
109 |
110 | // ... IS
111 |
112 | protected abstract boolean isShowTag();
113 |
114 | // ... /IS
115 |
116 | // ... DO
117 |
118 | private void doInit() {
119 | // Init scan results
120 | this.scanResults = new ArrayList();
121 |
122 | // Init adapter
123 | this.adapter = new WifiAdapter(this, R.layout.wifi_row, this.scanResults);
124 |
125 | // Set adapter sort
126 | this.adapter.sort(WIFISCAN_COMPARATOR);
127 |
128 | setListAdapter(this.adapter);
129 |
130 | // Init Wifi handler
131 | this.wifiHandler = new WifiHandler(this);
132 |
133 | // Listen to WiFi
134 | this.wifiHandler.doWifiListen();
135 |
136 | // Presenter
137 | this.presenter = new WifiPresenter();
138 |
139 | // Update connected to
140 | this.presenter.updateConnectedTo();
141 |
142 | this.isInit = true;
143 | }
144 |
145 | // ... /DO
146 |
147 | // ... HANDLE
148 |
149 | public void handleWifiScan(List wifiScans) {
150 | // Set scan results
151 | this.scanResults = wifiScans;
152 |
153 | // Sort wifi scans
154 | Collections.sort(this.scanResults, WIFISCAN_COMPARATOR);
155 |
156 | // Remove all from adapter
157 | this.adapter.clear();
158 |
159 | // Add Scan Result to adapter
160 | for (WifiScan scanResult : wifiScans) {
161 | this.adapter.add(scanResult);
162 | }
163 |
164 | // Update searching
165 | this.presenter.updateSearching(this.adapter.isEmpty());
166 |
167 | // Notify data change
168 | this.adapter.notifyDataSetChanged();
169 |
170 | // Update connected to
171 | this.presenter.updateConnectedTo();
172 | }
173 |
174 | // ... /HANDLE
175 |
176 | // CLASS
177 |
178 | private class WifiPresenter {
179 |
180 | private TextView connectedToSSID;
181 | private TextView connectedToBSSID;
182 | private ImageView connectedToRouter;
183 | private LinearLayout searching;
184 | private ListView listView;
185 | private EditText filterEditText;
186 |
187 | public WifiPresenter() {
188 | this.connectedToSSID = (TextView) findViewById(R.id.wifi_connectedto_ssid);
189 | this.connectedToBSSID = (TextView) findViewById(R.id.wifi_connectedto_bssid);
190 | this.searching = (LinearLayout) findViewById(R.id.wifi_searching);
191 | this.connectedToRouter = (ImageView) findViewById(R.id.wifi_connectedto_router);
192 | this.filterEditText = (EditText) findViewById(R.id.wifi_filter);
193 | this.listView = getListView();
194 |
195 | // Add text change listener to filter text
196 | this.filterEditText.addTextChangedListener(new TextWatcher() {
197 |
198 | public void onTextChanged(CharSequence s, int start, int before, int count) {
199 | adapter.getFilter().filter(s);
200 | }
201 |
202 | public void beforeTextChanged(CharSequence s, int start, int count, int after) {
203 |
204 | }
205 |
206 | public void afterTextChanged(Editable s) {
207 |
208 | }
209 | });
210 | }
211 |
212 | public void updateConnectedTo() {
213 | if (wifiHandler.getWifiManager().isWifiEnabled()) {
214 | if (wifiHandler.getWifiManager().getConnectionInfo() != null) {
215 | this.connectedToSSID.setText(wifiHandler.getWifiManager().getConnectionInfo().getSSID());
216 | this.connectedToBSSID.setText(wifiHandler.getWifiManager().getConnectionInfo().getBSSID());
217 | this.connectedToBSSID.setVisibility(View.VISIBLE);
218 | this.connectedToRouter.setImageResource(R.drawable.router);
219 | } else {
220 | this.connectedToSSID.setText(getString(R.string.wifi_connectedto_none));
221 | this.connectedToBSSID.setVisibility(View.GONE);
222 | this.connectedToRouter.setImageResource(R.drawable.router_none);
223 | }
224 | } else {
225 | this.connectedToSSID.setText(getString(R.string.wifi_connectedto_notenabled));
226 | this.connectedToBSSID.setVisibility(View.GONE);
227 | this.connectedToRouter.setImageResource(R.drawable.router_none);
228 | }
229 | }
230 |
231 | public void updateSearching(boolean listEmpty) {
232 | if (listEmpty) {
233 | this.listView.setVisibility(View.GONE);
234 | this.searching.setVisibility(View.VISIBLE);
235 | this.filterEditText.setVisibility(View.GONE);
236 | } else {
237 | this.listView.setVisibility(View.VISIBLE);
238 | this.searching.setVisibility(View.GONE);
239 | this.filterEditText.setVisibility(View.VISIBLE);
240 | }
241 | }
242 |
243 | }
244 |
245 | protected class WifiAdapter extends ArrayAdapter implements Filterable {
246 |
247 | private List scanResults;
248 | private List wifiScans;
249 | private Filter filter;
250 | private final Object lock = new Object();
251 |
252 | public WifiAdapter(Context context, int textViewResourceId, List wifiScans) {
253 | super(context, textViewResourceId, wifiScans);
254 | this.wifiScans = wifiScans;
255 | this.scanResults = wifiScans;
256 | getListView().setTextFilterEnabled(true);
257 | }
258 |
259 | @Override
260 | public View getView(int position, View convertView, ViewGroup parent) {
261 | View view = convertView;
262 |
263 | if (view == null) {
264 | LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
265 | view = layoutInflater.inflate(R.layout.wifi_row, null);
266 | }
267 |
268 | WifiScan wifiScan = this.scanResults.size() > position && this.scanResults.size() >= 0 ? this.scanResults.get(position) : null;
269 | if (wifiScan != null) {
270 | ImageView signalImageView = (ImageView) view.findViewById(R.id.wifi_row_icon);
271 | ImageView connectedImageView = (ImageView) view.findViewById(R.id.wifi_row_connected);
272 | ImageView passwordImageView = (ImageView) view.findViewById(R.id.wifi_row_password);
273 | TextView ssidTextView = (TextView) view.findViewById(R.id.wifi_row_ssid);
274 | TextView bssidTextView = (TextView) view.findViewById(R.id.wifi_row_bssid);
275 | TextView levelTextView = (TextView) view.findViewById(R.id.wifi_row_level);
276 | TextView frequencyTextView = (TextView) view.findViewById(R.id.wifi_row_frequency);
277 | LinearLayout tagLinearLayout = (LinearLayout) view.findViewById(R.id.wifi_row_tag);
278 | TextView tagTextView = (TextView) view.findViewById(R.id.wifi_row_tag_textview);
279 |
280 | signalImageView.setImageResource(getWifiIcon(wifiScan.getScanResult()));
281 | ssidTextView.setText(wifiScan.getScanResult().SSID);
282 | bssidTextView.setText(wifiScan.getScanResult().BSSID);
283 | levelTextView.setText("" + wifiScan.getScanResult().level);
284 | frequencyTextView.setText("" + wifiScan.getScanResult().frequency);
285 | tagLinearLayout.setVisibility(isShowTag() && !wifiScan.getTag().equalsIgnoreCase("") ? View.VISIBLE
286 | : View.GONE);
287 | tagTextView.setText(wifiScan.getTag());
288 |
289 | // CONNECTED
290 |
291 | WifiInfo connectionInfo = wifiHandler.getWifiManager().getConnectionInfo();
292 | boolean isConnected = connectionInfo != null ? wifiScan.getScanResult().BSSID
293 | .equalsIgnoreCase(connectionInfo.getBSSID()) : false;
294 |
295 | if (isConnected) {
296 | connectedImageView.setVisibility(View.VISIBLE);
297 | } else {
298 | connectedImageView.setVisibility(View.GONE);
299 | }
300 |
301 | // /CONNECTED
302 |
303 | // PASSWORD
304 |
305 | if (wifiScan.getScanResult().capabilities.contains("WEP")
306 | || wifiScan.getScanResult().capabilities.contains("WPA")) {
307 | passwordImageView.setVisibility(View.VISIBLE);
308 | } else {
309 | passwordImageView.setVisibility(View.GONE);
310 | }
311 |
312 | // /PASSWORD
313 |
314 | }
315 |
316 | return view;
317 | }
318 |
319 | @Override
320 | public Filter getFilter() {
321 | if (this.filter == null) {
322 | this.filter = new WifiFilter();
323 | }
324 | return filter;
325 | }
326 |
327 | // CLASS
328 |
329 | private class WifiFilter extends Filter {
330 |
331 | @Override
332 | protected FilterResults performFiltering(CharSequence constraint) {
333 | FilterResults results = new FilterResults();
334 |
335 | if (scanResults == null) {
336 | synchronized (lock) {
337 | scanResults = new ArrayList(wifiScans);
338 | }
339 | }
340 |
341 | if (constraint == null || constraint.length() == 0) {
342 | synchronized (lock) {
343 | List list = new ArrayList(wifiScans);
344 | results.values = list;
345 | results.count = list.size();
346 | }
347 | } else {
348 | String filter = constraint.toString().toLowerCase();
349 |
350 | final List values = scanResults;
351 | final int count = values.size();
352 |
353 | final List newValues = new ArrayList(count);
354 |
355 | for (WifiScan value : values) {
356 | if (value.getScanResult().BSSID.toLowerCase().contains(filter)
357 | || value.getScanResult().SSID.toLowerCase().contains(filter)
358 | || value.getTag().toLowerCase().contains(filter)) {
359 | newValues.add(value);
360 | }
361 | }
362 |
363 | results.values = newValues;
364 | results.count = newValues.size();
365 | }
366 |
367 | return results;
368 | }
369 |
370 | @SuppressWarnings("unchecked")
371 | @Override
372 | protected void publishResults(CharSequence constraint, FilterResults results) {
373 | scanResults = (List) results.values;
374 | if (results.count > 0) {
375 | notifyDataSetChanged();
376 | } else {
377 | notifyDataSetInvalidated();
378 | }
379 | }
380 |
381 | }
382 |
383 | // /CLASS
384 |
385 | }
386 |
387 | // /CLASS
388 |
389 | }
390 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/activity/MapperActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper.activity;
2 |
3 | import java.util.List;
4 |
5 | import android.app.Activity;
6 | import android.content.Context;
7 | import android.content.SharedPreferences;
8 | import android.hardware.Sensor;
9 | import android.hardware.SensorEvent;
10 | import android.hardware.SensorEventListener;
11 | import android.hardware.SensorManager;
12 | import android.os.Bundle;
13 | import android.preference.PreferenceManager;
14 | import android.util.Log;
15 | import android.view.View;
16 | import android.view.View.OnClickListener;
17 | import android.widget.Button;
18 | import android.widget.EditText;
19 | import android.widget.ProgressBar;
20 | import android.widget.TextView;
21 | import android.widget.Toast;
22 |
23 | import com.skarbo.wifimapper.R;
24 | import com.skarbo.wifimapper.handler.WifiHandler;
25 | import com.skarbo.wifimapper.listener.WifiListener;
26 | import com.skarbo.wifimapper.model.WifiMap;
27 | import com.skarbo.wifimapper.model.WifiMapper;
28 | import com.skarbo.wifimapper.model.WifiScan;
29 |
30 | public class MapperActivity extends Activity implements WifiListener {
31 |
32 | private static final String TAG = "MapperActivity";
33 | private static final int SESSION_DEFAULT = 1;
34 | private static final int SCANS_DEFAULT = 5;
35 | private static final int DELAY_DEFAULT = 5;
36 | private static final int ID_DEFAULT = 0;
37 | private static final float DIRECTION_DEFAULT = 0.0f;
38 | private static final String PREF_SESSION = "session";
39 | private static final String PREF_SCANS = "scans";
40 | private static final String PREF_DELAY = "delay";
41 | private static final int STATE_STARTING = 1;
42 | public static final int STATE_REGISTER = 2;
43 | public static final int STATE_FINISHED = 3;
44 | private static final int STATE_INIT = 4;
45 |
46 | private boolean isInit = false;
47 | private WifiHandler wifiHandler;
48 | private MapperPresenter presenter;
49 | private SharedPreferences preferences;
50 | private SensorManager sensorManager;
51 | private Sensor sensor;
52 | private int session = SESSION_DEFAULT;
53 | private int scans = SCANS_DEFAULT;
54 | private int delay = DELAY_DEFAULT;
55 | private boolean isRegister = false;
56 | private int uniqueId = ID_DEFAULT;
57 | private int registerCount;
58 | private WifiMapper wifiMapper;
59 | private float[] sensors = { 0.0f, 0.0f, 0.0f };
60 | private SensorListener sensorListener;
61 |
62 | // ... ON
63 |
64 | @Override
65 | protected void onCreate(Bundle savedInstanceState) {
66 | super.onCreate(savedInstanceState);
67 | setContentView(R.layout.mapper);
68 |
69 | doInit();
70 | }
71 |
72 | @Override
73 | protected void onDestroy() {
74 | super.onDestroy();
75 |
76 | // Unlisten WiFi
77 | this.wifiHandler.doWifiUnlisten();
78 |
79 | this.isInit = false;
80 |
81 | // Store preferences
82 | SharedPreferences.Editor editor = preferences.edit();
83 | editor.putInt(PREF_SESSION, this.session);
84 | editor.putInt(PREF_SCANS, this.scans);
85 | editor.putInt(PREF_DELAY, this.delay);
86 | boolean commited = editor.commit();
87 | }
88 |
89 | // ... /ON
90 |
91 | // ... GET
92 |
93 | public Context getContext() {
94 | return this.getApplicationContext();
95 | }
96 |
97 | // ... /GET
98 |
99 | // ... DO
100 |
101 | private void doInit() {
102 | if (this.isInit) {
103 | return;
104 | }
105 |
106 | // Preferences
107 | this.preferences = PreferenceManager.getDefaultSharedPreferences(this);
108 |
109 | // Mapper presenter
110 | this.presenter = new MapperPresenter();
111 |
112 | // WiFi handler
113 | this.wifiHandler = new WifiHandler(this);
114 |
115 | // Sensor
116 | this.sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
117 | this.sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
118 | this.sensorListener = new SensorListener();
119 |
120 | // Listen to WiFi
121 | this.wifiHandler.doWifiListen();
122 |
123 | // Listen to sensor
124 | this.sensorManager.registerListener(this.sensorListener, this.sensor, SensorManager.SENSOR_DELAY_NORMAL);
125 |
126 | // Set default values
127 | this.session = preferences.getInt(PREF_SESSION, SESSION_DEFAULT);
128 | this.scans = preferences.getInt(PREF_SCANS, SCANS_DEFAULT);
129 | this.delay = preferences.getInt(PREF_DELAY, DELAY_DEFAULT);
130 |
131 | // Update presenter
132 | this.presenter.doUpdate(STATE_INIT);
133 |
134 | this.isInit = true;
135 | }
136 |
137 | private void doStartRegister() throws Exception {
138 | if (this.isRegister) {
139 | throw new Exception("Register already in progess");
140 | }
141 | if (!this.wifiHandler.isWifiEnabled()) {
142 | throw new Exception("Wifi is not enabled");
143 | }
144 | if (!this.wifiHandler.isWifiConnected()) {
145 | throw new Exception("Wifi is not connected");
146 | }
147 |
148 | this.session = presenter.getSession();
149 | this.scans = presenter.getScans();
150 | this.delay = presenter.getDelay();
151 |
152 | if (this.session < 1) {
153 | throw new Exception("Session must exceed 0");
154 | }
155 | if (this.scans < 1) {
156 | throw new Exception("Scans must exceed 0");
157 | }
158 | if (this.delay < 1) {
159 | throw new Exception("Delay must exceed 0");
160 | }
161 |
162 | // Set values
163 | this.uniqueId = this.wifiHandler.getNextUniqueId();
164 | this.isRegister = true;
165 | this.registerCount = 0;
166 |
167 | // Create device string
168 | String device = String.format("%s, %s, %s", android.os.Build.MODEL, android.os.Build.VERSION.RELEASE,
169 | android.os.Build.BOOTLOADER);
170 |
171 | // Create WiFi mapper
172 | this.wifiMapper = new WifiMapper(this.session, this.uniqueId, this.scans, this.delay, this.wifiHandler
173 | .getWifiManager().getConnectionInfo(), device);
174 |
175 | // Create WiFi mapper file
176 | try {
177 | this.wifiHandler.getSdHandler().createMapperFile(this.wifiMapper);
178 | } catch (Exception e) {
179 | Log.e(TAG, e.getMessage(), e);
180 | this.doStopRegister();
181 | throw new Exception("Can't create Wi-Fi mapper file");
182 | }
183 |
184 | // Set WiFi handler delay
185 | this.wifiHandler.setDelay(this.delay * 1000);
186 |
187 | // Notify
188 | doNotify(String.format("Starting register session #%d, id #%d with %d scan(s) and %d sec. delay", this.session,
189 | this.uniqueId, this.scans, this.delay), true);
190 |
191 | // Update presenter
192 | this.presenter.doUpdate(STATE_STARTING);
193 | }
194 |
195 | private void doStopRegister() {
196 | doNotify(String.format("Register session #%d, id #%d stopped; %d scan(s) registered", this.session,
197 | this.uniqueId, this.registerCount), true);
198 | // Set values
199 | this.isRegister = false;
200 |
201 | // Update presenter
202 | this.presenter.doUpdate(STATE_FINISHED);
203 |
204 | // Set WiFi scan to default
205 | this.wifiHandler.setDelayDefault();
206 | }
207 |
208 | private void doNotify(String message) {
209 | doNotify(message, false);
210 | }
211 |
212 | private void doNotify(String message, boolean longMessage) {
213 | (Toast.makeText(this, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT)).show();
214 | }
215 |
216 | // ... /DO
217 |
218 | // ... HANDLE
219 |
220 | public void handleWifiScan(List wifiScans) {
221 | if (this.isRegister) {
222 | try {
223 | // Increase register count
224 | this.registerCount++;
225 |
226 | // Create WiFi map
227 | WifiMap wifiMap = new WifiMap(this.wifiMapper, this.registerCount, this.sensors, wifiScans);
228 |
229 | // Add WiFi map to file
230 | this.wifiHandler.getSdHandler().addScanToFile(wifiMap);
231 |
232 | // Update presenter
233 | this.presenter.doUpdate(STATE_REGISTER);
234 |
235 | // Finish register
236 | if (this.registerCount >= this.scans) {
237 | doStopRegister();
238 | }
239 | } catch (Exception e) {
240 | Log.e(TAG, e.getMessage(), e);
241 | doNotify("Error while adding scan to file");
242 | doStopRegister();
243 | }
244 | }
245 | }
246 |
247 | private void handleRegisterStart() {
248 | try {
249 | this.doStartRegister();
250 | } catch (Exception e) {
251 | doNotify(e.getMessage());
252 | }
253 | }
254 |
255 | private void handleRegisterStop() {
256 | try {
257 | this.doStopRegister();
258 | } catch (Exception e) {
259 | doNotify(e.getMessage());
260 | }
261 | }
262 |
263 | private void handleRecievedSensor(float[] values) {
264 | this.sensors = values;
265 | this.presenter.doUpdateDirection((float) values[0]);
266 | }
267 |
268 | // ... /HANDLE
269 |
270 | // CLASS
271 |
272 | private class MapperPresenter {
273 |
274 | private NumberButtonsHandler sessionNumberButtons;
275 | private NumberButtonsHandler scansNumberButtons;
276 | private NumberButtonsHandler delayNumberButtons;
277 | private Button registerButton;
278 | private Button stopButton;
279 | private TextView statusTextView;
280 | private ProgressBar statusProgessBar;
281 | private TextView idTextView;
282 | private TextView directionTextView;
283 |
284 | public MapperPresenter() {
285 |
286 | // Number buttons
287 | this.sessionNumberButtons = new NumberButtonsHandler((View) findViewById(R.id.map_session_number_buttons));
288 | this.scansNumberButtons = new NumberButtonsHandler((View) findViewById(R.id.map_scans_number_buttons));
289 | this.delayNumberButtons = new NumberButtonsHandler((View) findViewById(R.id.map_delay_number_buttons));
290 |
291 | this.statusTextView = (TextView) findViewById(R.id.map_status_textview);
292 | this.statusProgessBar = (ProgressBar) findViewById(R.id.map_status_progressbar);
293 | this.idTextView = (TextView) findViewById(R.id.map_id_textview);
294 | this.directionTextView = (TextView) findViewById(R.id.map_direction_textview);
295 | this.registerButton = (Button) findViewById(R.id.map_register_button);
296 | this.stopButton = (Button) findViewById(R.id.map_stop_button);
297 |
298 | this.sessionNumberButtons.updateNumber(session);
299 | this.scansNumberButtons.updateNumber(scans);
300 | this.delayNumberButtons.updateNumber(delay);
301 | this.directionTextView.setText("" + DIRECTION_DEFAULT);
302 | this.idTextView.setText("" + ID_DEFAULT);
303 |
304 | this.registerButton.setOnClickListener(new OnClickListener() {
305 |
306 | public void onClick(View v) {
307 | handleRegisterStart();
308 | }
309 | });
310 |
311 | this.stopButton.setOnClickListener(new OnClickListener() {
312 |
313 | public void onClick(View v) {
314 | handleRegisterStop();
315 | }
316 | });
317 | }
318 |
319 | public void doUpdateDirection(float direction) {
320 | this.directionTextView.setText("" + direction);
321 | }
322 |
323 | public int getSession() {
324 | return this.sessionNumberButtons.getNumber();
325 | }
326 |
327 | public int getScans() {
328 | return this.scansNumberButtons.getNumber();
329 | }
330 |
331 | public int getDelay() {
332 | return this.delayNumberButtons.getNumber();
333 | }
334 |
335 | public void doUpdate(int state) {
336 | switch (state) {
337 | case STATE_INIT:
338 | this.statusTextView.setText("Ready");
339 | this.sessionNumberButtons.updateNumber(session);
340 | this.scansNumberButtons.updateNumber(scans);
341 | this.delayNumberButtons.updateNumber(delay);
342 | this.idTextView.setText("" + uniqueId);
343 | break;
344 | case STATE_STARTING:
345 | setEnabled(!isRegister);
346 | this.statusProgessBar.setProgress(registerCount);
347 | this.statusProgessBar.setMax(scans);
348 | this.statusTextView.setText("Starting...");
349 | this.idTextView.setText("" + uniqueId);
350 | break;
351 | case STATE_REGISTER:
352 | this.statusTextView.setText(String.format("%d/%d registered", registerCount, scans));
353 | this.statusProgessBar.setProgress(registerCount);
354 | break;
355 | case STATE_FINISHED:
356 | setEnabled(!isRegister);
357 | this.statusTextView.setText("Ready");
358 | break;
359 | }
360 | }
361 |
362 | private void setEnabled(boolean enabled) {
363 | this.sessionNumberButtons.setEnable(enabled);
364 | this.scansNumberButtons.setEnable(enabled);
365 | this.delayNumberButtons.setEnable(enabled);
366 | this.stopButton.setEnabled(!enabled);
367 | this.registerButton.setEnabled(enabled);
368 | this.statusProgessBar.setVisibility(enabled ? View.GONE : View.VISIBLE);
369 | }
370 |
371 | }
372 |
373 | private class NumberButtonsHandler {
374 |
375 | private Button incButton;
376 | private Button decButton;
377 | private EditText editText;
378 |
379 | public NumberButtonsHandler(View view) {
380 |
381 | this.incButton = (Button) view.findViewById(R.id.number_button_increase);
382 | this.decButton = (Button) view.findViewById(R.id.number_button_decrease);
383 | this.editText = (EditText) view.findViewById(R.id.number_button_edittext);
384 |
385 | this.incButton.setOnClickListener(new OnClickListener() {
386 |
387 | public void onClick(View v) {
388 | int number = getNumber();
389 | editText.setText("" + (number + 1));
390 | }
391 | });
392 | this.decButton.setOnClickListener(new OnClickListener() {
393 |
394 | public void onClick(View v) {
395 | int number = getNumber();
396 | editText.setText("" + Math.max(number - 1, 1));
397 | }
398 | });
399 | }
400 |
401 | public int getNumber() {
402 | try {
403 | return Integer.parseInt(editText.getText().toString());
404 | } catch (NumberFormatException e) {
405 | return 0;
406 | }
407 | }
408 |
409 | public void updateNumber(int number) {
410 | editText.setText("" + number);
411 | }
412 |
413 | public void setEnable(boolean enable) {
414 | editText.setEnabled(enable);
415 | incButton.setEnabled(enable);
416 | decButton.setEnabled(enable);
417 | }
418 |
419 | }
420 |
421 | private class SensorListener implements SensorEventListener {
422 |
423 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
424 |
425 | }
426 |
427 | public void onSensorChanged(SensorEvent event) {
428 | if (event.values.length > 0) {
429 | handleRecievedSensor(event.values);
430 | }
431 | }
432 |
433 | }
434 |
435 | public void handleWifiTick(long progress, long max) {
436 | // TODO Auto-generated method stub
437 |
438 | }
439 |
440 | // /CLASS
441 |
442 | }
443 |
--------------------------------------------------------------------------------
/src/com/skarbo/wifimapper/WifiMapperActivity.java:
--------------------------------------------------------------------------------
1 | package com.skarbo.wifimapper;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileInputStream;
6 | import java.io.FileOutputStream;
7 | import java.io.FileWriter;
8 | import java.io.IOException;
9 | import java.util.ArrayList;
10 | import java.util.Arrays;
11 | import java.util.List;
12 | import java.util.Map;
13 | import java.util.Properties;
14 | import java.util.Set;
15 | import java.util.Timer;
16 | import java.util.TimerTask;
17 | import java.util.TreeMap;
18 |
19 | import android.app.Activity;
20 | import android.content.BroadcastReceiver;
21 | import android.content.Context;
22 | import android.content.Intent;
23 | import android.content.IntentFilter;
24 | import android.content.SharedPreferences;
25 | import android.graphics.Typeface;
26 | import android.hardware.Sensor;
27 | import android.hardware.SensorEvent;
28 | import android.hardware.SensorEventListener;
29 | import android.hardware.SensorManager;
30 | import android.net.ConnectivityManager;
31 | import android.net.NetworkInfo;
32 | import android.net.wifi.ScanResult;
33 | import android.net.wifi.WifiInfo;
34 | import android.net.wifi.WifiManager;
35 | import android.os.Bundle;
36 | import android.os.Environment;
37 | import android.preference.PreferenceManager;
38 | import android.util.Log;
39 | import android.view.Gravity;
40 | import android.view.View;
41 | import android.view.View.OnClickListener;
42 | import android.widget.Button;
43 | import android.widget.EditText;
44 | import android.widget.TableLayout;
45 | import android.widget.TableRow;
46 | import android.widget.TableRow.LayoutParams;
47 | import android.widget.TextView;
48 | import android.widget.Toast;
49 |
50 | public class WifiMapperActivity extends Activity {
51 | private static final String PREF_DELAY = "delay";
52 | private static final String PREF_SCANS = "scans";
53 | private static final String PREF_SESSION = "session";
54 | private static final String WIFI_TIMER = "wifi_timer";
55 | public static final long WIFI_SCAN_DELAY = 5000;
56 | private static final String TAG = "WifiMapper";
57 | private static final int SCANS_DEFAULT = 5;
58 | private static final int DELAY_DEFAULT = 5;
59 | private static final int SESSION_DEFAULT = 1;
60 |
61 | private WifiManager wifiManager;
62 | private Timer wifiTimer;
63 | private WifiBroadcastReceiver wifiScanReciver;
64 | private SensorManager sensorManager;
65 | private Sensor sensor;
66 | private ConnectivityManager connectivityManager;
67 |
68 | private ViewPresenter viewPresenter;
69 | private SensorListener sensorListener;
70 | private SDHandler sdHandler;
71 | private boolean isRegister = false;
72 | private int session = SESSION_DEFAULT;
73 | private int scans = SCANS_DEFAULT;
74 | private int delay = DELAY_DEFAULT;
75 | private int uniqueId = 0;
76 | private int registerCount = 0;
77 | private boolean isInit = false;
78 | private float[] sensors = new float[0];
79 | private SharedPreferences preferences;
80 |
81 | /** Called when the activity is first created. */
82 | @Override
83 | public void onCreate(Bundle savedInstanceState) {
84 | super.onCreate(savedInstanceState);
85 | Log.d(TAG, "On create");
86 | setContentView(R.layout.main);
87 |
88 | if (!isInit) {
89 | Log.d(TAG, "Initializing");
90 |
91 | preferences = PreferenceManager.getDefaultSharedPreferences(this);
92 |
93 | wifiManager = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
94 | wifiTimer = new Timer(WIFI_TIMER);
95 | wifiScanReciver = new WifiBroadcastReceiver();
96 |
97 | connectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
98 |
99 | sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
100 | sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
101 | sensorListener = new SensorListener();
102 |
103 | viewPresenter = new ViewPresenter(this);
104 | sdHandler = new SDHandler();
105 |
106 | viewPresenter.setDevice(String.format("%s, %s", android.os.Build.MODEL, android.os.Build.VERSION.RELEASE));
107 | viewPresenter.setStatus("Ready");
108 | viewPresenter.setUniqueId("" + getNextUniqueId());
109 | viewPresenter.setSession("" + preferences.getInt(PREF_SESSION, SESSION_DEFAULT));
110 | viewPresenter.setScans("" + preferences.getInt(PREF_SCANS, SCANS_DEFAULT));
111 | viewPresenter.setDelay("" + preferences.getInt(PREF_DELAY, DELAY_DEFAULT));
112 |
113 | doStartWifi();
114 | doStartSensors();
115 |
116 | isInit = true;
117 | }
118 |
119 | }
120 |
121 | @Override
122 | protected void onResume() {
123 | super.onResume();
124 | Log.d(TAG, "On resume");
125 | }
126 |
127 | @Override
128 | protected void onStart() {
129 | super.onStart();
130 | Log.d(TAG, "On start");
131 | }
132 |
133 | @Override
134 | protected void onPause() {
135 | super.onPause();
136 | Log.d(TAG, "On pause");
137 | }
138 |
139 | @Override
140 | protected void onStop() {
141 | super.onStop();
142 | Log.d(TAG, "On stop");
143 | }
144 |
145 | @Override
146 | protected void onDestroy() {
147 | super.onDestroy();
148 | Log.d(TAG, "On destroy");
149 | doStopRegister();
150 | doStopWifi();
151 | doStopSensors();
152 | this.isInit = false;
153 |
154 | SharedPreferences.Editor editor = preferences.edit();
155 | editor.putInt(PREF_SESSION, this.session);
156 | editor.putInt(PREF_SCANS, this.scans);
157 | editor.putInt(PREF_DELAY, this.delay);
158 | editor.commit();
159 | }
160 |
161 | // ... GET
162 |
163 | public int getNextUniqueId() {
164 | return sdHandler.getMapperDirectoryCount() + 1;
165 | }
166 |
167 | // ... /GET
168 |
169 | // ... IS
170 |
171 | public boolean isWifiEnabled() {
172 | return wifiManager.isWifiEnabled();
173 | }
174 |
175 | public boolean isWifiConnected() {
176 | NetworkInfo connectivityNetworkInfo = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
177 | return connectivityNetworkInfo.isConnected();
178 | }
179 |
180 | // ... /IS
181 |
182 | // ... DO
183 |
184 | public void doStartSensors() {
185 | Log.d(TAG, "Start sensor");
186 | if (sensor != null) {
187 | sensorManager.registerListener(sensorListener, sensor, SensorManager.SENSOR_DELAY_NORMAL);
188 | }
189 | }
190 |
191 | public void doStopSensors() {
192 | sensorManager.unregisterListener(sensorListener);
193 | }
194 |
195 | public void doStartWifi() {
196 | Log.d(TAG, "Starting wifi");
197 | if (wifiManager.isWifiEnabled()) {
198 | IntentFilter intentFilter = new IntentFilter();
199 | intentFilter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION);
200 | Log.d(TAG, "Register wifi reciever");
201 | this.registerReceiver(wifiScanReciver, intentFilter);
202 | wifiManager.startScan();
203 | } else {
204 | Log.d(TAG, "Wifi is not enabled");
205 | }
206 | }
207 |
208 | public void doStopWifi() {
209 | Log.d(TAG, "Stopping wifi");
210 | if (wifiManager.isWifiEnabled()) {
211 | Log.d(TAG, "Unregister wifi reciever");
212 | this.unregisterReceiver(wifiScanReciver);
213 | }
214 | }
215 |
216 | public void doStopRegister() {
217 | if (isRegister) {
218 | doNotify(String.format("Register #%d stopped, %d scan(s) registered", uniqueId, registerCount), true);
219 |
220 | isRegister = false;
221 |
222 | viewPresenter.setSessionEnabled(true);
223 | viewPresenter.setScansEnabled(true);
224 | viewPresenter.setDelayEnabled(true);
225 | viewPresenter.setRegisterEnabled(true);
226 | viewPresenter.setStopEnabled(false);
227 | viewPresenter.setStatus("Ready");
228 | viewPresenter.setUniqueId("" + getNextUniqueId());
229 | }
230 | }
231 |
232 | public void doStartRegister() throws Exception {
233 | if (this.isRegister) {
234 | throw new Exception("Register already in progess");
235 | }
236 | if (!isWifiEnabled()) {
237 | throw new Exception("Wifi is not enabled");
238 | }
239 | if (!isWifiConnected()) {
240 | throw new Exception("Wifi is not connected");
241 | }
242 |
243 | this.session = viewPresenter.getSession();
244 | this.scans = viewPresenter.getScans();
245 | this.delay = viewPresenter.getDelay();
246 |
247 | if (this.session < 1) {
248 | throw new Exception("Session must exceed 0");
249 | }
250 | if (this.scans < 1) {
251 | throw new Exception("Scans must exceed 0");
252 | }
253 | if (this.delay < 1) {
254 | throw new Exception("Delay must exceed 0");
255 | }
256 |
257 | this.uniqueId = getNextUniqueId();
258 | this.isRegister = true;
259 | this.registerCount = 0;
260 |
261 | WifiInfo connectionInfo = this.wifiManager.getConnectionInfo();
262 |
263 | this.viewPresenter.setSessionEnabled(false);
264 | this.viewPresenter.setDelayEnabled(false);
265 | this.viewPresenter.setScansEnabled(false);
266 | this.viewPresenter.setRegisterEnabled(false);
267 | this.viewPresenter.setStopEnabled(true);
268 | this.viewPresenter.setStatus("Register...");
269 |
270 | try {
271 | sdHandler.createMapperFile(this.session, this.uniqueId, this.scans, this.delay, connectionInfo.getBSSID(),
272 | String.format("%s, %s, %s", android.os.Build.MODEL, android.os.Build.VERSION.RELEASE,
273 | android.os.Build.BOOTLOADER));
274 | } catch (Exception e) {
275 | Log.e(TAG, e.getMessage(), e);
276 | doStopRegister();
277 | throw new Exception("Can't create log file");
278 | }
279 |
280 | doNotify(String.format("Starting register #%d with %d scan(s) and %d sec. delay", this.uniqueId, this.scans,
281 | this.delay), true);
282 | }
283 |
284 | public void doNotify(String message) {
285 | doNotify(message, false);
286 | }
287 |
288 | public void doNotify(String message, boolean longMessage) {
289 | (Toast.makeText(this, message, longMessage ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT)).show();
290 | Log.d(TAG, "Notify: " + message);
291 | }
292 |
293 | // ... /DO
294 |
295 | // ... HANDLE
296 |
297 | public void handleRecievedWifiScan(List scanResults) {
298 | if (this.isRegister) {
299 | try {
300 | this.registerCount++;
301 | sdHandler.addScanToFile(this.registerCount, scanResults, this.sensors);
302 | viewPresenter.setStatus(String.format("Register %s/%s scans", this.registerCount, this.scans));
303 | Log.d(TAG, "Handled wifi scan: #" + uniqueId + ", count: " + this.registerCount + " scans: "
304 | + scanResults.size() + ", sensors: " + this.sensors.length);
305 |
306 | if (registerCount >= scans) {
307 | doStopRegister();
308 | }
309 | } catch (Exception e) {
310 | Log.e(TAG, e.getMessage(), e);
311 | doNotify("Error while adding scan to file");
312 | doStopRegister();
313 | }
314 | }
315 |
316 | this.viewPresenter.doUpdateWifiCount(scanResults.size());
317 |
318 | Map> scanResultsMap = generateScanResultsMap(scanResults);
319 | this.viewPresenter.doUpdateWifiTable(scanResultsMap);
320 | }
321 |
322 | public void handleRecievedSensor(float[] values) {
323 | sensors = values;
324 | viewPresenter.doUpdateDirection((float) values[0]);
325 | }
326 |
327 | public void handleRegister() {
328 | try {
329 | doStartRegister();
330 | } catch (Exception e) {
331 | doNotify(e.getMessage());
332 | }
333 | }
334 |
335 | public void handleStop() {
336 | doStopRegister();
337 | }
338 |
339 | // ... /HANDLE
340 |
341 | private static Map> generateScanResultsMap(List scanResults) {
342 | Map> scanResultsMap = new TreeMap>();
343 | for (ScanResult scanResult : scanResults) {
344 | if (!scanResultsMap.containsKey(scanResult.SSID)) {
345 | scanResultsMap.put(scanResult.SSID, new ArrayList());
346 | }
347 | scanResultsMap.get(scanResult.SSID).add(scanResult);
348 | }
349 | return scanResultsMap;
350 | }
351 |
352 | class WifiBroadcastReceiver extends BroadcastReceiver {
353 |
354 | @Override
355 | public void onReceive(Context context, Intent intent) {
356 | handleRecievedWifiScan(wifiManager.getScanResults());
357 |
358 | if (isWifiConnected()) {
359 | wifiTimer.schedule(new TimerTask() {
360 |
361 | @Override
362 | public void run() {
363 | wifiManager.startScan();
364 | }
365 | }, delay * 1000);
366 | }
367 | }
368 |
369 | }
370 |
371 | class SensorListener implements SensorEventListener {
372 |
373 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
374 |
375 | }
376 |
377 | public void onSensorChanged(SensorEvent event) {
378 | if (event.values.length > 0) {
379 | handleRecievedSensor(event.values);
380 | }
381 | }
382 |
383 | }
384 |
385 | class SDHandler {
386 |
387 | File directory;
388 | File mapperDirectory;
389 | File mapperFile;
390 | File taggerFile;
391 | Properties taggerProperties;
392 | boolean isTagLoaded = false;
393 |
394 | public SDHandler() {
395 | directory = new File(getDirectory());
396 | mapperDirectory = new File(getMapperDirectory());
397 | taggerFile = new File(getDirectory(), "tag.txt");
398 | taggerProperties = new Properties();
399 | }
400 |
401 | // ... GET
402 |
403 | public String getDirectory() {
404 | return String.format("%s/%s", Environment.getExternalStorageDirectory().toString(), "wifimapper");
405 | }
406 |
407 | public String getMapperDirectory() {
408 | return String.format("%s/%s", getDirectory(), "mapper");
409 | }
410 |
411 | public int getMapperDirectoryCount() {
412 | return mapperDirectory.exists() ? mapperDirectory.list().length : 0;
413 | }
414 |
415 | public String getTag(String bssid) throws Exception
416 | {
417 | this.doCreateTaggerFile();
418 | if (!this.isTagLoaded){
419 | this.taggerProperties.load(new FileInputStream(this.taggerFile));
420 | this.isTagLoaded = true;
421 | }
422 | return this.taggerProperties.getProperty(bssid, "");
423 | }
424 |
425 | // ... /GET
426 |
427 | public void createMapperFile(int session, int uniqueId, int scans, int delay, String connected,
428 | String deviceInfo) throws Exception {
429 | String dateTime = android.text.format.DateFormat.format("yyyy_MM_dd_hhmm", new java.util.Date()).toString();
430 | this.mapperFile = new File(getMapperDirectory(), String.format("%s_%s_%s.txt", "" + session, "" + uniqueId,
431 | dateTime));
432 |
433 | long timestamp = System.currentTimeMillis() / 1000;
434 | doCreateMapperFile();
435 |
436 | String firstLine = String.format("#%d|%d|%s|%d|%d|%s|%s\n", session, uniqueId, "" + timestamp, scans,
437 | delay, connected, deviceInfo);
438 | doWriteToFile(this.mapperFile, firstLine);
439 | }
440 |
441 | // ... ADD
442 |
443 | public void addScanToFile(int scanNumber, List scanResults, float[] sensors) throws Exception {
444 | StringBuilder string = new StringBuilder();
445 |
446 | long timestamp = System.currentTimeMillis() / 1000;
447 | string.append(String.format("$%s|%s\n", scanNumber, "" + timestamp));
448 |
449 | string.append(String.format("?%s\n", Arrays.toString(sensors)));
450 |
451 | for (ScanResult scanResult : scanResults) {
452 | string.append(String.format("%%%s|%s|%s|%s\n", scanResult.SSID, scanResult.BSSID, scanResult.level,
453 | scanResult.frequency));
454 | }
455 |
456 | doWriteToFile(this.mapperFile, string.toString());
457 | }
458 |
459 | public void addTagtoFile(String bssid, String tag) throws IOException {
460 | this.doCreateTaggerFile();
461 |
462 | String tagExisting = this.taggerProperties.getProperty(bssid);
463 | if (tagExisting != null && tagExisting != "") {
464 | tag = tagExisting + "|" + tag;
465 | }
466 | this.taggerProperties.setProperty(bssid, tag);
467 | this.taggerProperties.store(new FileOutputStream(this.taggerFile), null);
468 | }
469 |
470 | // ... /ADD
471 |
472 | // ... DO
473 |
474 | private void doWriteToFile(File file, String string) throws IOException {
475 | FileWriter fstream = new FileWriter(file, true);
476 | BufferedWriter out = new BufferedWriter(fstream);
477 | out.write(string);
478 | out.close();
479 | }
480 |
481 | private void doCreateMapperFile() throws IOException {
482 | if (!this.mapperFile.exists()) {
483 | File folder = this.mapperFile.getParentFile();
484 | if (!folder.exists()) {
485 | folder.mkdirs();
486 | }
487 | this.mapperFile.createNewFile();
488 | }
489 | }
490 |
491 | private void doCreateTaggerFile() throws IOException {
492 | if (!this.taggerFile.exists()) {
493 | File parent = this.taggerFile.getParentFile();
494 | if (!parent.exists()) {
495 | parent.mkdirs();
496 | }
497 | this.taggerFile.createNewFile();
498 | }
499 | }
500 |
501 |
502 | // ... /DO
503 |
504 | }
505 |
506 | class ViewPresenter {
507 |
508 | private WifiMapperActivity activity;
509 | private TextView accessPointCountTextView;
510 | private TableLayout accessPointTable;
511 | private TextView directionTextView;
512 | private TextView uniqueIdTextView;
513 | private TextView statusTextView;
514 | private TextView deviceTextView;
515 | private Button registerButton;
516 | private Button stopButton;
517 | private EditText scansEditText;
518 | private EditText delayEditText;
519 | private EditText sessionEditText;
520 |
521 | public ViewPresenter(WifiMapperActivity activity) {
522 | this.activity = activity;
523 |
524 | accessPointCountTextView = (TextView) activity.findViewById(R.id.accessPointCountTextView);
525 | accessPointTable = (TableLayout) activity.findViewById(R.id.accessPointTable);
526 | directionTextView = (TextView) activity.findViewById(R.id.directionTextView);
527 | uniqueIdTextView = (TextView) activity.findViewById(R.id.uniqueIdTextView);
528 | statusTextView = (TextView) activity.findViewById(R.id.statusTextView);
529 | deviceTextView = (TextView) activity.findViewById(R.id.deviceTextView);
530 | registerButton = (Button) activity.findViewById(R.id.registerButton);
531 | stopButton = (Button) activity.findViewById(R.id.stopButton);
532 | sessionEditText = (EditText) activity.findViewById(R.id.sessionEditText);
533 | scansEditText = (EditText) activity.findViewById(R.id.scansEditText);
534 | delayEditText = (EditText) activity.findViewById(R.id.delayEditText);
535 |
536 | accessPointTable.setShrinkAllColumns(true);
537 |
538 | registerButton.setOnClickListener(new OnClickListener() {
539 |
540 | public void onClick(View v) {
541 | handleRegister();
542 | }
543 | });
544 | stopButton.setOnClickListener(new OnClickListener() {
545 |
546 | public void onClick(View v) {
547 | handleStop();
548 | }
549 | });
550 | }
551 |
552 | public void setRegisterEnabled(boolean enabled) {
553 | registerButton.setEnabled(enabled);
554 | }
555 |
556 | public void setStopEnabled(boolean enabled) {
557 | stopButton.setEnabled(enabled);
558 | }
559 |
560 | public void setSessionEnabled(boolean enabled) {
561 | sessionEditText.setEnabled(enabled);
562 | }
563 |
564 | public void setScansEnabled(boolean enabled) {
565 | scansEditText.setEnabled(enabled);
566 | }
567 |
568 | public void setDelayEnabled(boolean enabled) {
569 | delayEditText.setEnabled(enabled);
570 | }
571 |
572 | public int getSession() {
573 | try {
574 | return Integer.parseInt(sessionEditText.getText().toString());
575 | } catch (NumberFormatException e) {
576 | return 0;
577 | }
578 | }
579 |
580 | public int getScans() {
581 | try {
582 | return Integer.parseInt(scansEditText.getText().toString());
583 | } catch (NumberFormatException e) {
584 | return 0;
585 | }
586 | }
587 |
588 | public int getDelay() {
589 | try {
590 | return Integer.parseInt(delayEditText.getText().toString());
591 | } catch (NumberFormatException e) {
592 | return 0;
593 | }
594 | }
595 |
596 | public void setUniqueId(String uniqueId) {
597 | uniqueIdTextView.setText(uniqueId);
598 | }
599 |
600 | public void setStatus(String status) {
601 | statusTextView.setText(status);
602 | }
603 |
604 | public void setDevice(String device) {
605 | deviceTextView.setText(device);
606 | }
607 |
608 | public void setSession(String session) {
609 | sessionEditText.setText(session);
610 | }
611 |
612 | public void setScans(String scans) {
613 | scansEditText.setText(scans);
614 | }
615 |
616 | public void setDelay(String delay) {
617 | delayEditText.setText(delay);
618 | }
619 |
620 | public void doUpdateWifiTable(Map> scanResultsMap) {
621 | if (accessPointTable.getChildCount() > 1)
622 | accessPointTable.removeViews(1, accessPointTable.getChildCount() - 1);
623 |
624 | Set keys = scanResultsMap.keySet();
625 | for (String key : keys) {
626 | doUpdateWifiTableGroup(key, scanResultsMap.get(key));
627 | }
628 | }
629 |
630 | private void doUpdateWifiTableGroup(String key, List scanResults) {
631 | if (scanResults == null || scanResults.isEmpty())
632 | return;
633 |
634 | // Add header
635 | TableRow tableRow = new TableRow(this.activity);
636 | tableRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
637 |
638 | TextView textView = new TextView(this.activity);
639 | textView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
640 | textView.setText(key);
641 | textView.setTypeface(null, Typeface.BOLD);
642 |
643 | tableRow.addView(textView);
644 |
645 | textView = new TextView(this.activity);
646 | textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
647 | textView.setText("" + scanResults.size());
648 | textView.setGravity(Gravity.RIGHT);
649 | textView.setTypeface(null, Typeface.BOLD);
650 |
651 | tableRow.addView(textView);
652 |
653 | this.accessPointTable.addView(tableRow, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,
654 | LayoutParams.WRAP_CONTENT));
655 |
656 | // List
657 | for (ScanResult scanResult : scanResults) {
658 | doUpdateWifiTableRow(scanResult);
659 | }
660 | }
661 |
662 | private void doUpdateWifiTableRow(ScanResult scanResult) {
663 | TableRow tableRow = new TableRow(this.activity);
664 | tableRow.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
665 |
666 | // BSSID
667 | TextView textView = new TextView(this.activity);
668 | textView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
669 | textView.setText(scanResult.BSSID);
670 | tableRow.addView(textView);
671 |
672 | // Level
673 | textView = new TextView(this.activity);
674 | textView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
675 | textView.setText("" + scanResult.level);
676 | textView.setGravity(Gravity.RIGHT);
677 | tableRow.addView(textView);
678 |
679 | // Frequency
680 | textView = new TextView(this.activity);
681 | textView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
682 | textView.setText("" + scanResult.frequency);
683 | textView.setGravity(Gravity.RIGHT);
684 | tableRow.addView(textView);
685 |
686 | this.accessPointTable.addView(tableRow, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,
687 | LayoutParams.WRAP_CONTENT));
688 | }
689 |
690 | public void doUpdateWifiCount(int size) {
691 | accessPointCountTextView.setText("" + size);
692 | }
693 |
694 | public void doUpdateDirection(float direction) {
695 | directionTextView.setText("" + direction);
696 | }
697 |
698 | }
699 |
700 | }
--------------------------------------------------------------------------------