Permalink
Browse files

adding

  • Loading branch information...
0 parents commit 529cd586d9a1748772751918e74d185a51666ca8 @bobzilladev bobzilladev committed Mar 20, 2010
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
+ <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>WigleAndroid</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.android.ide.eclipse.adt.ApkBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="net.wigle.wigleandroid"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
+ <activity android:name=".WigleAndroid"
+ android:label="@string/app_name">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ </application>
+ <uses-sdk android:minSdkVersion="3" />
+
+
+<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
+
+<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
+<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
+</manifest>
@@ -0,0 +1,13 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Indicates whether an apk should be generated for each density.
+split.density=false
+# Project target.
+target=android-3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+<TextView
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/status"
+ />
+<TextView
+android:layout_width="fill_parent"
+android:layout_height="wrap_content"
+android:id="@+id/LocationTextView01"
+/>
+<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/upload_button"></Button>
+<ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></ListView>
+</LinearLayout>
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <!-- First row -->
+ <TextView android:text="ssid" android:id="@+id/ssid" android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></TextView>
+</LinearLayout>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ >
+ <!-- Second row -->
+ <TextView android:text="bssid" android:id="@+id/detail" android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></TextView>
+</LinearLayout>
+
+</LinearLayout>
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="status">Starting</string>
+ <string name="app_name">WiGLE WiFi Android 1.0</string>
+ <string name="upload_button">Upload to WiGLE.net</string>
+</resources>
@@ -0,0 +1,120 @@
+package net.wigle.wigleandroid;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import android.location.Location;
+import android.net.wifi.ScanResult;
+
+public class Network {
+ private final String bssid;
+ private final String ssid;
+ private final int frequency;
+ private final String capabilities;
+ private int level;
+ private final Set<Observation> observations = new HashSet<Observation>();
+ private final Integer channel;
+
+ private static final Map<Integer,Integer> freqToChan;
+ static {
+ Map<Integer,Integer> freqToChanTemp = new HashMap<Integer,Integer>();
+
+ freqToChanTemp.put(2412, 1);
+ freqToChanTemp.put(2417, 2);
+ freqToChanTemp.put(2422, 3);
+ freqToChanTemp.put(2427, 4);
+ freqToChanTemp.put(2432, 5);
+ freqToChanTemp.put(2437, 6);
+ freqToChanTemp.put(2442, 7);
+ freqToChanTemp.put(2447, 8);
+ freqToChanTemp.put(2452, 9);
+ freqToChanTemp.put(2457, 10);
+ freqToChanTemp.put(2462, 11);
+ freqToChanTemp.put(2467, 12);
+ freqToChanTemp.put(2472, 13);
+ freqToChanTemp.put(2484, 14);
+
+ freqToChanTemp.put(5170, 34);
+ freqToChanTemp.put(5180, 36);
+ freqToChanTemp.put(5190, 38);
+ freqToChanTemp.put(5200, 40);
+ freqToChanTemp.put(5210, 42);
+ freqToChanTemp.put(5220, 44);
+ freqToChanTemp.put(5230, 46);
+ freqToChanTemp.put(5240, 48);
+ freqToChanTemp.put(5260, 52);
+ freqToChanTemp.put(5280, 56);
+ freqToChanTemp.put(5300, 58);
+ freqToChanTemp.put(5320, 60);
+
+ freqToChanTemp.put(5500, 100);
+ freqToChanTemp.put(5520, 104);
+ freqToChanTemp.put(5540, 108);
+ freqToChanTemp.put(5560, 112);
+ freqToChanTemp.put(5570, 116);
+ freqToChanTemp.put(5600, 120);
+ freqToChanTemp.put(5620, 124);
+ freqToChanTemp.put(5640, 128);
+ freqToChanTemp.put(5660, 132);
+ freqToChanTemp.put(5680, 136);
+ freqToChanTemp.put(5700, 140);
+
+ freqToChanTemp.put(5745, 149);
+ freqToChanTemp.put(5765, 153);
+ freqToChanTemp.put(5785, 157);
+ freqToChanTemp.put(5805, 161);
+ freqToChanTemp.put(5825, 165);
+
+ freqToChan = Collections.unmodifiableMap( freqToChanTemp );
+ }
+
+ public Network( ScanResult scanResult ) {
+ this.bssid = scanResult.BSSID;
+ this.ssid = scanResult.SSID;
+ this.frequency = scanResult.frequency;
+ this.capabilities = scanResult.capabilities;
+ this.level = scanResult.level;
+ this.channel = freqToChan.get( frequency );
+ }
+
+ public String getBssid() {
+ return bssid;
+ }
+
+ public String getSsid() {
+ return ssid;
+ }
+
+ public int getFrequency() {
+ return frequency;
+ }
+
+ public String getCapabilities() {
+ return capabilities;
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public Set<Observation> getObservations() {
+ return observations;
+ }
+
+ public Integer getChannel() {
+ return channel;
+ }
+
+ public void addObservation( int level, Location location ) {
+ this.level = level;
+
+ if ( location != null ) {
+ Observation observation = new Observation( level, location );
+ observations.add( observation );
+ }
+ }
+
+}
@@ -0,0 +1,66 @@
+package net.wigle.wigleandroid;
+
+import android.location.Location;
+
+public class Observation {
+ private final int level;
+ private final double lat;
+ private final double lon;
+ private final double alt;
+ private final float accuracy;
+ private final long time;
+
+ public Observation( int level, Location location ) {
+ this.level = level;
+ this.lat = location.getLatitude();
+ this.lon = location.getLongitude();
+ this.alt = location.getAltitude();
+ this.accuracy = location.getAccuracy();
+ this.time = location.getTime();
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public double getLat() {
+ return lat;
+ }
+
+ public double getLon() {
+ return lon;
+ }
+
+ public double getAlt() {
+ return alt;
+ }
+
+ public float getAccuracy() {
+ return accuracy;
+ }
+
+ public long getTime() {
+ return time;
+ }
+
+ @Override
+ public boolean equals( Object other ) {
+ if ( other instanceof Observation ) {
+ Observation o = (Observation) other;
+ return level == o.level
+ && lat == o.lat
+ && lon == o.lon;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ int retval = 17;
+ retval += 37 * level;
+ retval += 37 * lat;
+ retval += 37 * lon;
+ return retval;
+ }
+
+}
Oops, something went wrong.

0 comments on commit 529cd58

Please sign in to comment.