summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.classpath (renamed from client/Piztor/.classpath)0
-rw-r--r--.project (renamed from client/Piztor/.project)0
-rw-r--r--.settings/org.eclipse.jdt.core.prefs (renamed from client/Piztor/.settings/org.eclipse.jdt.core.prefs)0
-rw-r--r--client/AndroidManifest.xml (renamed from client/Piztor/AndroidManifest.xml)0
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.classbin2797 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.classbin328 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.classbin1412 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.classbin4548 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.classbin347 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.classbin471 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/InitAct.classbin1136 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.classbin2205 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$attr.classbin343 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.classbin464 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.classbin1399 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$id.classbin2291 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$layout.classbin823 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$menu.classbin479 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$string.classbin937 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R$style.classbin434 -> 0 bytes
-rw-r--r--client/Piztor/bin/classes/com/macaroon/piztor/R.classbin683 -> 0 bytes
-rw-r--r--client/Piztor/ic_launcher-web.pngbin51394 -> 0 bytes
-rw-r--r--client/Piztor/res/drawable-hdpi/ic_launcher.pngbin7658 -> 0 bytes
-rw-r--r--client/Piztor/res/drawable-mdpi/ic_launcher.pngbin3777 -> 0 bytes
-rw-r--r--client/Piztor/res/drawable-xhdpi/ic_launcher.pngbin12516 -> 0 bytes
-rw-r--r--client/Piztor/res/drawable-xxhdpi/ic_launcher.pngbin24777 -> 0 bytes
-rw-r--r--client/README.rst1
-rw-r--r--client/Socket-demo/Login.java6
-rw-r--r--client/Socket-demo/MainActivity.java44
-rw-r--r--client/Socket-demo/Myrequest.java10
-rw-r--r--client/Socket-demo/Myrespond.java12
-rw-r--r--client/Socket-demo/SocketClient.java107
-rw-r--r--client/Socket-demo/Transam.java125
-rw-r--r--client/bin/AndroidManifest.xml (renamed from client/Piztor/bin/AndroidManifest.xml)0
-rw-r--r--client/bin/Piztor.apkbin0 -> 1009696 bytes
-rw-r--r--client/bin/classes.dexbin0 -> 654056 bytes
-rw-r--r--client/bin/dexedLibs/android-support-v4-7d1c360a45ec8a3e1ddee5ade49de497.jarbin0 -> 211326 bytes
-rw-r--r--client/bin/jarlist.cache (renamed from client/gps-demo/AndroidGPSTracking/bin/jarlist.cache)0
-rw-r--r--client/bin/res/drawable-hdpi/ic_launcher.pngbin0 -> 5964 bytes
-rw-r--r--client/bin/res/drawable-mdpi/ic_launcher.pngbin0 -> 3112 bytes
-rw-r--r--client/bin/res/drawable-xhdpi/ic_launcher.pngbin0 -> 9355 bytes
-rw-r--r--client/bin/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 17889 bytes
-rw-r--r--client/bin/res/drawable/bottom_img.pngbin0 -> 526288 bytes
-rw-r--r--client/bin/res/drawable/footbar_background.pngbin0 -> 22626 bytes
-rw-r--r--client/bin/res/drawable/footbar_checkin.pngbin0 -> 253 bytes
-rw-r--r--client/bin/res/drawable/footbar_checkin_1.pngbin0 -> 2958 bytes
-rw-r--r--client/bin/res/drawable/footbar_fetch.pngbin0 -> 1800 bytes
-rw-r--r--client/bin/res/drawable/footbar_fetch_1.pngbin0 -> 2744 bytes
-rw-r--r--client/bin/res/drawable/footbar_marker.pngbin0 -> 986 bytes
-rw-r--r--client/bin/res/drawable/footbar_marker_1.pngbin0 -> 2862 bytes
-rw-r--r--client/bin/res/drawable/footbar_search.pngbin0 -> 1327 bytes
-rw-r--r--client/bin/res/drawable/footbar_search_1.pngbin0 -> 3137 bytes
-rw-r--r--client/bin/res/drawable/footbar_select_bg.pngbin0 -> 8879 bytes
-rw-r--r--client/bin/res/drawable/footbar_settings.pngbin0 -> 1100 bytes
-rw-r--r--client/bin/res/drawable/footbar_settings_1.pngbin0 -> 3003 bytes
-rw-r--r--client/bin/res/drawable/footbar_unselect_bg.pngbin0 -> 119 bytes
-rw-r--r--client/bin/res/drawable/horizontal_line.pngbin0 -> 705 bytes
-rw-r--r--client/bin/res/drawable/navigation_back.pngbin0 -> 397 bytes
-rw-r--r--client/bin/res/drawable/navigation_back_1.pngbin0 -> 170 bytes
-rw-r--r--client/bin/res/drawable/title_logo.pngbin0 -> 116965 bytes
-rw-r--r--client/bin/res/drawable/topbar_background.pngbin0 -> 23541 bytes
-rw-r--r--client/bin/resources.ap_bin0 -> 781019 bytes
-rw-r--r--client/gen/com/macaroon/piztor/BuildConfig.java (renamed from client/Piztor/gen/com/macaroon/piztor/BuildConfig.java)0
-rw-r--r--client/gen/com/macaroon/piztor/R.java164
-rw-r--r--client/gps-demo/AndroidGPSTracking/.AndroidManifest.xml.swpbin12288 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/.classpath9
-rw-r--r--client/gps-demo/AndroidGPSTracking/.project33
-rw-r--r--client/gps-demo/AndroidGPSTracking/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--client/gps-demo/AndroidGPSTracking/AndroidManifest.xml26
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/AndroidGPSTracking.apkbin16993 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/AndroidManifest.xml26
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes.dexbin9188 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity$1.classbin1809 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity.classbin1119 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/BuildConfig.classbin355 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$1.classbin1206 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$2.classbin879 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker.classbin4488 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$attr.classbin355 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$drawable.classbin422 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$id.classbin408 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$layout.classbin409 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$string.classbin442 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R.classbin566 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/dexedLibs/annotations-5b022f4578500e25e3bfa446659bd7d8.jarbin943 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/res/drawable-hdpi/ic_launcher.pngbin3966 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/res/drawable-ldpi/ic_launcher.pngbin1537 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/res/drawable-mdpi/ic_launcher.pngbin2200 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/bin/resources.ap_bin10818 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/default.properties2
-rw-r--r--client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/BuildConfig.java6
-rw-r--r--client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/R.java26
-rw-r--r--client/gps-demo/AndroidGPSTracking/proguard.cfg40
-rw-r--r--client/gps-demo/AndroidGPSTracking/project.properties11
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/drawable-hdpi/ic_launcher.pngbin10224 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/drawable-ldpi/ic_launcher.pngbin10224 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/drawable-mdpi/ic_launcher.pngbin10224 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/drawable-xhdpi/ic_launcher.pngbin10224 -> 0 bytes
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/layout/main.xml14
-rw-r--r--client/gps-demo/AndroidGPSTracking/res/values/strings.xml7
-rw-r--r--client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/AndroidGPSTrackingActivity.java50
-rw-r--r--client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java33
-rw-r--r--client/ic_launcher-web.pngbin0 -> 130248 bytes
-rw-r--r--client/libs/android-support-v4.jar (renamed from client/Piztor/libs/android-support-v4.jar)bin556198 -> 556198 bytes
-rw-r--r--client/proguard-project.txt (renamed from client/Piztor/proguard-project.txt)0
-rw-r--r--client/project.properties (renamed from client/Piztor/project.properties)0
-rw-r--r--client/res/drawable-hdpi/ic_launcher.pngbin0 -> 6165 bytes
-rw-r--r--client/res/drawable-mdpi/ic_launcher.pngbin0 -> 3245 bytes
-rw-r--r--client/res/drawable-xhdpi/ic_launcher.pngbin0 -> 9545 bytes
-rw-r--r--client/res/drawable-xxhdpi/ic_launcher.pngbin0 -> 17793 bytes
-rw-r--r--client/res/drawable/bottom_img.pngbin0 -> 525331 bytes
-rw-r--r--client/res/drawable/footbar_background.pngbin0 -> 23943 bytes
-rw-r--r--client/res/drawable/footbar_btn_checkin_style.xml7
-rw-r--r--client/res/drawable/footbar_btn_fetch_style.xml6
-rw-r--r--client/res/drawable/footbar_btn_focus_style.xml6
-rw-r--r--client/res/drawable/footbar_btn_search_style.xml6
-rw-r--r--client/res/drawable/footbar_btn_settings_style.xml6
-rw-r--r--client/res/drawable/footbar_checkin.pngbin0 -> 468 bytes
-rw-r--r--client/res/drawable/footbar_checkin_1.pngbin0 -> 3371 bytes
-rw-r--r--client/res/drawable/footbar_fetch.pngbin0 -> 2541 bytes
-rw-r--r--client/res/drawable/footbar_fetch_1.pngbin0 -> 3093 bytes
-rw-r--r--client/res/drawable/footbar_marker.pngbin0 -> 1866 bytes
-rw-r--r--client/res/drawable/footbar_marker_1.pngbin0 -> 3288 bytes
-rw-r--r--client/res/drawable/footbar_search.pngbin0 -> 2127 bytes
-rw-r--r--client/res/drawable/footbar_search_1.pngbin0 -> 3589 bytes
-rw-r--r--client/res/drawable/footbar_select_bg.pngbin0 -> 8919 bytes
-rw-r--r--client/res/drawable/footbar_settings.pngbin0 -> 1372 bytes
-rw-r--r--client/res/drawable/footbar_settings_1.pngbin0 -> 3442 bytes
-rw-r--r--client/res/drawable/footbar_unselect_bg.pngbin0 -> 165 bytes
-rw-r--r--client/res/drawable/horizontal_line.pngbin0 -> 796 bytes
-rw-r--r--client/res/drawable/navigation_back.pngbin0 -> 1324 bytes
-rw-r--r--client/res/drawable/navigation_back_1.pngbin0 -> 401 bytes
-rw-r--r--client/res/drawable/title_logo.pngbin0 -> 1031640 bytes
-rw-r--r--client/res/drawable/topbar_background.pngbin0 -> 23763 bytes
-rw-r--r--client/res/layout/activity_gather.xml23
-rw-r--r--client/res/layout/activity_init.xml (renamed from client/Piztor/res/layout/activity_init.xml)0
-rw-r--r--client/res/layout/activity_login.xml92
-rw-r--r--client/res/layout/activity_main.xml23
-rw-r--r--client/res/layout/activity_settings.xml149
-rw-r--r--client/res/layout/gather_footbar.xml133
-rw-r--r--client/res/layout/gather_timer.xml16
-rw-r--r--client/res/layout/login_bottom.xml13
-rw-r--r--client/res/layout/main_footbar.xml107
-rw-r--r--client/res/layout/main_headbar.xml29
-rw-r--r--client/res/layout/settings_headbar.xml29
-rw-r--r--client/res/menu/init.xml (renamed from client/Piztor/res/menu/init.xml)0
-rw-r--r--client/res/menu/login.xml (renamed from client/Piztor/res/menu/main.xml)0
-rw-r--r--client/res/menu/main.xml9
-rw-r--r--client/res/menu/setting.xml9
-rw-r--r--client/res/values-sw600dp/dimens.xml (renamed from client/Piztor/res/values-sw600dp/dimens.xml)0
-rw-r--r--client/res/values-sw720dp-land/dimens.xml (renamed from client/Piztor/res/values-sw720dp-land/dimens.xml)0
-rw-r--r--client/res/values-v11/styles.xml (renamed from client/Piztor/res/values-v11/styles.xml)0
-rw-r--r--client/res/values-v14/styles.xml (renamed from client/Piztor/res/values-v14/styles.xml)0
-rw-r--r--client/res/values/dimens.xml (renamed from client/Piztor/res/values/dimens.xml)0
-rw-r--r--client/res/values/strings.xml21
-rw-r--r--client/res/values/styles.xml (renamed from client/Piztor/res/values/styles.xml)0
-rw-r--r--client/src/com/macaroon/piztor/ActMgr.java (renamed from client/Piztor/src/com/macaroon/piztor/ActMgr.java)0
-rw-r--r--client/src/com/macaroon/piztor/AppMgr.java (renamed from client/Piztor/src/com/macaroon/piztor/AppMgr.java)0
-rw-r--r--client/src/com/macaroon/piztor/GPSTracker.java (renamed from client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/GPSTracker.java)177
-rw-r--r--client/src/com/macaroon/piztor/InitAct.java (renamed from client/Piztor/src/com/macaroon/piztor/InitAct.java)4
-rw-r--r--client/src/com/macaroon/piztor/Login.java104
-rw-r--r--client/src/com/macaroon/piztor/Main.java51
-rw-r--r--client/src/com/macaroon/piztor/PiztorAct.java (renamed from client/Piztor/src/com/macaroon/piztor/PiztorAct.java)0
-rw-r--r--client/src/com/macaroon/piztor/PiztorExcepiton.java10
-rw-r--r--client/src/com/macaroon/piztor/Req.java14
-rw-r--r--client/src/com/macaroon/piztor/ReqLocation.java14
-rw-r--r--client/src/com/macaroon/piztor/ReqLogin.java16
-rw-r--r--client/src/com/macaroon/piztor/ReqUpdate.java16
-rw-r--r--client/src/com/macaroon/piztor/Res.java11
-rw-r--r--client/src/com/macaroon/piztor/ResLocation.java18
-rw-r--r--client/src/com/macaroon/piztor/ResLogin.java15
-rw-r--r--client/src/com/macaroon/piztor/ResUpdate.java13
-rw-r--r--client/src/com/macaroon/piztor/Rlocation.java13
-rw-r--r--client/src/com/macaroon/piztor/Setting.java31
-rw-r--r--client/src/com/macaroon/piztor/Settings.java22
-rw-r--r--client/src/com/macaroon/piztor/SocketClient.java107
-rw-r--r--client/src/com/macaroon/piztor/Tracker.java68
-rw-r--r--client/src/com/macaroon/piztor/Transam.java139
-rw-r--r--client/src/com/macaroon/piztor/UserInfo.java7
-rw-r--r--features18
-rw-r--r--preview.jpgbin305791 -> 0 bytes
-rw-r--r--schedule.rst21
-rw-r--r--server/README.rst1
-rw-r--r--server/client.py58
-rw-r--r--server/piztor/exc.py5
-rw-r--r--server/piztor/import.py7
-rw-r--r--server/piztor/model.py6
-rw-r--r--server/piztor/prob.py81
-rw-r--r--server/piztor/ptp.rst135
-rw-r--r--server/piztor/server.py321
-rw-r--r--server/piztor_server.py234
-rw-r--r--server/ptp.rst93
-rw-r--r--server/rush.py14
193 files changed, 2178 insertions, 1106 deletions
diff --git a/client/Piztor/.classpath b/.classpath
index 7bc01d9..7bc01d9 100644
--- a/client/Piztor/.classpath
+++ b/.classpath
diff --git a/client/Piztor/.project b/.project
index 97100ec..97100ec 100644
--- a/client/Piztor/.project
+++ b/.project
diff --git a/client/Piztor/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index b080d2d..b080d2d 100644
--- a/client/Piztor/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
diff --git a/client/Piztor/AndroidManifest.xml b/client/AndroidManifest.xml
index b18d8e2..b18d8e2 100644
--- a/client/Piztor/AndroidManifest.xml
+++ b/client/AndroidManifest.xml
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class b/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class
deleted file mode 100644
index 786ec1d..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/ActMgr.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class
deleted file mode 100644
index 15cc794..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/ActStatus.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class
deleted file mode 100644
index f11e546..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr$ActivityStatus.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class b/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class
deleted file mode 100644
index 41f9ead..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/AppMgr.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.class b/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.class
deleted file mode 100644
index 566eb01..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/BuildConfig.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class b/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class
deleted file mode 100644
index 74aa729..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/EmptyStatus.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class b/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class
deleted file mode 100644
index 487831d..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/InitAct.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class b/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class
deleted file mode 100644
index 4a3fc81..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/PiztorAct.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class
deleted file mode 100644
index a95e1ab..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$attr.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.class
deleted file mode 100644
index 4bc657f..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$dimen.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class
deleted file mode 100644
index b31a626..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$drawable.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class
deleted file mode 100644
index e08c969..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$id.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class
deleted file mode 100644
index de25e3c..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$layout.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class
deleted file mode 100644
index 7f7cacb..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$menu.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class
deleted file mode 100644
index 65d1b80..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$string.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class b/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class
deleted file mode 100644
index 052dd30..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R$style.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/bin/classes/com/macaroon/piztor/R.class b/client/Piztor/bin/classes/com/macaroon/piztor/R.class
deleted file mode 100644
index d173856..0000000
--- a/client/Piztor/bin/classes/com/macaroon/piztor/R.class
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/ic_launcher-web.png b/client/Piztor/ic_launcher-web.png
deleted file mode 100644
index a18cbb4..0000000
--- a/client/Piztor/ic_launcher-web.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/res/drawable-hdpi/ic_launcher.png b/client/Piztor/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 288b665..0000000
--- a/client/Piztor/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/res/drawable-mdpi/ic_launcher.png b/client/Piztor/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 6ae570b..0000000
--- a/client/Piztor/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/res/drawable-xhdpi/ic_launcher.png b/client/Piztor/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index d4fb7cd..0000000
--- a/client/Piztor/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/Piztor/res/drawable-xxhdpi/ic_launcher.png b/client/Piztor/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 85a6081..0000000
--- a/client/Piztor/res/drawable-xxhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/README.rst b/client/README.rst
deleted file mode 100644
index ef377cc..0000000
--- a/client/README.rst
+++ /dev/null
@@ -1 +0,0 @@
-Here is the folder of android app implementation
diff --git a/client/Socket-demo/Login.java b/client/Socket-demo/Login.java
deleted file mode 100644
index 2dd386c..0000000
--- a/client/Socket-demo/Login.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.example.test;
-
-public class Login{
- void success(int t){}
- void failed(){}
-} \ No newline at end of file
diff --git a/client/Socket-demo/MainActivity.java b/client/Socket-demo/MainActivity.java
deleted file mode 100644
index ab2ef0c..0000000
--- a/client/Socket-demo/MainActivity.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.example.test;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.View;
-import android.widget.TextView;
-
-public class MainActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- TextView textview = (TextView)findViewById(R.id.textView1);
- textview.setText("Server Created!");
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
-
- public void sendMessage(View view) {
-
- }
-
-
-
-
-
-
-
-
-}
-
-
-
-
-
-
diff --git a/client/Socket-demo/Myrequest.java b/client/Socket-demo/Myrequest.java
deleted file mode 100644
index e5bfce2..0000000
--- a/client/Socket-demo/Myrequest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.example.test;
-
-import java.util.Vector;
-
-public class Myrequest{
- public Vector<Object> contain;
- Myrequest(){
- contain = new Vector<Object>();
- }
-} \ No newline at end of file
diff --git a/client/Socket-demo/Myrespond.java b/client/Socket-demo/Myrespond.java
deleted file mode 100644
index ea6ef3b..0000000
--- a/client/Socket-demo/Myrespond.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.example.test;
-
-import java.util.Vector;
-
-public class Myrespond{
- public Vector<Object> contain;
- public String wrong;
- Myrespond(){
- wrong = null;
- contain = new Vector<Object>();
- }
-} \ No newline at end of file
diff --git a/client/Socket-demo/SocketClient.java b/client/Socket-demo/SocketClient.java
deleted file mode 100644
index df42484..0000000
--- a/client/Socket-demo/SocketClient.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package com.example.test;
-
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-public class SocketClient {
-
- static Socket client;
-
- public SocketClient(String site, int port)throws UnknownHostException,IOException{
- try{
- client = new Socket(site,port);
- }catch (UnknownHostException e){
- throw e;
- }catch (IOException e){
- throw e;
- }
- }
-
- public Myrespond sendMsg(Myrequest req)throws IOException{
- try{
- DataOutputStream out = new DataOutputStream(client.getOutputStream());
- int tmp = (Integer) req.contain.get(0);
- switch(tmp){
- case 0:
- String id = (String) req.contain.get(1);
- String pass = (String) req.contain.get(2);
- out.writeUTF(id);
- out.writeUTF(pass);
- break;
- case 1:
- int tk1 = (Integer) req.contain.get(1);
- int acc = (Integer) req.contain.get(2);
- String mess = (String) req.contain.get(3);
- out.writeInt(tk1);
- out.writeInt(acc);
- out.writeUTF(mess);
- break;
- case 2:
- int tk2 = (Integer) req.contain.get(1);
- double slot = (Double) req.contain.get(2);
- double slat = (Double) req.contain.get(3);
- out.writeInt(tk2);
- out.writeDouble(slot);
- out.writeDouble(slat);
- break;
- case 3:
- int tk3 = (Integer) req.contain.get(1);
- int gid = (Integer) req.contain.get(2);
- out.writeInt(tk3);
- out.writeInt(gid);
- break;
- }
- out.flush();
- client.shutdownOutput();
- DataInputStream in = new DataInputStream(client.getInputStream());
- int type = in.readUnsignedByte();
- Myrespond r = new Myrespond();
- switch(type){
- case 0:
- int id = in.readInt();
- int status = in.readUnsignedByte();
- r.contain.add(0);
- r.contain.add(id);
- r.contain.add(status);
- break;
- case 1:
- r.contain.add(1);
- //reserved
- break;
- case 2:
- r.contain.add(2);
- //reserved
- break;
- case 3:
- int n = in.readInt();
- r.contain.add(3);
- r.contain.add(n);
- for(int i=1;i<=n;i++)
- {
- int tid = in.readInt();
- double lot = in.readDouble();
- double lat = in.readDouble();
- r.contain.add(tid);
- r.contain.add(lot);
- r.contain.add(lat);
- }
- break;
- }
- return r;
- }catch(IOException e){
- throw e;
- }
- }
- public void closeSocket(){
- try{
- client.close();
- }catch(IOException e){
- e.printStackTrace();
- }
- }
-
-}
diff --git a/client/Socket-demo/Transam.java b/client/Socket-demo/Transam.java
deleted file mode 100644
index b5e2381..0000000
--- a/client/Socket-demo/Transam.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.example.test;
-
-import java.io.IOException;
-import java.net.UnknownHostException;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import android.annotation.SuppressLint;
-import android.os.Handler;
-import android.os.Message;
-
-public class Transam implements Runnable {
- public Timer timer;
- public boolean flag = true;
- public boolean reqlog = false;
- public int cnt = 4;
- public int port;
- public String ip;
- Thread thread;
- Myrequest req;
- Myrespond res;
- Controller core;
- Login log;
-
-
- Transam(String i,int p,Myrequest r,Login l){
- port = p;
- ip = i;
- req = r;
- log = l;
- reqlog = true;
- }
-
- Transam(String i,int p,Myrequest r,Controller c){
- port = p;
- ip = i;
- req = r;
- core = c;
- }
-
- public void run() {
- final thd t = new thd();
- flag = false;
- thread = new Thread(t);
- cnt = 4;
- thread.start();
- timer = new Timer();
- TimerTask task = new Timertk();
- timer.schedule(task,2000,2000);
- }
-
- class thd implements Runnable {
- @Override
- public void run() {
- try{
- SocketClient client = new SocketClient(ip,port);
- res = client.sendMsg(req);
- if(!reqlog){
- core.recieveInfo(res);
- }
- else{
- if((Integer) res.contain.get(2)==0){
- int t = (Integer) res.contain.get(1);
- log.success(t);
- }
- else{
- log.failed();
- }
- }
- Message msg = new Message();
- msg.what = 1;
- handler.sendMessage(msg);
- client.closeSocket();
- }catch (UnknownHostException e){
- }catch (IOException e){
- }
-
- }
- }
-
- @SuppressLint("HandlerLeak")
- Handler handler = new Handler(){
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 1:
- flag = true;
- break;
- case 2:
- if(!reqlog){
- res = new Myrespond();
- res.wrong = msg.obj.toString();
- core.recieveInfo(res);
- }
- else{
- log.failed();
- }
- break;
- case 3:
- final thd t = new thd();
- thread = new Thread(t);
- thread.start();
- break;
- }
- super.handleMessage(msg);
- }
- };
-
- class Timertk extends TimerTask {
- public void run() {
- if(flag==false&&cnt>0){
- cnt--;
- }
- else if(cnt==0) {
- Message msg = new Message();
- msg.obj = "connecting failed";
- msg.what = 2;
- handler.sendMessage(msg);
- timer.cancel();
- }
- else if(flag==true){
- timer.cancel();
- }
- }
- };
-} \ No newline at end of file
diff --git a/client/Piztor/bin/AndroidManifest.xml b/client/bin/AndroidManifest.xml
index b18d8e2..b18d8e2 100644
--- a/client/Piztor/bin/AndroidManifest.xml
+++ b/client/bin/AndroidManifest.xml
diff --git a/client/bin/Piztor.apk b/client/bin/Piztor.apk
new file mode 100644
index 0000000..0f2501f
--- /dev/null
+++ b/client/bin/Piztor.apk
Binary files differ
diff --git a/client/bin/classes.dex b/client/bin/classes.dex
new file mode 100644
index 0000000..5380f3b
--- /dev/null
+++ b/client/bin/classes.dex
Binary files differ
diff --git a/client/bin/dexedLibs/android-support-v4-7d1c360a45ec8a3e1ddee5ade49de497.jar b/client/bin/dexedLibs/android-support-v4-7d1c360a45ec8a3e1ddee5ade49de497.jar
new file mode 100644
index 0000000..ba5b46c
--- /dev/null
+++ b/client/bin/dexedLibs/android-support-v4-7d1c360a45ec8a3e1ddee5ade49de497.jar
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/jarlist.cache b/client/bin/jarlist.cache
index 0565465..0565465 100644
--- a/client/gps-demo/AndroidGPSTracking/bin/jarlist.cache
+++ b/client/bin/jarlist.cache
diff --git a/client/bin/res/drawable-hdpi/ic_launcher.png b/client/bin/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..efa7c5f
--- /dev/null
+++ b/client/bin/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/client/bin/res/drawable-mdpi/ic_launcher.png b/client/bin/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..ec27f2e
--- /dev/null
+++ b/client/bin/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/client/bin/res/drawable-xhdpi/ic_launcher.png b/client/bin/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..92fc57d
--- /dev/null
+++ b/client/bin/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/client/bin/res/drawable-xxhdpi/ic_launcher.png b/client/bin/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..b6f8f4e
--- /dev/null
+++ b/client/bin/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/client/bin/res/drawable/bottom_img.png b/client/bin/res/drawable/bottom_img.png
new file mode 100644
index 0000000..ee34eb0
--- /dev/null
+++ b/client/bin/res/drawable/bottom_img.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_background.png b/client/bin/res/drawable/footbar_background.png
new file mode 100644
index 0000000..d0ad14f
--- /dev/null
+++ b/client/bin/res/drawable/footbar_background.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_checkin.png b/client/bin/res/drawable/footbar_checkin.png
new file mode 100644
index 0000000..9d9ccd0
--- /dev/null
+++ b/client/bin/res/drawable/footbar_checkin.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_checkin_1.png b/client/bin/res/drawable/footbar_checkin_1.png
new file mode 100644
index 0000000..a14f872
--- /dev/null
+++ b/client/bin/res/drawable/footbar_checkin_1.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_fetch.png b/client/bin/res/drawable/footbar_fetch.png
new file mode 100644
index 0000000..a5e9bd3
--- /dev/null
+++ b/client/bin/res/drawable/footbar_fetch.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_fetch_1.png b/client/bin/res/drawable/footbar_fetch_1.png
new file mode 100644
index 0000000..214b712
--- /dev/null
+++ b/client/bin/res/drawable/footbar_fetch_1.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_marker.png b/client/bin/res/drawable/footbar_marker.png
new file mode 100644
index 0000000..e408cf8
--- /dev/null
+++ b/client/bin/res/drawable/footbar_marker.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_marker_1.png b/client/bin/res/drawable/footbar_marker_1.png
new file mode 100644
index 0000000..1262bda
--- /dev/null
+++ b/client/bin/res/drawable/footbar_marker_1.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_search.png b/client/bin/res/drawable/footbar_search.png
new file mode 100644
index 0000000..1169b79
--- /dev/null
+++ b/client/bin/res/drawable/footbar_search.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_search_1.png b/client/bin/res/drawable/footbar_search_1.png
new file mode 100644
index 0000000..9dd9611
--- /dev/null
+++ b/client/bin/res/drawable/footbar_search_1.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_select_bg.png b/client/bin/res/drawable/footbar_select_bg.png
new file mode 100644
index 0000000..3de79d6
--- /dev/null
+++ b/client/bin/res/drawable/footbar_select_bg.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_settings.png b/client/bin/res/drawable/footbar_settings.png
new file mode 100644
index 0000000..040a673
--- /dev/null
+++ b/client/bin/res/drawable/footbar_settings.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_settings_1.png b/client/bin/res/drawable/footbar_settings_1.png
new file mode 100644
index 0000000..05db6fb
--- /dev/null
+++ b/client/bin/res/drawable/footbar_settings_1.png
Binary files differ
diff --git a/client/bin/res/drawable/footbar_unselect_bg.png b/client/bin/res/drawable/footbar_unselect_bg.png
new file mode 100644
index 0000000..fe14eb2
--- /dev/null
+++ b/client/bin/res/drawable/footbar_unselect_bg.png
Binary files differ
diff --git a/client/bin/res/drawable/horizontal_line.png b/client/bin/res/drawable/horizontal_line.png
new file mode 100644
index 0000000..e56695f
--- /dev/null
+++ b/client/bin/res/drawable/horizontal_line.png
Binary files differ
diff --git a/client/bin/res/drawable/navigation_back.png b/client/bin/res/drawable/navigation_back.png
new file mode 100644
index 0000000..901ba07
--- /dev/null
+++ b/client/bin/res/drawable/navigation_back.png
Binary files differ
diff --git a/client/bin/res/drawable/navigation_back_1.png b/client/bin/res/drawable/navigation_back_1.png
new file mode 100644
index 0000000..59f6260
--- /dev/null
+++ b/client/bin/res/drawable/navigation_back_1.png
Binary files differ
diff --git a/client/bin/res/drawable/title_logo.png b/client/bin/res/drawable/title_logo.png
new file mode 100644
index 0000000..d167c79
--- /dev/null
+++ b/client/bin/res/drawable/title_logo.png
Binary files differ
diff --git a/client/bin/res/drawable/topbar_background.png b/client/bin/res/drawable/topbar_background.png
new file mode 100644
index 0000000..851f92f
--- /dev/null
+++ b/client/bin/res/drawable/topbar_background.png
Binary files differ
diff --git a/client/bin/resources.ap_ b/client/bin/resources.ap_
new file mode 100644
index 0000000..4f91148
--- /dev/null
+++ b/client/bin/resources.ap_
Binary files differ
diff --git a/client/Piztor/gen/com/macaroon/piztor/BuildConfig.java b/client/gen/com/macaroon/piztor/BuildConfig.java
index 833e650..833e650 100644
--- a/client/Piztor/gen/com/macaroon/piztor/BuildConfig.java
+++ b/client/gen/com/macaroon/piztor/BuildConfig.java
diff --git a/client/gen/com/macaroon/piztor/R.java b/client/gen/com/macaroon/piztor/R.java
new file mode 100644
index 0000000..3d07e1d
--- /dev/null
+++ b/client/gen/com/macaroon/piztor/R.java
@@ -0,0 +1,164 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package com.macaroon.piztor;
+
+public final class R {
+ public static final class attr {
+ }
+ public static final class dimen {
+ /** Default screen margins, per the Android Design guidelines.
+
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+
+ */
+ public static final int activity_horizontal_margin=0x7f040000;
+ public static final int activity_vertical_margin=0x7f040001;
+ }
+ public static final class drawable {
+ public static final int bottom_img=0x7f020000;
+ public static final int footbar_background=0x7f020001;
+ public static final int footbar_btn_checkin_style=0x7f020002;
+ public static final int footbar_btn_fetch_style=0x7f020003;
+ public static final int footbar_btn_focus_style=0x7f020004;
+ public static final int footbar_btn_search_style=0x7f020005;
+ public static final int footbar_btn_settings_style=0x7f020006;
+ public static final int footbar_checkin=0x7f020007;
+ public static final int footbar_checkin_1=0x7f020008;
+ public static final int footbar_fetch=0x7f020009;
+ public static final int footbar_fetch_1=0x7f02000a;
+ public static final int footbar_marker=0x7f02000b;
+ public static final int footbar_marker_1=0x7f02000c;
+ public static final int footbar_search=0x7f02000d;
+ public static final int footbar_search_1=0x7f02000e;
+ public static final int footbar_select_bg=0x7f02000f;
+ public static final int footbar_settings=0x7f020010;
+ public static final int footbar_settings_1=0x7f020011;
+ public static final int footbar_unselect_bg=0x7f020012;
+ public static final int horizontal_line=0x7f020013;
+ public static final int ic_launcher=0x7f020014;
+ public static final int navigation_back=0x7f020015;
+ public static final int navigation_back_1=0x7f020016;
+ public static final int title_logo=0x7f020017;
+ public static final int topbar_background=0x7f020018;
+ }
+ public static final class id {
+ public static final int action_settings=0x7f08002c;
+ public static final int footbar_btn_checkin=0x7f08001f;
+ public static final int footbar_btn_checkin_layout=0x7f08001e;
+ public static final int footbar_btn_checkin_text=0x7f080020;
+ public static final int footbar_btn_fetch=0x7f08001c;
+ public static final int footbar_btn_fetch_layout=0x7f08001b;
+ public static final int footbar_btn_fetch_text=0x7f08001d;
+ public static final int footbar_btn_focus=0x7f080022;
+ public static final int footbar_btn_focus_layout=0x7f080021;
+ public static final int footbar_btn_focus_text=0x7f080023;
+ public static final int footbar_btn_search=0x7f080019;
+ public static final int footbar_btn_search_layout=0x7f080018;
+ public static final int footbar_btn_search_text=0x7f08001a;
+ public static final int footbar_btn_settings=0x7f080025;
+ public static final int footbar_btn_settings_layout=0x7f080024;
+ public static final int footbar_btn_settings_text=0x7f080027;
+ public static final int gather_footbar_layout=0x7f080001;
+ public static final int gather_timer=0x7f080026;
+ public static final int gather_timer_layout=0x7f080000;
+ public static final int headbar_appname=0x7f080029;
+ public static final int headbar_logo=0x7f080028;
+ public static final int login_btn_login=0x7f080007;
+ public static final int main_footbar_layout=0x7f080009;
+ public static final int main_headbar_img=0x7f080002;
+ public static final int main_headbar_layout=0x7f080008;
+ public static final int settings_GPSrefreshrate=0x7f08000c;
+ public static final int settings_GPSrefreshrate_text=0x7f08000b;
+ public static final int settings_btn_back=0x7f08002a;
+ public static final int settings_headbar_layout=0x7f08000a;
+ public static final int settings_headbar_text=0x7f08002b;
+ public static final int settings_seperator1=0x7f08000d;
+ public static final int settings_seperator2=0x7f080012;
+ public static final int settings_seperator3=0x7f080017;
+ public static final int settings_sex_layout=0x7f08000e;
+ public static final int settings_sex_text=0x7f08000f;
+ public static final int settings_show_female=0x7f080011;
+ public static final int settings_show_male=0x7f080010;
+ public static final int settings_team_all=0x7f080016;
+ public static final int settings_team_layout=0x7f080013;
+ public static final int settings_team_mine=0x7f080015;
+ public static final int settings_team_text=0x7f080014;
+ public static final int user_id=0x7f080004;
+ public static final int user_id_text=0x7f080003;
+ public static final int user_pass=0x7f080006;
+ public static final int user_pass_text=0x7f080005;
+ }
+ public static final class layout {
+ public static final int activity_gather=0x7f030000;
+ public static final int activity_init=0x7f030001;
+ public static final int activity_login=0x7f030002;
+ public static final int activity_main=0x7f030003;
+ public static final int activity_setting=0x7f030004;
+ public static final int activity_settings=0x7f030005;
+ public static final int gather_footbar=0x7f030006;
+ public static final int gather_timer=0x7f030007;
+ public static final int login_bottom=0x7f030008;
+ public static final int main_footbar=0x7f030009;
+ public static final int main_headbar=0x7f03000a;
+ public static final int settings_headbar=0x7f03000b;
+ }
+ public static final class menu {
+ public static final int init=0x7f070000;
+ public static final int login=0x7f070001;
+ public static final int main=0x7f070002;
+ public static final int setting=0x7f070003;
+ }
+ public static final class string {
+ public static final int action_settings=0x7f050001;
+ public static final int all=0x7f05000c;
+ public static final int app_name=0x7f050000;
+ public static final int checkin=0x7f050006;
+ public static final int female=0x7f05000a;
+ public static final int fetch=0x7f050005;
+ public static final int focus=0x7f050007;
+ public static final int hello_world=0x7f050002;
+ public static final int male=0x7f050009;
+ public static final int mine=0x7f05000d;
+ public static final int search=0x7f050004;
+ public static final int settings=0x7f050003;
+ public static final int show_sex=0x7f050008;
+ public static final int show_team=0x7f05000b;
+ public static final int title_activity_login=0x7f05000e;
+ public static final int title_activity_main=0x7f05000f;
+ public static final int title_activity_setting=0x7f050010;
+ }
+ public static final class style {
+ /**
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+
+
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+
+
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+
+ API 11 theme customizations can go here.
+
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+
+ API 14 theme customizations can go here.
+ */
+ public static final int AppBaseTheme=0x7f060000;
+ /** Application theme.
+ All customizations that are NOT specific to a particular API-level can go here.
+ */
+ public static final int AppTheme=0x7f060001;
+ }
+}
diff --git a/client/gps-demo/AndroidGPSTracking/.AndroidManifest.xml.swp b/client/gps-demo/AndroidGPSTracking/.AndroidManifest.xml.swp
deleted file mode 100644
index d03b360..0000000
--- a/client/gps-demo/AndroidGPSTracking/.AndroidManifest.xml.swp
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/.classpath b/client/gps-demo/AndroidGPSTracking/.classpath
deleted file mode 100644
index 5176974..0000000
--- a/client/gps-demo/AndroidGPSTracking/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
- <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="gen"/>
- <classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/client/gps-demo/AndroidGPSTracking/.project b/client/gps-demo/AndroidGPSTracking/.project
deleted file mode 100644
index a080853..0000000
--- a/client/gps-demo/AndroidGPSTracking/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>AndroidGPSTracking</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>
diff --git a/client/gps-demo/AndroidGPSTracking/.settings/org.eclipse.jdt.core.prefs b/client/gps-demo/AndroidGPSTracking/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index b080d2d..0000000
--- a/client/gps-demo/AndroidGPSTracking/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.source=1.6
diff --git a/client/gps-demo/AndroidGPSTracking/AndroidManifest.xml b/client/gps-demo/AndroidGPSTracking/AndroidManifest.xml
deleted file mode 100644
index 137894c..0000000
--- a/client/gps-demo/AndroidGPSTracking/AndroidManifest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.gpstracking"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk android:minSdkVersion="8" />
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
- <activity
- android:name=".AndroidGPSTrackingActivity"
- 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-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <uses-permission android:name="android.permission.INTERNET" />
-
-</manifest> \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/bin/AndroidGPSTracking.apk b/client/gps-demo/AndroidGPSTracking/bin/AndroidGPSTracking.apk
deleted file mode 100644
index 985304a..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/AndroidGPSTracking.apk
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/AndroidManifest.xml b/client/gps-demo/AndroidGPSTracking/bin/AndroidManifest.xml
deleted file mode 100644
index 137894c..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/AndroidManifest.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.example.gpstracking"
- android:versionCode="1"
- android:versionName="1.0" >
-
- <uses-sdk android:minSdkVersion="8" />
-
- <application
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name" >
- <activity
- android:name=".AndroidGPSTrackingActivity"
- 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-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <uses-permission android:name="android.permission.INTERNET" />
-
-</manifest> \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes.dex b/client/gps-demo/AndroidGPSTracking/bin/classes.dex
deleted file mode 100644
index 1a8d494..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes.dex
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity$1.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity$1.class
deleted file mode 100644
index 3367336..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity$1.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity.class
deleted file mode 100644
index 7df00e1..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/AndroidGPSTrackingActivity.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/BuildConfig.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/BuildConfig.class
deleted file mode 100644
index 15960aa..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/BuildConfig.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$1.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$1.class
deleted file mode 100644
index 8e2ea2b..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$1.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$2.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$2.class
deleted file mode 100644
index 572f305..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker$2.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker.class
deleted file mode 100644
index 6f6bd93..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/GPSTracker.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$attr.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$attr.class
deleted file mode 100644
index 1dbe417..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$attr.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$drawable.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$drawable.class
deleted file mode 100644
index f46f86d..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$drawable.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$id.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$id.class
deleted file mode 100644
index 7d48158..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$id.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$layout.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$layout.class
deleted file mode 100644
index 08f0ade..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$layout.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$string.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$string.class
deleted file mode 100644
index 7c72195..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R$string.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R.class b/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R.class
deleted file mode 100644
index 7f0475e..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/classes/com/example/gpstracking/R.class
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/dexedLibs/annotations-5b022f4578500e25e3bfa446659bd7d8.jar b/client/gps-demo/AndroidGPSTracking/bin/dexedLibs/annotations-5b022f4578500e25e3bfa446659bd7d8.jar
deleted file mode 100644
index 61505d5..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/dexedLibs/annotations-5b022f4578500e25e3bfa446659bd7d8.jar
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-hdpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/bin/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 882eb14..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-ldpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/bin/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 18689f6..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-mdpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/bin/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 02e96b9..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/bin/resources.ap_ b/client/gps-demo/AndroidGPSTracking/bin/resources.ap_
deleted file mode 100644
index 8c035b7..0000000
--- a/client/gps-demo/AndroidGPSTracking/bin/resources.ap_
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/default.properties b/client/gps-demo/AndroidGPSTracking/default.properties
deleted file mode 100644
index 32299c2..0000000
--- a/client/gps-demo/AndroidGPSTracking/default.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Project target.
-target=android-8
diff --git a/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/BuildConfig.java b/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/BuildConfig.java
deleted file mode 100644
index c164cb3..0000000
--- a/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/BuildConfig.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/** Automatically generated file. DO NOT MODIFY */
-package com.example.gpstracking;
-
-public final class BuildConfig {
- public final static boolean DEBUG = true;
-} \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/R.java b/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/R.java
deleted file mode 100644
index c747309..0000000
--- a/client/gps-demo/AndroidGPSTracking/gen/com/example/gpstracking/R.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/* AUTO-GENERATED FILE. DO NOT MODIFY.
- *
- * This class was automatically generated by the
- * aapt tool from the resource data it found. It
- * should not be modified by hand.
- */
-
-package com.example.gpstracking;
-
-public final class R {
- public static final class attr {
- }
- public static final class drawable {
- public static final int ic_launcher=0x7f020000;
- }
- public static final class id {
- public static final int btnShowLocation=0x7f050000;
- }
- public static final class layout {
- public static final int main=0x7f030000;
- }
- public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
- }
-}
diff --git a/client/gps-demo/AndroidGPSTracking/proguard.cfg b/client/gps-demo/AndroidGPSTracking/proguard.cfg
deleted file mode 100644
index b1cdf17..0000000
--- a/client/gps-demo/AndroidGPSTracking/proguard.cfg
+++ /dev/null
@@ -1,40 +0,0 @@
--optimizationpasses 5
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontpreverify
--verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class * extends android.app.backup.BackupAgentHelper
--keep public class * extends android.preference.Preference
--keep public class com.android.vending.licensing.ILicensingService
-
--keepclasseswithmembernames class * {
- native <methods>;
-}
-
--keepclasseswithmembers class * {
- public <init>(android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembers class * {
- public <init>(android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers class * extends android.app.Activity {
- public void *(android.view.View);
-}
-
--keepclassmembers enum * {
- public static **[] values();
- public static ** valueOf(java.lang.String);
-}
-
--keep class * implements android.os.Parcelable {
- public static final android.os.Parcelable$Creator *;
-}
diff --git a/client/gps-demo/AndroidGPSTracking/project.properties b/client/gps-demo/AndroidGPSTracking/project.properties
deleted file mode 100644
index ea89160..0000000
--- a/client/gps-demo/AndroidGPSTracking/project.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-# 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,
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-8
diff --git a/client/gps-demo/AndroidGPSTracking/res/drawable-hdpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index efc8f0a..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/res/drawable-ldpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index efc8f0a..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/drawable-ldpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/res/drawable-mdpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index efc8f0a..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/res/drawable-xhdpi/ic_launcher.png b/client/gps-demo/AndroidGPSTracking/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index efc8f0a..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/client/gps-demo/AndroidGPSTracking/res/layout/main.xml b/client/gps-demo/AndroidGPSTracking/res/layout/main.xml
deleted file mode 100644
index 430efa2..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/layout/main.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
-
- <Button android:id="@+id/btnShowLocation"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Show Location"
- android:layout_centerVertical="true"
- android:layout_centerHorizontal="true"/>
-
-</RelativeLayout> \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/res/values/strings.xml b/client/gps-demo/AndroidGPSTracking/res/values/strings.xml
deleted file mode 100644
index 6c854c3..0000000
--- a/client/gps-demo/AndroidGPSTracking/res/values/strings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <string name="hello">Hello World, AndroidGPSTrackingActivity!</string>
- <string name="app_name">AndroidGPSTracking</string>
-
-</resources> \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/AndroidGPSTrackingActivity.java b/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/AndroidGPSTrackingActivity.java
deleted file mode 100644
index cdc1413..0000000
--- a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/AndroidGPSTrackingActivity.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.example.gpstracking;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.Toast;
-
-public class AndroidGPSTrackingActivity extends Activity {
-
- Button btnShowLocation;
-
- // GPSTracker class
- GPSTracker gps;
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
-
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- btnShowLocation = (Button) findViewById(R.id.btnShowLocation);
-
- // show location button click event
- btnShowLocation.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View arg0) {
- // create class object
- gps = new GPSTracker(AndroidGPSTrackingActivity.this);
-
- // check if GPS enabled
- if(gps.canGetLocation()){
-
- double latitude = gps.getLatitude();
- double longitude = gps.getLongitude();
-
- Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
- }else{
- // can't get location
- // GPS or Network is not enabled
- // Ask user to enable GPS/network in settings
- gps.showSettingsAlert();
- }
-
- }
- });
- }
-
-} \ No newline at end of file
diff --git a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java b/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java
deleted file mode 100644
index 2e08a91..0000000
--- a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/Tracker.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.example.gpstracking;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-public class Tracker implements Runnable {
-
- private static final long TIME_DELTA = 1000 * 60 * 5;
-
- Controller controller;
-
- public Tracker(Controller newController) {
- controller = newController;
- }
-
- public void run() {
- public Timer timer;
- TimerTask task = new GPSTask();
- timer.schedule(new GPSTask(), 0, TIME_DELTA);
- }
-
- class GPSTask extends TimerTask {
- public void run() {
- GPSTracker tracker;
- tracker = new GPSTracker(Tracker.this);
-
- double latitude = tracker.getLatitude();
- double longitude = tracker.getLongitude();
-
- controller.recieveLocation(latitude, longitude);
- }
- }
-}
diff --git a/client/ic_launcher-web.png b/client/ic_launcher-web.png
new file mode 100644
index 0000000..3cd0ac2
--- /dev/null
+++ b/client/ic_launcher-web.png
Binary files differ
diff --git a/client/Piztor/libs/android-support-v4.jar b/client/libs/android-support-v4.jar
index cf12d28..cf12d28 100644
--- a/client/Piztor/libs/android-support-v4.jar
+++ b/client/libs/android-support-v4.jar
Binary files differ
diff --git a/client/Piztor/proguard-project.txt b/client/proguard-project.txt
index f2fe155..f2fe155 100644
--- a/client/Piztor/proguard-project.txt
+++ b/client/proguard-project.txt
diff --git a/client/Piztor/project.properties b/client/project.properties
index ce39f2d..ce39f2d 100644
--- a/client/Piztor/project.properties
+++ b/client/project.properties
diff --git a/client/res/drawable-hdpi/ic_launcher.png b/client/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..ddc6c13
--- /dev/null
+++ b/client/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/client/res/drawable-mdpi/ic_launcher.png b/client/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..7b6698a
--- /dev/null
+++ b/client/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/client/res/drawable-xhdpi/ic_launcher.png b/client/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..20ea43a
--- /dev/null
+++ b/client/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/client/res/drawable-xxhdpi/ic_launcher.png b/client/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..e1ca5c2
--- /dev/null
+++ b/client/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/client/res/drawable/bottom_img.png b/client/res/drawable/bottom_img.png
new file mode 100644
index 0000000..2725ea8
--- /dev/null
+++ b/client/res/drawable/bottom_img.png
Binary files differ
diff --git a/client/res/drawable/footbar_background.png b/client/res/drawable/footbar_background.png
new file mode 100644
index 0000000..488e8f2
--- /dev/null
+++ b/client/res/drawable/footbar_background.png
Binary files differ
diff --git a/client/res/drawable/footbar_btn_checkin_style.xml b/client/res/drawable/footbar_btn_checkin_style.xml
new file mode 100644
index 0000000..6dbeb21
--- /dev/null
+++ b/client/res/drawable/footbar_btn_checkin_style.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:state_pressed="true" android:drawable="@drawable/footbar_checkin_1"></item>
+ <item android:state_pressed="false" android:drawable="@drawable/footbar_checkin"></item>
+
+</selector>
diff --git a/client/res/drawable/footbar_btn_fetch_style.xml b/client/res/drawable/footbar_btn_fetch_style.xml
new file mode 100644
index 0000000..379d526
--- /dev/null
+++ b/client/res/drawable/footbar_btn_fetch_style.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:state_pressed="true" android:drawable="@drawable/footbar_fetch_1"></item>
+ <item android:state_pressed="false" android:drawable="@drawable/footbar_fetch"></item>
+</selector>
diff --git a/client/res/drawable/footbar_btn_focus_style.xml b/client/res/drawable/footbar_btn_focus_style.xml
new file mode 100644
index 0000000..5932f2f
--- /dev/null
+++ b/client/res/drawable/footbar_btn_focus_style.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:state_pressed="true" android:drawable="@drawable/footbar_marker_1"></item>
+ <item android:state_pressed="false" android:drawable="@drawable/footbar_marker"></item>
+</selector>
diff --git a/client/res/drawable/footbar_btn_search_style.xml b/client/res/drawable/footbar_btn_search_style.xml
new file mode 100644
index 0000000..ac786ef
--- /dev/null
+++ b/client/res/drawable/footbar_btn_search_style.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:state_pressed="true" android:drawable="@drawable/footbar_search_1"></item>
+ <item android:state_pressed="false" android:drawable="@drawable/footbar_search"></item>
+</selector>
diff --git a/client/res/drawable/footbar_btn_settings_style.xml b/client/res/drawable/footbar_btn_settings_style.xml
new file mode 100644
index 0000000..fca6230
--- /dev/null
+++ b/client/res/drawable/footbar_btn_settings_style.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item android:state_pressed="true" android:drawable="@drawable/footbar_settings_1"></item>
+ <item android:state_pressed="false" android:drawable="@drawable/footbar_settings"></item>
+</selector>
diff --git a/client/res/drawable/footbar_checkin.png b/client/res/drawable/footbar_checkin.png
new file mode 100644
index 0000000..90afba7
--- /dev/null
+++ b/client/res/drawable/footbar_checkin.png
Binary files differ
diff --git a/client/res/drawable/footbar_checkin_1.png b/client/res/drawable/footbar_checkin_1.png
new file mode 100644
index 0000000..a478d36
--- /dev/null
+++ b/client/res/drawable/footbar_checkin_1.png
Binary files differ
diff --git a/client/res/drawable/footbar_fetch.png b/client/res/drawable/footbar_fetch.png
new file mode 100644
index 0000000..32d24d2
--- /dev/null
+++ b/client/res/drawable/footbar_fetch.png
Binary files differ
diff --git a/client/res/drawable/footbar_fetch_1.png b/client/res/drawable/footbar_fetch_1.png
new file mode 100644
index 0000000..208094f
--- /dev/null
+++ b/client/res/drawable/footbar_fetch_1.png
Binary files differ
diff --git a/client/res/drawable/footbar_marker.png b/client/res/drawable/footbar_marker.png
new file mode 100644
index 0000000..3de909f
--- /dev/null
+++ b/client/res/drawable/footbar_marker.png
Binary files differ
diff --git a/client/res/drawable/footbar_marker_1.png b/client/res/drawable/footbar_marker_1.png
new file mode 100644
index 0000000..08c8715
--- /dev/null
+++ b/client/res/drawable/footbar_marker_1.png
Binary files differ
diff --git a/client/res/drawable/footbar_search.png b/client/res/drawable/footbar_search.png
new file mode 100644
index 0000000..3549f84
--- /dev/null
+++ b/client/res/drawable/footbar_search.png
Binary files differ
diff --git a/client/res/drawable/footbar_search_1.png b/client/res/drawable/footbar_search_1.png
new file mode 100644
index 0000000..1e6ac28
--- /dev/null
+++ b/client/res/drawable/footbar_search_1.png
Binary files differ
diff --git a/client/res/drawable/footbar_select_bg.png b/client/res/drawable/footbar_select_bg.png
new file mode 100644
index 0000000..9d7e5af
--- /dev/null
+++ b/client/res/drawable/footbar_select_bg.png
Binary files differ
diff --git a/client/res/drawable/footbar_settings.png b/client/res/drawable/footbar_settings.png
new file mode 100644
index 0000000..455bd0b
--- /dev/null
+++ b/client/res/drawable/footbar_settings.png
Binary files differ
diff --git a/client/res/drawable/footbar_settings_1.png b/client/res/drawable/footbar_settings_1.png
new file mode 100644
index 0000000..6b0a2ab
--- /dev/null
+++ b/client/res/drawable/footbar_settings_1.png
Binary files differ
diff --git a/client/res/drawable/footbar_unselect_bg.png b/client/res/drawable/footbar_unselect_bg.png
new file mode 100644
index 0000000..3e1e65e
--- /dev/null
+++ b/client/res/drawable/footbar_unselect_bg.png
Binary files differ
diff --git a/client/res/drawable/horizontal_line.png b/client/res/drawable/horizontal_line.png
new file mode 100644
index 0000000..ccd6aa2
--- /dev/null
+++ b/client/res/drawable/horizontal_line.png
Binary files differ
diff --git a/client/res/drawable/navigation_back.png b/client/res/drawable/navigation_back.png
new file mode 100644
index 0000000..3bdda98
--- /dev/null
+++ b/client/res/drawable/navigation_back.png
Binary files differ
diff --git a/client/res/drawable/navigation_back_1.png b/client/res/drawable/navigation_back_1.png
new file mode 100644
index 0000000..a20b4ef
--- /dev/null
+++ b/client/res/drawable/navigation_back_1.png
Binary files differ
diff --git a/client/res/drawable/title_logo.png b/client/res/drawable/title_logo.png
new file mode 100644
index 0000000..224040c
--- /dev/null
+++ b/client/res/drawable/title_logo.png
Binary files differ
diff --git a/client/res/drawable/topbar_background.png b/client/res/drawable/topbar_background.png
new file mode 100644
index 0000000..9f0291e
--- /dev/null
+++ b/client/res/drawable/topbar_background.png
Binary files differ
diff --git a/client/res/layout/activity_gather.xml b/client/res/layout/activity_gather.xml
new file mode 100644
index 0000000..f887cf0
--- /dev/null
+++ b/client/res/layout/activity_gather.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/white"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:id="@+id/gather_timer_layout"
+ >
+ <include layout="@layout/gather_timer"/>
+ </RelativeLayout>
+ <LinearLayout
+ android:id="@+id/gather_footbar_layout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ >
+ <include layout="@layout/gather_footbar"></include>
+ </LinearLayout>
+</RelativeLayout>
diff --git a/client/Piztor/res/layout/activity_init.xml b/client/res/layout/activity_init.xml
index 43e6253..43e6253 100644
--- a/client/Piztor/res/layout/activity_init.xml
+++ b/client/res/layout/activity_init.xml
diff --git a/client/res/layout/activity_login.xml b/client/res/layout/activity_login.xml
new file mode 100644
index 0000000..cd2d34c
--- /dev/null
+++ b/client/res/layout/activity_login.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="fill_parent"
+ android:background="@android:color/black"
+ android:orientation="vertical">
+
+<LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/black"
+ android:gravity="center_horizontal"
+ android:orientation="vertical" >
+
+ <ImageView
+ android:id="@+id/main_headbar_img"
+ android:layout_width="180dp"
+ android:layout_height="240dp"
+ android:layout_gravity="center_horizontal"
+ android:src="@drawable/title_logo" />
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_gravity="center">
+
+ <TableLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TableRow
+ android:layout_marginBottom="15dp"
+ android:layout_marginTop="15dp">
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:gravity="right"
+ android:id="@+id/user_id_text"
+ android:text="User ID"
+ android:textColor="@android:color/white"
+ />
+
+ <EditText
+ android:layout_width="0dp"
+ android:layout_weight="0.75"
+ android:id="@+id/user_id"
+ android:textColor="@android:color/black"
+ android:singleLine="true"/>
+ <requestFocus/>
+ </TableRow>
+
+ <TableRow>
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.25"
+ android:gravity="right"
+ android:id="@+id/user_pass_text"
+ android:text="Password"
+ android:textColor="@android:color/black"
+ />
+
+ <EditText
+ android:layout_width="0dp"
+ android:layout_weight="0.75"
+ android:id="@+id/user_pass"
+ android:password="true"
+ android:textColor="@android:color/black"
+ android:singleLine="true"/>
+ </TableRow>
+ </TableLayout>
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:orientation="vertical"
+ >
+ <Button
+ android:id="@+id/login_btn_login"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:text="Login"
+ android:textColor="@android:color/white" />
+ </LinearLayout>
+
+</LinearLayout>
+</RelativeLayout>
diff --git a/client/res/layout/activity_main.xml b/client/res/layout/activity_main.xml
new file mode 100644
index 0000000..b2b61ac
--- /dev/null
+++ b/client/res/layout/activity_main.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@android:color/white"
+ android:orientation="vertical">
+ <RelativeLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:id="@+id/main_headbar_layout"
+ >
+ <include layout="@layout/main_headbar"/>
+ </RelativeLayout>
+ <LinearLayout
+ android:id="@+id/main_footbar_layout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ >
+ <include layout="@layout/main_footbar"/>
+ </LinearLayout>
+</RelativeLayout>
diff --git a/client/res/layout/activity_settings.xml b/client/res/layout/activity_settings.xml
new file mode 100644
index 0000000..8ce051f
--- /dev/null
+++ b/client/res/layout/activity_settings.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:background="@drawable/topbar_background"
+ android:orientation="horizontal" >
+
+ <RelativeLayout
+ android:id="@+id/settings_headbar_layout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true" >
+
+ <include layout="@layout/settings_headbar" />
+ </RelativeLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="48dip"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/settings_GPSrefreshrate_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="GPS refresh rate"
+ android:layout_gravity="center"
+ android:layout_marginTop="10dip"
+ android:textSize="20dip"
+ android:textColor="@android:color/white" />
+
+ <SeekBar
+ android:id="@+id/settings_GPSrefreshrate"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+
+ <!-- LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ -->
+ <!-- TextView
+ android:id="@+id/GPS_min_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="10dip"
+ android:text="1s"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"/-->
+
+ <!--TextView
+ android:id="@+id/GPS_max_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:text="30s"
+ android:textColor="@android:color/white"
+ android:textSize="10dip" /-->
+
+ <!-- /LinearLayout --> <!-- end of gps text -->
+
+ <ImageView
+ android:id="@+id/settings_seperator1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/horizontal_line" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/settings_sex_layout"
+ android:layout_marginTop="10dip">
+
+ <TextView
+ android:id="@+id/settings_sex_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip"
+ android:textSize="20dip"
+ android:textColor="@android:color/white"
+ android:text="@string/show_sex" />
+
+ <CheckBox
+ android:id="@+id/settings_show_male"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/male"
+ android:textColor="@android:color/white"/>
+
+
+ <CheckBox
+ android:id="@+id/settings_show_female"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/female"
+ android:textColor="@android:color/white"/>
+
+ </LinearLayout>
+
+ <ImageView
+ android:id="@+id/settings_seperator2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/horizontal_line" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:id="@+id/settings_team_layout"
+ android:layout_marginTop="10dip">
+
+ <TextView
+ android:id="@+id/settings_team_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip"
+ android:textSize="20dip"
+ android:textColor="@android:color/white"
+ android:text="@string/show_team" />
+
+ <RadioButton
+ android:id="@+id/settings_team_mine"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/mine"
+ android:textSize="20dip"
+ android:textColor="@android:color/white"/>
+
+ <RadioButton
+ android:id="@+id/settings_team_all"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/all"
+ android:textSize="20dip"
+ android:textColor="@android:color/white"/>
+
+ </LinearLayout>
+
+ <ImageView
+ android:id="@+id/settings_seperator3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/horizontal_line" />
+
+ </LinearLayout>
+ </RelativeLayout>
diff --git a/client/res/layout/gather_footbar.xml b/client/res/layout/gather_footbar.xml
new file mode 100644
index 0000000..e573032
--- /dev/null
+++ b/client/res/layout/gather_footbar.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="48dip"
+ android:orientation="horizontal"
+ android:background="@drawable/footbar_background" >
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_search_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_search"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_search_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_search_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/search"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_fetch_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_fetch"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_fetch_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_fetch_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/fetch"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_checkin_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:orientation="vertical">
+ <ImageButton
+ android:id="@+id/footbar_btn_checkin"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_checkin_style"
+ />
+ <TextView
+ android:id="@+id/footbar_btn_checkin_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/checkin"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_focus_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_focus"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_focus_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_focus_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/focus"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_settings_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_settings"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_settings_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_settings"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:text="@string/settings"/>
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/client/res/layout/gather_timer.xml b/client/res/layout/gather_timer.xml
new file mode 100644
index 0000000..3849f6b
--- /dev/null
+++ b/client/res/layout/gather_timer.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="48dip"
+ android:background="@android:color/black"
+ android:id="@+id/gather_timer_layout" >
+
+ <TextView
+ android:id="@+id/gather_timer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerHorizontal="true"
+ android:textSize="40dip"
+ android:textColor="@android:color/white">
+ </TextView>
+</RelativeLayout>
diff --git a/client/res/layout/login_bottom.xml b/client/res/layout/login_bottom.xml
new file mode 100644
index 0000000..e268c39
--- /dev/null
+++ b/client/res/layout/login_bottom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="200dip"
+ android:orientation="horizontal"
+ android:background="@drawable/footbar_background" >
+
+ <ImageView
+ android:layout_width="fill_parent"
+ android:layout_height="120dip"
+ android:src="@drawable/bottom_img"/>
+
+</LinearLayout>
diff --git a/client/res/layout/main_footbar.xml b/client/res/layout/main_footbar.xml
new file mode 100644
index 0000000..69760c0
--- /dev/null
+++ b/client/res/layout/main_footbar.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="48dip"
+ android:orientation="horizontal"
+ android:background="@drawable/footbar_background" >
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_search_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_search"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_search_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_search"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/search"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_fetch_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_fetch"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_fetch_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_fetch_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/fetch"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_focus_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_focus"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_focus_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_focus_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:layout_gravity="center"
+ android:text="@string/focus"/>
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/footbar_btn_settings_layout"
+ android:layout_width="64dip"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:layout_marginTop="3dip"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1">
+ <ImageButton
+ android:id="@+id/footbar_btn_settings"
+ android:layout_width="30dip"
+ android:layout_height="30dip"
+ android:layout_gravity="center"
+ android:background="@drawable/footbar_btn_settings_style"/>
+ <TextView
+ android:id="@+id/footbar_btn_settings_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:textSize="10dip"
+ android:textColor="@android:color/white"
+ android:text="@string/settings"/>
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/client/res/layout/main_headbar.xml b/client/res/layout/main_headbar.xml
new file mode 100644
index 0000000..137e3a1
--- /dev/null
+++ b/client/res/layout/main_headbar.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="40dip"
+ android:background="@drawable/topbar_background"
+ android:id="@+id/main_headbar_layout" >
+
+ <ImageView
+ android:id="@+id/headbar_logo"
+ android:layout_width="34dip"
+ android:layout_height="34dip"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="5dip"
+ android:layout_alignParentTop="true"
+ android:background="@drawable/title_logo"/>
+
+ <TextView
+ android:id="@+id/headbar_appname"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
+ android:layout_marginLeft="8dip"
+ android:textSize="26dip"
+ android:textColor="@android:color/white"
+ android:layout_toRightOf="@+id/headbar_logo"
+ android:text="@string/app_name" />
+
+</RelativeLayout>
diff --git a/client/res/layout/settings_headbar.xml b/client/res/layout/settings_headbar.xml
new file mode 100644
index 0000000..9065bdb
--- /dev/null
+++ b/client/res/layout/settings_headbar.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="48dip"
+ android:background="@drawable/topbar_background"
+ android:id="@+id/settings_headbar_layout" >
+
+ <ImageButton
+ android:id="@+id/settings_btn_back"
+ android:layout_width="40dip"
+ android:layout_height="40dip"
+ android:layout_marginLeft="5dip"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:background="@drawable/navigation_back"/>
+
+ <TextView
+ android:id="@+id/settings_headbar_text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="30dip"
+ android:textColor="@android:color/white"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:layout_marginRight="40dip"
+ android:text="@string/settings"/>
+
+
+</RelativeLayout>
diff --git a/client/Piztor/res/menu/init.xml b/client/res/menu/init.xml
index c002028..c002028 100644
--- a/client/Piztor/res/menu/init.xml
+++ b/client/res/menu/init.xml
diff --git a/client/Piztor/res/menu/main.xml b/client/res/menu/login.xml
index c002028..c002028 100644
--- a/client/Piztor/res/menu/main.xml
+++ b/client/res/menu/login.xml
diff --git a/client/res/menu/main.xml b/client/res/menu/main.xml
new file mode 100644
index 0000000..c002028
--- /dev/null
+++ b/client/res/menu/main.xml
@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings"/>
+
+</menu>
diff --git a/client/res/menu/setting.xml b/client/res/menu/setting.xml
new file mode 100644
index 0000000..c002028
--- /dev/null
+++ b/client/res/menu/setting.xml
@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings"/>
+
+</menu>
diff --git a/client/Piztor/res/values-sw600dp/dimens.xml b/client/res/values-sw600dp/dimens.xml
index 44f01db..44f01db 100644
--- a/client/Piztor/res/values-sw600dp/dimens.xml
+++ b/client/res/values-sw600dp/dimens.xml
diff --git a/client/Piztor/res/values-sw720dp-land/dimens.xml b/client/res/values-sw720dp-land/dimens.xml
index 61e3fa8..61e3fa8 100644
--- a/client/Piztor/res/values-sw720dp-land/dimens.xml
+++ b/client/res/values-sw720dp-land/dimens.xml
diff --git a/client/Piztor/res/values-v11/styles.xml b/client/res/values-v11/styles.xml
index 3c02242..3c02242 100644
--- a/client/Piztor/res/values-v11/styles.xml
+++ b/client/res/values-v11/styles.xml
diff --git a/client/Piztor/res/values-v14/styles.xml b/client/res/values-v14/styles.xml
index a91fd03..a91fd03 100644
--- a/client/Piztor/res/values-v14/styles.xml
+++ b/client/res/values-v14/styles.xml
diff --git a/client/Piztor/res/values/dimens.xml b/client/res/values/dimens.xml
index 55c1e59..55c1e59 100644
--- a/client/Piztor/res/values/dimens.xml
+++ b/client/res/values/dimens.xml
diff --git a/client/res/values/strings.xml b/client/res/values/strings.xml
new file mode 100644
index 0000000..5a5ccc4
--- /dev/null
+++ b/client/res/values/strings.xml
@@ -0,0 +1,21 @@
+<resources>
+
+ <string name="app_name">piztor</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+ <string name="settings">Settings</string>
+ <string name="search">Search</string>
+ <string name="fetch">Fetch</string>
+ <string name="checkin">Checkin</string>
+ <string name="focus">Focus</string>
+ <string name="show_sex">Show sex: </string>
+ <string name="male">Male</string>
+ <string name="female">Female</string>
+ <string name="show_team">Show team: </string>
+ <string name="all">All</string>
+ <string name="mine">Mine</string>
+ <string name="title_activity_login">Login</string>
+ <string name="title_activity_main">Main</string>
+ <string name="title_activity_setting">Setting</string>
+
+</resources>
diff --git a/client/Piztor/res/values/styles.xml b/client/res/values/styles.xml
index 6ce89c7..6ce89c7 100644
--- a/client/Piztor/res/values/styles.xml
+++ b/client/res/values/styles.xml
diff --git a/client/Piztor/src/com/macaroon/piztor/ActMgr.java b/client/src/com/macaroon/piztor/ActMgr.java
index f5ff994..f5ff994 100644
--- a/client/Piztor/src/com/macaroon/piztor/ActMgr.java
+++ b/client/src/com/macaroon/piztor/ActMgr.java
diff --git a/client/Piztor/src/com/macaroon/piztor/AppMgr.java b/client/src/com/macaroon/piztor/AppMgr.java
index 10e8e1a..10e8e1a 100644
--- a/client/Piztor/src/com/macaroon/piztor/AppMgr.java
+++ b/client/src/com/macaroon/piztor/AppMgr.java
diff --git a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/GPSTracker.java b/client/src/com/macaroon/piztor/GPSTracker.java
index f1e77ad..7e89d21 100644
--- a/client/gps-demo/AndroidGPSTracking/src/com/example/gpstracking/GPSTracker.java
+++ b/client/src/com/macaroon/piztor/GPSTracker.java
@@ -1,4 +1,4 @@
-package com.example.gpstracking;
+package com.macaroon.piztor;
import android.app.AlertDialog;
import android.app.Service;
@@ -8,12 +8,14 @@ import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
+import android.location.GpsStatus;
import android.os.Bundle;
import android.os.IBinder;
+import android.os.SystemClock;
import android.provider.Settings;
import android.util.Log;
-public class GPSTracker extends Service implements LocationListener {
+public class GPSTracker extends Service implements LocationListener, GpsStatus.Listener {
private final Context mContext;
@@ -34,30 +36,39 @@ public class GPSTracker extends Service implements LocationListener {
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
// The minimum time between updates in milliseconds
- private static final long MIN_TIME_BW_UPDATES = 10 * 60 * 1; // 1 minute
+ private static final long MIN_TIME_BW_UPDATES = 1000 * 3; // 10 seconds
// Declaring a Location Manager
protected LocationManager locationManager;
+ // for GPS satellite status listener
+ Location mLastLocation;
+ long mLastLocationMillis;
+ boolean isGPSFix;
+
+
public GPSTracker(Context context) {
this.mContext = context;
+ isGPSFix = false;
getLocation();
}
public Location getLocation() {
try {
+ Log.d("getLocation", "Start getting location......");
+
locationManager = (LocationManager) mContext
- .getSystemService(LOCATION_SERVICE);
+ .getSystemService(LOCATION_SERVICE);
// getting GPS status
isGPSEnabled = locationManager
- .isProviderEnabled(LocationManager.GPS_PROVIDER);
+ .isProviderEnabled(LocationManager.GPS_PROVIDER);
// getting network status
isNetworkEnabled = locationManager
- .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
+ .isProviderEnabled(LocationManager.NETWORK_PROVIDER);
- if (!isGPSEnabled && !isNetworkEnabled) {
+ if (!isGPSEnabled) {
// no network provider is enabled
} else {
this.canGetLocation = true;
@@ -66,119 +77,135 @@ public class GPSTracker extends Service implements LocationListener {
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("Network", "Network");
+
+ Log.d("Network", "Network Updated");
+
if (locationManager != null) {
location = locationManager
- .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
+ .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
+
+ Log.d("Network", "Received Network Data");
+ System.out.println("***From Network: "+latitude + " " + longitude);
}
}
- }
+ }// end of network section
// if GPS Enabled get lat/long using GPS Services
if (isGPSEnabled) {
- if (location == null) {
+ if (true) {
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
- Log.d("GPS Enabled", "GPS Enabled");
+ Log.d("GPS", "GPS Updated");
if (locationManager != null) {
location = locationManager
- .getLastKnownLocation(LocationManager.GPS_PROVIDER);
+ .getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
+
+ Log.d("GPS", "Received GPS Data");
+ System.out.println("***From GPS: "+latitude + " " + longitude);
+
}
}
}
- }
- }
-
+ }// end of GPS section
+ }// end of fetching data
+ return location;
} catch (Exception e) {
e.printStackTrace();
+ return null;
}
-
- return location;
}
-
+
/**
- * Stop using GPS listener
- * Calling this function will stop using GPS in your app
- */
- public void stopUsingGPS(){
- if(locationManager != null){
+ * Stop using GPS listener Calling this function will stop using GPS in your
+ * app
+ * */
+ public void stopUsingGPS() {
+ if (locationManager != null) {
locationManager.removeUpdates(GPSTracker.this);
- }
+ }
}
-
+
/**
* Function to get latitude
- */
- public double getLatitude(){
- if(location != null){
+ * */
+ public double getLatitude() {
+ if (location != null) {
latitude = location.getLatitude();
}
-
- // return latitude
return latitude;
}
-
+
/**
* Function to get longitude
- */
- public double getLongitude(){
- if(location != null){
+ * */
+ public double getLongitude() {
+ if (location != null) {
longitude = location.getLongitude();
}
-
- // return longitude
return longitude;
}
-
+
/**
* Function to check GPS/wifi enabled
+ *
* @return boolean
- */
+ * */
public boolean canGetLocation() {
return this.canGetLocation;
}
-
+
+ public boolean isGPSFix() {
+ return (this.isGPSFix && location != null);
+ }
+
/**
- * Function to show settings alert dialog
- * On pressing Settings button will lauch Settings Options
- */
- public void showSettingsAlert(){
+ * Function to show settings alert dialog On pressing Settings button will
+ * lauch Settings Options
+ * */
+ public void showSettingsAlert() {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS is settings");
-
- // Setting Dialog Message
- alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog,int which) {
- Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- mContext.startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
+
+ // Setting Dialog Title
+ alertDialog.setTitle("GPS is settings");
+
+ // Setting Dialog Message
+ alertDialog
+ .setMessage("GPS is not enabled. Do you want to go to settings menu?");
+
+ // On pressing Settings button
+ alertDialog.setPositiveButton("Settings",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ Intent intent = new Intent(
+ Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ mContext.startActivity(intent);
+ }
+ });
+
+ // on pressing cancel button
+ alertDialog.setNegativeButton("Cancel",
+ new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+
+ // Showing Alert Message
+ alertDialog.show();
}
@Override
public void onLocationChanged(Location location) {
+ if (location == null) return;
+ mLastLocationMillis = SystemClock.elapsedRealtime();
+ mLastLocation = location;
}
@Override
@@ -197,4 +224,18 @@ public class GPSTracker extends Service implements LocationListener {
public IBinder onBind(Intent arg0) {
return null;
}
+
+ @Override
+ public void onGpsStatusChanged(int event) {
+ switch (event) {
+ case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
+ if(mLastLocation != null)
+ isGPSFix = (SystemClock.elapsedRealtime() - mLastLocationMillis) < 3000;
+ break;
+
+ case GpsStatus.GPS_EVENT_FIRST_FIX:
+ isGPSFix = true;
+ break;
+ }
+ }
}
diff --git a/client/Piztor/src/com/macaroon/piztor/InitAct.java b/client/src/com/macaroon/piztor/InitAct.java
index 3986f5d..d5a6059 100644
--- a/client/Piztor/src/com/macaroon/piztor/InitAct.java
+++ b/client/src/com/macaroon/piztor/InitAct.java
@@ -1,6 +1,8 @@
package com.macaroon.piztor;
+import android.content.Intent;
import android.os.Bundle;
+import android.os.Handler;
import android.view.Menu;
public class InitAct extends PiztorAct {
@@ -16,7 +18,7 @@ public class InitAct extends PiztorAct {
@Override
protected void onStart() {
super.onStart();
- if (Infomation.token == -1)
+ if (UserInfo.token == -1)
AppMgr.trigger(AppMgr.noToken);
else {
//TODO jump to main
diff --git a/client/src/com/macaroon/piztor/Login.java b/client/src/com/macaroon/piztor/Login.java
new file mode 100644
index 0000000..a931dae
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Login.java
@@ -0,0 +1,104 @@
+package com.macaroon.piztor;
+
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.Menu;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class Login extends PiztorAct {
+
+
+ ActMgr actMgr;
+ Button btnLogin;
+ EditText edtUser, edtPass;
+
+ int loginButtonClick = 1, retryButtonClick = 2, loginFailed = 3;
+
+ Handler hand = new Handler() {
+ @Override
+ public void handleMessage(Message m) {
+ System.out.println(m.what);
+ if (m.what == 0) {
+ ResLogin res = (ResLogin) m.obj;
+ UserInfo.token = res.t;
+ actMgr.trigger(AppMgr.loginSuccess);
+ } else if (m.what == 101) {
+ actMgr.trigger(loginFailed);
+ }
+ }
+ };
+
+ class StartStatus extends ActStatus {
+
+ @Override
+ void enter(int e) {
+ }
+
+ @Override
+ void leave(int e) {
+ }
+ }
+
+ class LoginStatus extends ActStatus {
+
+ @Override
+ void enter(int e) {
+ String user = edtUser.getText().toString();
+ String pass = edtPass.getText().toString();
+ long nowtime = System.currentTimeMillis();
+ System.out.println(user + " : " + pass + "\n");
+ AppMgr.transam.send(new ReqLogin(user, pass, nowtime, 1000));
+ }
+
+ @Override
+ void leave(int e) {
+
+ }
+
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ id = "login";
+ super.onCreate(savedInstanceState);
+ ActStatus[] r = new ActStatus[2];
+ AppMgr.transam.setHandler(hand);
+ r[0] = new StartStatus();
+ r[1] = new LoginStatus();
+ actMgr = new ActMgr(this, r[0], r);
+ actMgr.add(r[0], loginButtonClick, r[1]);
+ actMgr.add(r[1], loginFailed, r[0]);
+ setContentView(R.layout.activity_login);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ btnLogin = (Button) findViewById(R.id.login_btn_login);
+ edtUser = (EditText) findViewById(R.id.user_id);
+ edtPass = (EditText) findViewById(R.id.user_pass);
+ btnLogin.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ actMgr.trigger(loginButtonClick);
+ }
+ });
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.login, menu);
+ return true;
+ }
+
+}
diff --git a/client/src/com/macaroon/piztor/Main.java b/client/src/com/macaroon/piztor/Main.java
new file mode 100644
index 0000000..0b24abd
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Main.java
@@ -0,0 +1,51 @@
+package com.macaroon.piztor;
+
+import android.location.Location;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.view.Menu;
+
+public class Main extends PiztorAct {
+
+ ActMgr actMgr;
+
+ Handler handler = new Handler() {
+ @Override
+ public void handleMessage(Message m) {
+ if (m.what != 0) {
+ Location l = (Location) m.obj;
+ if (l == null)
+ System.out.println("fuck!!!");
+ ReqUpdate r = new ReqUpdate(UserInfo.token, l.getLatitude(),
+ l.getLongitude(), System.currentTimeMillis(), 1000);
+ AppMgr.transam.send(r);
+ }
+ }
+ };
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ id = "Main";
+ super.onCreate(savedInstanceState);
+ AppMgr.tracker.setHandler(handler);
+ EmptyStatus[] r = new EmptyStatus[1];
+ r[0] = new EmptyStatus();
+ actMgr = new ActMgr(this, r[0], r);
+ setContentView(R.layout.activity_main);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+}
diff --git a/client/Piztor/src/com/macaroon/piztor/PiztorAct.java b/client/src/com/macaroon/piztor/PiztorAct.java
index ad12b17..ad12b17 100644
--- a/client/Piztor/src/com/macaroon/piztor/PiztorAct.java
+++ b/client/src/com/macaroon/piztor/PiztorAct.java
diff --git a/client/src/com/macaroon/piztor/PiztorExcepiton.java b/client/src/com/macaroon/piztor/PiztorExcepiton.java
new file mode 100644
index 0000000..6d1861a
--- /dev/null
+++ b/client/src/com/macaroon/piztor/PiztorExcepiton.java
@@ -0,0 +1,10 @@
+package com.macaroon.piztor;
+
+class PiztorExcepiton extends Exception{
+ private static final long serialVersionUID = -7147530695009854988L;
+
+}
+
+class ClassCannotFind extends PiztorExcepiton {
+ //private class
+}
diff --git a/client/src/com/macaroon/piztor/Req.java b/client/src/com/macaroon/piztor/Req.java
new file mode 100644
index 0000000..32988b8
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Req.java
@@ -0,0 +1,14 @@
+package com.macaroon.piztor;
+
+public class Req{
+ int type; //request type
+ int token; //authentciation
+ long time; //current time
+ long alive; //alive time
+ Req(int t,int k,long tm,long av){
+ type = t;
+ token = k;
+ time = tm;
+ alive = av;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/ReqLocation.java b/client/src/com/macaroon/piztor/ReqLocation.java
new file mode 100644
index 0000000..000f373
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ReqLocation.java
@@ -0,0 +1,14 @@
+package com.macaroon.piztor;
+
+//--------------------------------------//
+// Ask Location //
+//--------------------------------------//
+
+public class ReqLocation extends Req{
+ int gid; //group id;
+
+ ReqLocation(int token,int groupid,long time,long alive){
+ super(3,token,time,alive); //for type 3
+ gid = groupid;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/ReqLogin.java b/client/src/com/macaroon/piztor/ReqLogin.java
new file mode 100644
index 0000000..294cae3
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ReqLogin.java
@@ -0,0 +1,16 @@
+package com.macaroon.piztor;
+
+//--------------------------------------//
+// authentication //
+//--------------------------------------//
+
+public class ReqLogin extends Req{
+ String user; //username
+ String pass; //password
+
+ ReqLogin(String u,String p,long time,long alive){
+ super(0,0,time,alive); //for type 0
+ user = u;
+ pass = p;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/ReqUpdate.java b/client/src/com/macaroon/piztor/ReqUpdate.java
new file mode 100644
index 0000000..e4b1497
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ReqUpdate.java
@@ -0,0 +1,16 @@
+package com.macaroon.piztor;
+
+//--------------------------------------//
+// Update Location //
+//--------------------------------------//
+
+public class ReqUpdate extends Req{
+ double lat; //latitude
+ double lot; //longitude
+
+ ReqUpdate(int token,double latitude,double longitude,long time,long alive){
+ super(2,token,time,alive); //for type 2
+ lat = latitude;
+ lot = longitude;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/Res.java b/client/src/com/macaroon/piztor/Res.java
new file mode 100644
index 0000000..98af108
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Res.java
@@ -0,0 +1,11 @@
+package com.macaroon.piztor;
+
+public class Res{
+ int t;
+ int s;
+ Res(int type,int status){
+ t = type;
+ s = status;
+ }
+}
+
diff --git a/client/src/com/macaroon/piztor/ResLocation.java b/client/src/com/macaroon/piztor/ResLocation.java
new file mode 100644
index 0000000..eb90840
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ResLocation.java
@@ -0,0 +1,18 @@
+package com.macaroon.piztor;
+
+import java.util.Vector;
+
+//--------------------------------------//
+// Location Info //
+//--------------------------------------//
+
+public class ResLocation extends Res{
+ Vector<Rlocation> l; //vector for location info
+ int n; //number of location info
+
+ ResLocation(int num,Vector<Rlocation> locationvec){
+ super(3,255); //for type 3
+ l = locationvec;
+ n = num;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/ResLogin.java b/client/src/com/macaroon/piztor/ResLogin.java
new file mode 100644
index 0000000..5b597a4
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ResLogin.java
@@ -0,0 +1,15 @@
+package com.macaroon.piztor;
+
+
+//--------------------------------------//
+// Respond to login //
+//--------------------------------------//
+
+public class ResLogin extends Res{
+ int t; //user token
+
+ ResLogin(int token,int status){
+ super(0,status); //for type 0
+ t = token;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/ResUpdate.java b/client/src/com/macaroon/piztor/ResUpdate.java
new file mode 100644
index 0000000..727eaa3
--- /dev/null
+++ b/client/src/com/macaroon/piztor/ResUpdate.java
@@ -0,0 +1,13 @@
+package com.macaroon.piztor;
+
+
+//--------------------------------------//
+// Respond to update location //
+//--------------------------------------//
+
+public class ResUpdate extends Res{
+
+ ResUpdate(int status){
+ super(2,status); //for type 2
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/Rlocation.java b/client/src/com/macaroon/piztor/Rlocation.java
new file mode 100644
index 0000000..142cc9b
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Rlocation.java
@@ -0,0 +1,13 @@
+package com.macaroon.piztor;
+
+class Rlocation{
+ int i; //id
+ double lat; //latitude
+ double lot; //longitude
+
+ Rlocation(int id,double latitude,double longitude){
+ i = id;
+ lat = latitude;
+ lot = longitude;
+ }
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/Setting.java b/client/src/com/macaroon/piztor/Setting.java
new file mode 100644
index 0000000..2a2d2fa
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Setting.java
@@ -0,0 +1,31 @@
+package com.macaroon.piztor;
+
+import android.os.Bundle;
+import android.view.Menu;
+
+public class InitAct extends PiztorAct {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ id = "initAct";
+ super.onCreate(savedInstanceState);
+ AppMgr.init();
+ setContentView(R.layout.activity_init);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (Infomation.token == -1)
+ AppMgr.trigger(AppMgr.noToken);
+ else {
+ //TODO jump to main
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.init, menu);
+ return true;
+ }
+
+}
diff --git a/client/src/com/macaroon/piztor/Settings.java b/client/src/com/macaroon/piztor/Settings.java
new file mode 100644
index 0000000..292a112
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Settings.java
@@ -0,0 +1,22 @@
+package com.macaroon.piztor;
+
+import android.os.Bundle;
+import android.app.Activity;
+import android.view.Menu;
+
+public class Settings extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_settings);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.setting, menu);
+ return true;
+ }
+
+}
diff --git a/client/src/com/macaroon/piztor/SocketClient.java b/client/src/com/macaroon/piztor/SocketClient.java
new file mode 100644
index 0000000..18c19da
--- /dev/null
+++ b/client/src/com/macaroon/piztor/SocketClient.java
@@ -0,0 +1,107 @@
+package com.macaroon.piztor;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.Vector;
+
+import android.os.Handler;
+import android.os.Message;
+
+public class SocketClient {
+ static Socket client;
+
+ public SocketClient(String site, int port) throws UnknownHostException,
+ IOException {
+ try {
+ client = new Socket(site, port);
+ } catch (UnknownHostException e) {
+ throw e;
+ } catch (IOException e) {
+ throw e;
+ }
+ }
+
+ public void sendMsg(Req req,Handler recall) throws IOException {
+ try {
+ DataOutputStream out = new DataOutputStream(
+ client.getOutputStream());
+ int tmp = req.type;
+ out.writeByte(tmp);
+ switch (tmp) {
+ case 0:
+ ReqLogin rau = (ReqLogin) req;
+ String id = rau.user;
+ String pa = rau.pass;
+ out.writeBytes(id + "\0" + pa);
+ break;
+ case 2:
+ ReqUpdate rup = (ReqUpdate) req;
+ int tk2 = rup.token;
+ double slat = rup.lat;
+ double slot = rup.lot;
+ out.writeInt(tk2);
+ out.writeDouble(slat);
+ out.writeDouble(slot);
+ break;
+ case 3:
+ ReqLocation ras = (ReqLocation) req;
+ int tk3 = ras.token;
+ int gid = ras.gid;
+ out.writeInt(tk3);
+ out.writeInt(gid);
+ break;
+ }
+ out.flush();
+ client.shutdownOutput();
+ DataInputStream in = new DataInputStream(client.getInputStream());
+ Message msg = new Message();
+ int type = in.readUnsignedByte();
+ switch (type) {
+ case 0:
+ int id = in.readInt();
+ int status = in.readUnsignedByte();
+ ResLogin rchklogin = new ResLogin(id,status);
+ msg.obj = rchklogin;
+ msg.what = 0;
+ recall.sendMessage(msg);
+ break;
+ case 2:
+ int status1 = in.readUnsignedByte();
+ ResUpdate rchkupd = new ResUpdate(status1);
+ msg.obj = rchkupd;
+ msg.what = 1;
+ recall.sendMessage(msg);
+ break;
+ case 3:
+ int n = in.readInt();
+ Vector<Rlocation> tmpv = new Vector<Rlocation>();
+ for (int i = 1; i <= n; i++) {
+ int tid = in.readInt();
+ double lat = in.readDouble();
+ double lot = in.readDouble();
+ tmpv.add(new Rlocation(tid,lat,lot));
+ }
+ ResLocation rlocin = new ResLocation(n,tmpv);
+ msg.obj = rlocin;
+ msg.what = 3;
+ recall.sendMessage(msg);
+ break;
+ }
+
+ } catch (IOException e) {
+ throw e;
+ }
+ }
+
+ public void closeSocket() {
+ try {
+ client.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/client/src/com/macaroon/piztor/Tracker.java b/client/src/com/macaroon/piztor/Tracker.java
new file mode 100644
index 0000000..3c46136
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Tracker.java
@@ -0,0 +1,68 @@
+package com.macaroon.piztor;
+
+import android.content.Context;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import android.location.Location;
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.os.SystemClock;
+
+
+public class Tracker implements Runnable {
+
+ private static final long TIME_DELTA = 1000 * 3; // 3 second
+ public Timer timer;
+ private final Context mContext;
+ GPSTracker myTracker;
+ Handler mHandler;
+ Message message;
+
+ public Tracker(Context context, Handler yHandler) {
+ timer = new Timer();
+ mContext = context;
+ myTracker = new GPSTracker(mContext);
+ mHandler = yHandler;
+ }
+
+ void setHandler(Handler hand) {
+ mHandler = hand;
+ }
+
+
+ public void run() {
+ GPSTask myTask = new GPSTask();
+ timer.schedule(myTask, 0, TIME_DELTA);
+ }
+
+ class GPSTask extends TimerTask {
+ @Override
+ public void run() {
+ Location location = myTracker.getLocation();
+ Log.d("Location", "Fetching location.....");
+ if (myTracker.canGetLocation()) {
+
+// Log.d("TTTTTTTTTTTTTTTTTTTTTTTime","TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTime");
+// System.out.println("GPSTIME" + myTracker.location.getTime());
+// System.out.println("SYSTIME" + SystemClock.elapsedRealtime());
+
+ message = new Message();
+ message.what = 0;
+ message.obj = location;
+ if(myTracker.isGPSFix()) {
+ message.what = 1;
+ } else {
+ message.what = 2;
+ }
+ mHandler.sendMessage(message);
+ } else {
+ message = new Message();
+ message.what = 0;
+ mHandler.sendMessage(message);
+ }
+ }
+ }
+}
diff --git a/client/src/com/macaroon/piztor/Transam.java b/client/src/com/macaroon/piztor/Transam.java
new file mode 100644
index 0000000..3410502
--- /dev/null
+++ b/client/src/com/macaroon/piztor/Transam.java
@@ -0,0 +1,139 @@
+package com.macaroon.piztor;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import android.annotation.SuppressLint;
+import android.os.Handler;
+import android.os.Message;
+
+public class Transam implements Runnable {
+
+ public Timer timer;
+ public Timer mtimer;
+ public boolean running = false;
+ public boolean flag = true;
+ public int cnt = 4;
+ Res res;
+ Req req;
+ public int p; // port
+ public String i; // ip
+ Thread thread;
+ Handler core;
+ Handler recall; // recall
+ Queue<Req> reqtask; // request task
+
+ Transam(String ip, int port, Handler Recall) {
+ p = port;
+ i = ip;
+ recall = Recall;
+ reqtask = new LinkedList<Req>();
+ }
+
+ public void send(Req r) {
+ reqtask.offer(r);
+
+ }
+
+ public void setHandler(Handler Recall) {
+ recall = Recall;
+ reqtask.clear();
+ }
+
+ public void run() { // start the main timer
+ // TimerTask tmain = new Timertk();
+ // mtimer = new Timer();
+ // mtimer.schedule(tmain, 100, 100); //check the queue for every 100
+ // msec
+
+ while (true) {
+ if (running == false) {
+
+ if (!reqtask.isEmpty()) { // poll the head request
+ req = reqtask.poll();
+ if (req.time + req.alive < System.currentTimeMillis()) { // time
+ // out!
+ Message ret = new Message();
+ ret.obj = "Time out!";
+ ret.what = 100;
+ recall.sendMessage(ret);
+ } else { // run the request
+ final thd t = new thd();
+ flag = false;
+ thread = new Thread(t);
+ cnt = 4;
+ running = true;
+ thread.start();
+ timer = new Timer();
+ TimerTask task = new Timertk();
+ timer.schedule(task, 2000, 2000);
+ }
+ }
+ }
+ }
+ }
+
+ class tmain extends TimerTask {
+ public void run() {
+
+ }
+ };
+
+ class thd implements Runnable {
+ public void run() {
+ try {
+ SocketClient client = new SocketClient(i, p);
+ client.sendMsg(req, recall);
+ Message msg = new Message();
+ msg.what = 1;
+ handler.sendMessage(msg);
+ client.closeSocket();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ System.out.println("UnknownHostException");
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("IOException");
+ }
+
+ }
+ }
+
+ @SuppressLint("HandlerLeak")
+ Handler handler = new Handler() {
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case 1:
+ flag = true;
+ break;
+ case 2:
+ final thd t = new thd();
+ thread = new Thread(t);
+ thread.start();
+ break;
+ }
+ super.handleMessage(msg);
+ }
+ };
+
+ class Timertk extends TimerTask {
+ public void run() {
+ if (flag == false && cnt > 0) {
+ cnt--;
+ } else if (cnt == 0) {
+ Message msg = new Message();
+ msg.obj = "connecting failed";
+ msg.what = 101;
+ recall.sendMessage(msg);
+ timer.cancel();
+ } else if (flag == true) {
+ timer.cancel();
+ running = false;
+ }
+ }
+ };
+} \ No newline at end of file
diff --git a/client/src/com/macaroon/piztor/UserInfo.java b/client/src/com/macaroon/piztor/UserInfo.java
new file mode 100644
index 0000000..04be578
--- /dev/null
+++ b/client/src/com/macaroon/piztor/UserInfo.java
@@ -0,0 +1,7 @@
+package com.macaroon.piztor;
+
+public class UserInfo {
+ static String ip = "69.85.86.42";
+ static int port = 9990;
+ static int token = -1;
+}
diff --git a/features b/features
deleted file mode 100644
index efe2bf9..0000000
--- a/features
+++ /dev/null
@@ -1,18 +0,0 @@
-2013-08-20
-基本功能:
-
-1.把用户的位置显示在地图上,并且发送给所有用户
-2.班长用户组可以在地图上标识目标地点,发送给所有班级内成员
-3.用户管理中包含团队建制,同一区域内不同班级以不同的颜色(或配色)显示
-4.班长可以给全班发送消息
-5.地图的缩放
-
-预期功能:
-1.组员可以在设定好的路标处进行报道,全员报道后给出下一个路标,进行类似定向越野的活动
-2.在路标处要回答问题才可以得到下一个路标,或者下一个路标通过一些信息间接给出
-3.对于不在线的队员进行特殊显示
-4.对于同一区域内团队过多的情况进行特殊处理,比如显示范围过大时
-5.路标处的计时,多个团队进行评分
-6.搜索队员位置
-7.点击显示队员详情
-8.通知区域提醒
diff --git a/preview.jpg b/preview.jpg
deleted file mode 100644
index c5045de..0000000
--- a/preview.jpg
+++ /dev/null
Binary files differ
diff --git a/schedule.rst b/schedule.rst
deleted file mode 100644
index bdec0f4..0000000
--- a/schedule.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-=========== =================================================================
-Date Events
-=========== =================================================================
-Aug 22 - 搭建方便快捷的实测环境,编译并在手机上运行第一个demo --- done
- - 简单server和android的数据交换测试 --- done
- - 制定数据交换标准 --- almost
- - android UI各类事件捕获 --- done
- - UI和功能设计(画出层次图)--- not yet
- - 地图缩放功能 --- in progress
-
-Aug 23 - 制定数据交换标准
- - 开始设计完整的server, 初步完成Chat server
- - android UI按照设计实现部分界面,与Chat server对接
-
-Aug 24 - Location Management and Sync Issue
- - 更成熟的交互界面,尝试加入GPS座标读取
- - 诸多功能的设计
-
-Aug 25 - 共享并绘制位置,解决一些问题
- - 考虑必要的附加功能
-=========== =================================================================
diff --git a/server/README.rst b/server/README.rst
deleted file mode 100644
index e88c745..0000000
--- a/server/README.rst
+++ /dev/null
@@ -1 +0,0 @@
-Here is the folder of server-side implementation
diff --git a/server/client.py b/server/client.py
deleted file mode 100644
index 15f4bbc..0000000
--- a/server/client.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import socket
-import sys
-from struct import *
-from random import random
-from time import sleep
-
-def get_hex(data):
- return "".join([hex(ord(c))[2:].zfill(2) for c in data])
-
-HOST, PORT = "localhost", 9990
-
-def gen_auth(username, password):
- data = pack("!B", 0)
- data += username
- data += "\0"
- data += password
- return data
-
-def gen_update_location(token, lat, lont):
- return pack("!BLdd", 2, token, lat, lont)
-
-def gen_request_location(token, gid):
- return pack("!BLL", 3, token, gid)
-
-def send(data):
- try:
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- sock.connect((HOST, PORT))
-# print "Client " + str(sys.argv[1]) + ": connected"
- sock.sendall(data)
- print get_hex(data)
-# print "Client " + str(sys.argv[1]) + ": sent"
-# sock.shutdown(socket.SHUT_WR)
-# print "Client " + str(sys.argv[1]) + ": shutdown"
- received = sock.recv(1024)
- finally:
- print "adf"
- sock.close()
-
- print "Sent {}".format(get_hex(data))
- print "Received: {}".format(get_hex(data))
- return received
-
-#print "Client spawned:" + str(sys.argv[1])
-rec = send(gen_auth("hello", "world"))
-opt, token, status = unpack("!BLB", rec)
-
-rec = send(gen_update_location(token, random(), random()))
-opc, status = unpack("!BB", rec)
-
-rec = send(gen_request_location(token, 1))
-opc, length = unpack("!BL", rec[:5])
-idx = 5
-for i in xrange(length):
- uid, lat, lng = unpack("!Ldd", rec[idx:idx + 20])
- print (uid, lat, lng)
- idx += 20
-# sleep(60)
diff --git a/server/piztor/exc.py b/server/piztor/exc.py
index 5daf420..2c53dbf 100644
--- a/server/piztor/exc.py
+++ b/server/piztor/exc.py
@@ -1,6 +1,9 @@
class PiztorError(Exception):
pass
+class DBCurruptedError(PiztorError):
+ pass
+
class ConnectionError(PiztorError):
pass
@@ -10,5 +13,5 @@ class ReqReadError(ConnectionError):
class BadReqError(ConnectionError):
pass
-class InvalidTokenError(ConnectionError):
+class BadTokenError(ConnectionError):
pass
diff --git a/server/piztor/import.py b/server/piztor/import.py
index 1521849..84c990f 100644
--- a/server/piztor/import.py
+++ b/server/piztor/import.py
@@ -5,9 +5,10 @@ from model import *
path = "piztor.sqlite"
class UserData:
- def __init__(self, username, password, sex):
+ def __init__(self, username, password, gid, sex):
self.username = username
self.password = password
+ self.gid = gid
self.sex = sex
def create_database():
@@ -20,7 +21,7 @@ def import_user_data(data):
Session = sessionmaker(bind = engine)
session = Session()
for user in data:
- um = UserModel(username = user.username, sex = user.sex)
+ um = UserModel(username = user.username, gid = user.gid, sex = user.sex)
um.auth = UserAuth(user.password)
um.location = LocationInfo(lat = 0, lng = 0)
session.add(um)
@@ -38,7 +39,7 @@ if __name__ == '__main__':
while True:
line = f.readline().split()
if len(line) == 0: break
- data.append(UserData(line[0], line[1], line[2]))
+ data.append(UserData(line[0], line[1], line[2], line[3]))
create_database()
import_user_data(data)
diff --git a/server/piztor/model.py b/server/piztor/model.py
index d869c32..4621bbe 100644
--- a/server/piztor/model.py
+++ b/server/piztor/model.py
@@ -3,6 +3,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
Base = declarative_base()
+
_SALT_LEN = 16
_TOKEN_LEN = 16
@@ -15,6 +16,7 @@ class UserModel(Base):
__tablename__ = _TableName.UserModel
id = Column(Integer, primary_key = True)
+ gid = Column(Integer)
username = Column(String)
sex = Column(Boolean)
location = None
@@ -23,7 +25,7 @@ class UserModel(Base):
class LocationInfo(Base):
__tablename__ = _TableName.LocationInfo
- uid = Column(Integer, ForeignKey('users.id'), primary_key = True)
+ uid = Column(Integer, ForeignKey(_TableName.UserModel + '.id'), primary_key = True)
lat = Column(Float(precesion = 64))
lng = Column(Float(precesion = 64))
user = relationship("UserModel", uselist = False,
@@ -47,7 +49,7 @@ def _random_binary_string(length):
class UserAuth(Base):
__tablename__ = _TableName.UserAuth
- uid = Column(Integer, ForeignKey('users.id'), primary_key = True)
+ uid = Column(Integer, ForeignKey(_TableName.UserModel + '.id'), primary_key = True)
password = Column(LargeBinary)
salt = Column(LargeBinary)
token = Column(LargeBinary)
diff --git a/server/piztor/prob.py b/server/piztor/prob.py
new file mode 100644
index 0000000..4ccc957
--- /dev/null
+++ b/server/piztor/prob.py
@@ -0,0 +1,81 @@
+import socket
+from struct import *
+from random import random
+
+def get_hex(data):
+ return "".join([hex(ord(c))[2:].zfill(2) for c in data])
+
+host = "localhost"
+port = 9990
+
+def gen_auth(username, password):
+ length = 4 + 1 + len(username) + 1 + len(password)
+ data = pack("!LB", length, 0x00)
+ data += username
+ data += "\0"
+ data += password
+ return data
+
+def gen_update_location(token, username, lat, lng):
+ length = 4 + 1 + 32 + 8 + 8 + len(username) + 1
+ data = pack("!LB32s", length, 0x01, token)
+ data += username
+ data += chr(0)
+ data += pack("!dd", lat, lng)
+ return data
+
+def gen_request_location(token, username, gid):
+ length = 4 + 1 + 32 + 4 + len(username) + 1
+ data = pack("!LB32s", length, 0x02, token)
+ data += username
+ data += chr(0)
+ data += pack("!L", gid)
+ return data
+
+
+def send(data):
+ received = None
+ try:
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.connect((host, port))
+ print len(data)
+ sock.sendall(data)
+ received = sock.recv(1024)
+ finally:
+ sock.close()
+ return received
+
+from sys import argv
+
+if len(argv) == 2:
+ host = argv[1]
+
+username = "hello"
+password = "world"
+gid = 1
+
+resp = send(gen_auth(username, password))
+pl, optcode, status, uid, token = unpack("!LBBL32s", resp)
+print "size: " + str((pl, len(resp)))
+print "opt: " + str(optcode)
+print "status: " + str(status)
+print "uid: " + str(uid)
+print "token: " + get_hex(token)
+
+resp = send(gen_update_location(token, username, random(), random()))
+pl, optcode, status = unpack("!LBB", resp)
+print "size: " + str((pl, len(resp)))
+print "opt: " + str(optcode)
+print "status: " + str(status)
+
+resp = send(gen_request_location(token, username, gid))
+print len(resp)
+pl, optcode, status, length = unpack("!LBBL", resp[:10])
+print "size: " + str((pl, len(resp)))
+idx = 10
+print "length: " + str(len(resp[10:]))
+for i in xrange(length):
+ print len(resp[idx:idx + 20])
+ uid, lat, lng = unpack("!Ldd", resp[idx:idx + 20])
+ idx += 20
+ print (uid, lat, lng)
diff --git a/server/piztor/ptp.rst b/server/piztor/ptp.rst
new file mode 100644
index 0000000..004bbd9
--- /dev/null
+++ b/server/piztor/ptp.rst
@@ -0,0 +1,135 @@
+Piztor Transmission Protocol v0.3a
+----------------------------------
+
+- General
+
+ - Request
+
+ ::
+
+ +---4b---+---1b---+-------?b--------+
+ | LENGTH | OPT_ID | SPECIFIC DATA |
+ +--int---+-uchar--+-----------------+
+
+ - Response
+
+ ::
+
+ +---4b---+---1b---+------?b---------+
+ | LENGTH | OPT_ID | SPECIFIC DATA |
+ +--int---+-uchar--+-----------------+
+
+ Notice:
+
+ - In following sections, ``LENGTH`` part is left out for clarity.
+ - ``PADDING`` has value ``0``.
+ - ``AUTH_HEAD`` structure:
+
+ ::
+
+ +----32b-----+----?b----+----1b---+
+ | USER_TOKEN | USERNAME | PADDING |
+ +----raw-----+----------+---------+
+
+- Authentication
+
+ - Request
+
+ ::
+
+ +--1b---+-----?b------+----1b----+-----?b-----+
+ | 0x00 | USERNAME | PADDING | PASSWORD |
+ +-uchar-+-------------+----------+------------+
+
+ - Response
+
+ ::
+
+ +--1b---+---1b---+---4b----+----32b-----+
+ | 0x00 | STATUS | USER_ID | USER_TOKEN |
+ +-uchar-+--uchar-+---int---+----raw-----+
+
+ ``STATUS`` :
+
+ - ``0x00`` for success
+ - ``0x01`` for failure
+
+- Location Update
+
+ - Request
+
+ ::
+
+ +--1b---+-----?b------+----8b------+------8b-----+
+ | 0x01 | AUTH_HEAD | LATITUDE | LONGITUDE |
+ +-uchar-+-------------+---double---+---double----+
+
+ - Response
+
+ ::
+
+ +--1b---+---1b---+
+ | 0x01 | STATUS |
+ +-uchar-+--uchar-+
+
+ ``STATUS`` :
+
+ - ``0x00`` for success
+ - ``0x01`` for invalid token
+
+- Location Information
+
+ - Request
+
+ ::
+
+ +--1b---+------?b------+------4b-----+
+ | 0x02 | AUTH_HEAD | GROUP_ID |
+ +-uchar-+--------------+-----int-----+
+
+ - Response
+
+ ::
+
+ +--1b---+---1b---+-----4b----+------20b-------+-----+
+ | 0x02 | STATUS | ENTRY_CNT | LOCATION_ENTRY | ... |
+ +-uchar-+-uchar--+----int----+----------------+-----+
+
+ ``LOCATION_ENTRY`` :
+
+ ::
+
+ +---4b----+----8b----+-----8b----+
+ | USER_ID | LATITUDE | LONGITUDE |
+ +---int---+--double--+--double---+
+
+- User Information
+
+ - Request
+
+ ::
+
+ +--1b---+------?b------+------4b-----+
+ | 0x02 | AUTH_HEAD | USER_ID |
+ +-uchar-+--------------+-----int-----+
+
+ - Response
+
+ ::
+
+ +--1b---+---1b---+------?b-----+-----+
+ | 0x03 | STATUS | UINFO_ENTRY | ... |
+ +-uchar-+-uchar--+-------------+-----+
+
+ ``UINFO_ENTRY`` :
+
+ ::
+
+ +----1b----+-----?b-----+---1b----+
+ | INFO_KEY | INFO_VALUE | PADDING |
+ +--uchar---+------------+---------+
+
+ ``INFO_KEY`` :
+
+ :``0x00``: gid (value is a 4-byte ``long int``)
+ :``0x01``: sex (value is a 1-byte ``boolean``: ``True`` for male, ``False`` for female)
diff --git a/server/piztor/server.py b/server/piztor/server.py
new file mode 100644
index 0000000..2397225
--- /dev/null
+++ b/server/piztor/server.py
@@ -0,0 +1,321 @@
+from twisted.internet.protocol import Protocol
+from twisted.internet.protocol import Factory
+from twisted.internet.endpoints import TCP4ServerEndpoint
+from twisted.internet import reactor
+from twisted.protocols.policies import TimeoutMixin
+
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
+
+import struct
+import os
+import logging
+
+from exc import *
+from model import *
+
+def get_hex(data):
+ return "".join([hex(ord(c))[2:].zfill(2) for c in data])
+
+def print_datagram(data):
+ print "=================================="
+ print "Received datagram:"
+ print get_hex(data)
+ print "=================================="
+
+db_path = "piztor.sqlite"
+FORMAT = "%(asctime)-15s %(message)s"
+logging.basicConfig(format = FORMAT)
+logger = logging.getLogger('piztor_server')
+logger.setLevel(logging.INFO)
+
+
+class _SectionSize:
+ LENGTH = 4
+ OPT_ID = 1
+ STATUS = 1
+ USER_ID = 4
+ USER_TOKEN = 32
+ GROUP_ID = 4
+ ENTRY_CNT = 4
+ LATITUDE = 8
+ LONGITUDE = 8
+ LOCATION_ENTRY = USER_ID + LATITUDE + LONGITUDE
+ PADDING = 1
+
+class _OptCode:
+ user_auth = 0x00
+ location_update = 0x01
+ location_request= 0x02
+
+class _StatusCode:
+ sucess = 0x00
+ failure = 0x01
+
+class RequestHandler(object):
+ def __init__(self):
+ self.engine = create_engine('sqlite:///' + db_path, echo = False)
+ self.Session = sessionmaker(bind = self.engine)
+
+ @classmethod
+ def get_uauth(cls, token, username, session):
+ try:
+ uauth = session.query(UserAuth) \
+ .filter(UserAuth.token == token).one()
+
+ if uauth.user.username != username:
+ logger.warning("Toke and username mismatch")
+ return None
+
+ return uauth
+
+ except NoResultFound:
+ logger.warning("Incorrect token")
+ return None
+
+ except MultipleResultsFound:
+ raise DBCorruptedError()
+
+ @classmethod
+ def trunc_padding(cls, data):
+ leading = bytes()
+ for i in xrange(len(data)):
+ ch = data[i]
+ if ch == '\x00':
+ print get_hex(leading), get_hex(data[i + 1:])
+ return (leading, data[i + 1:])
+ else:
+ leading += ch
+ # padding not found
+ return (None, data)
+
+class UserAuthHandler(RequestHandler):
+
+ _user_auth_response_size = \
+ _SectionSize.LENGTH + \
+ _SectionSize.OPT_ID + \
+ _SectionSize.STATUS + \
+ _SectionSize.USER_ID + \
+ _SectionSize.USER_TOKEN
+
+ def handle(self, tr_data):
+ logger.info("Reading auth data...")
+ pos = -1
+ for i in xrange(0, len(tr_data)):
+ if tr_data[i] == '\x00':
+ pos = i
+ break
+ if pos == -1:
+ raise BadReqError("Authentication: Malformed request body")
+
+ username = tr_data[0:pos]
+ password = tr_data[pos + 1:]
+ logger.info("Trying to login with " \
+ "(username = {0}, password = {1})" \
+ .format(username, password))
+
+ session = self.Session()
+ try:
+ user = session.query(UserModel) \
+ .filter(UserModel.username == username).one()
+ except NoResultFound:
+ logger.info("No such user: {0}".format(username))
+ return struct.pack("!LBBL32s", UserAuthHandler \
+ ._user_auth_response_size,
+ _OptCode.user_auth,
+ _StatusCode.failure,
+ 0,
+ bytes('\x00' * 32))
+
+ except MultipleResultsFound:
+ raise DBCorruptedError()
+
+ uauth = user.auth
+ if uauth is None:
+ raise DBCorruptedError()
+ if not uauth.check_password(password):
+ logger.info("Incorrect password: {0}".format(username))
+ return struct.pack("!LBBL32s", UserAuthHandler \
+ ._user_auth_response_size,
+ _OptCode.user_auth,
+ _StatusCode.failure,
+ 0,
+ bytes('\x00' * 32))
+ else:
+ logger.info("Logged in sucessfully: {0}".format(username))
+ uauth.regen_token()
+ session.commit()
+ print "new token generated: " + get_hex(uauth.token)
+ return struct.pack("!LBBL32s", UserAuthHandler \
+ ._user_auth_response_size,
+ _OptCode.user_auth,
+ _StatusCode.sucess,
+ user.id,
+ uauth.token)
+
+
+class LocationUpdateHandler(RequestHandler):
+
+# _location_update_size = \
+# _SectionSize.AUTH_HEAD + \
+# _SectionSize.LATITUDE + \
+# _SectionSize.LONGITUDE
+
+ _location_update_response_size = \
+ _SectionSize.LENGTH + \
+ _SectionSize.OPT_ID + \
+ _SectionSize.STATUS
+
+ def handle(self, tr_data):
+ logger.info("Reading location update data...")
+
+ try:
+ token, = struct.unpack("!32s", tr_data[:32])
+ username, tail = RequestHandler.trunc_padding(tr_data[32:])
+ if username is None:
+ raise struct.error
+ lat, lng = struct.unpack("!dd", tail)
+ except struct.error:
+ raise BadReqError("Location update: Malformed request body")
+
+ logger.info("Trying to update location with "
+ "(token = {0}, username = {1}, lat = {2}, lng = {3})"\
+ .format(get_hex(token), username, lat, lng))
+
+ session = self.Session()
+ uauth = RequestHandler.get_uauth(token, username, session)
+ # Authentication failure
+ if uauth is None:
+ logger.warning("Authentication failure")
+ return struct.pack("!LBB", LocationUpdateHandler \
+ ._location_update_response_size,
+ _OptCode.location_update,
+ _StatusCode.failure)
+
+ ulocation = uauth.user.location
+ ulocation.lat = lat
+ ulocation.lng = lng
+ session.commit()
+
+ logger.info("Location is updated sucessfully")
+ return struct.pack("!LBB", LocationUpdateHandler \
+ ._location_update_response_size,
+ _OptCode.location_update,
+ _StatusCode.sucess)
+
+class LocationRequestHandler(RequestHandler):
+
+# _location_request_size = \
+# _SectionSize.AUTH_HEAD + \
+# _SectionSize.GROUP_ID
+
+ @classmethod
+ def _location_request_response_size(cls, item_num):
+ return _SectionSize.LENGTH + \
+ _SectionSize.OPT_ID + \
+ _SectionSize.STATUS + \
+ _SectionSize.ENTRY_CNT + \
+ _SectionSize.LOCATION_ENTRY * item_num
+
+ def handle(self, tr_data):
+ logger.info("Reading location request data..")
+
+ try:
+ token, = struct.unpack("!32s", tr_data[:32])
+ username, tail = RequestHandler.trunc_padding(tr_data[32:])
+ if username is None:
+ raise struct.error
+ gid, = struct.unpack("!L", tail)
+ except struct.error:
+ raise BadReqError("Location request: Malformed request body")
+
+ logger.info("Trying to request locatin with " \
+ "(token = {0}, gid = {1})" \
+ .format(get_hex(token), gid))
+
+ session = self.Session()
+ uauth = RequestHandler.get_uauth(token, username, session)
+ # Auth failure
+ if uauth is None:
+ logger.warning("Authentication failure")
+ return struct.pack("!LBBL", LocationRequestHandler \
+ ._location_request_response_size(0),
+ _OptCode.location_request,
+ _StatusCode.failure,
+ 0)
+
+ ulist = session.query(UserModel).filter(UserModel.gid == gid).all()
+ reply = struct.pack(
+ "!LBBL",
+ LocationRequestHandler._location_request_response_size(len(ulist)),
+ _OptCode.location_request,
+ _StatusCode.sucess,
+ len(ulist))
+
+ for user in ulist:
+ loc = user.location
+ reply += struct.pack("!Ldd", user.id, loc.lat, loc.lng)
+
+ return reply
+
+handlers = [UserAuthHandler,
+ LocationUpdateHandler,
+ LocationRequestHandler]
+
+def check_header(header):
+ return 0 <= header < len(handlers)
+
+class PTP(Protocol, TimeoutMixin):
+
+ def __init__(self, factory):
+ self.buff = bytes()
+ self.length = -1
+ self.factory = factory
+
+ def timeoutConnection(self):
+ logger.info("The connection times out")
+
+ def connectionMade(self):
+ logger.info("A new connection is made")
+ self.setTimeout(self.factory.timeout)
+
+ def dataReceived(self, data):
+ self.buff += data
+ self.resetTimeout()
+ print len(self.buff)
+ if len(self.buff) > 4:
+ try:
+ self.length, self.optcode = struct.unpack("!LB", self.buff[:5])
+ if not check_header(self.optcode): # invalid header
+ raise struct.error
+ except struct.error:
+ logger.warning("Invalid request header")
+ raise BadReqError("Malformed request header")
+ print self.length
+ if self.length == -1:
+ return
+ if len(self.buff) == self.length:
+ h = handlers[self.optcode]()
+ reply = h.handle(self.buff[5:])
+ logger.info("Wrote: %s", get_hex(reply))
+ self.transport.write(reply)
+ self.transport.loseConnection()
+
+ elif len(self.buff) > self.length:
+ self.transport.loseConnection()
+
+
+ def connectionLost(self, reason):
+ logger.info("The connection is lost")
+ self.setTimeout(None)
+
+class PTPFactory(Factory):
+ def __init__(self, timeout = 10):
+ self.timeout = timeout
+ def buildProtocol(self, addr):
+ return PTP(self)
+
+endpoint = TCP4ServerEndpoint(reactor, 9990)
+endpoint.listen(PTPFactory())
+reactor.run()
diff --git a/server/piztor_server.py b/server/piztor_server.py
deleted file mode 100644
index 514f95f..0000000
--- a/server/piztor_server.py
+++ /dev/null
@@ -1,234 +0,0 @@
-import sqlalchemy
-import SocketServer, socket, select
-import struct
-import os
-
-from sqlalchemy import create_engine
-from sqlalchemy import Column, Integer, String, Float
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import sessionmaker
-from random import randint
-
-engine = create_engine('sqlite:///t.sqlite', echo = False)
-Base = declarative_base()
-Session = sessionmaker(bind=engine)
-
-def get_hex(data):
- return "".join([hex(ord(c))[2:].zfill(2) for c in data])
-
-class PiztorError(Exception):
- def __init__(self, msg):
- self.err_msg = msg
- def __str__(self, msg):
- return self.err_msg
-
-class ConnectionError(PiztorError):
- pass
-
-class ReqReadError(ConnectionError):
- def __init__(self):
- super(ReqReadError, self).__init__("Error while reading request")
-
-class ReqInvalidError(ConnectionError):
- def __init__(self):
- super(ReqInvalidError, self).__init__("Invalid request")
-
-class TokenInvalidError(ConnectionError):
- def __init__(self):
- super(TokenInvalidError, self).__init__("Invalid token")
-
-class DataManager(object):
- def __init__(self, piz_srv):
- self.piz_srv = piz_srv
-
-class UserManager(DataManager):
-
- class User(Base):
- __tablename__ = 'users'
- id = Column(Integer, primary_key = True)
- gid = Column(Integer)
- username = Column(String)
- password = Column(String)
- token = Column(Integer)
-
- def get_user_by_token(self, token):
- session = Session()
- User = UserManager.User
- entries = session.query(User).filter(User.token == token).all()
- if len(entries) == 0:
- raise TokenInvalidError()
- return entries[0]
-
- def authentication_handle(self, opt_type, data):
- print "Parsing User Data"
- pos = -1
- for i in xrange(0, len(data)):
- if data[i] == '\0':
- print i
- if pos != -1:
- raise ReqInvalidError()
- pos = i
- break
- if pos == -1:
- raise ReqInvalidError()
- username = data[0:pos]
- password = data[pos + 1:]
-
- print "Trying to login with following info:"
- print (username, password)
-
- session = Session()
- entries = session.query(UserManager.User). \
- filter(UserManager.User.username == username).all()
- if len(entries) == 0:
- return struct.pack("!BLB", 0, 0, 1)
- entry = entries[0]
- if entry.password != password: # Auth failed
- print "Login failed!"
- return struct.pack("!BLB", 0, 0, 1)
- else: # Succeeded
- print "Logged in sucessfully!"
- entry.token = randint(0, 2147483647)
- session.commit()
- return struct.pack("!BLB", 0, entry.token, 0)
-
-
-class MesgManager(DataManager):
- def mesg_sending_handle(self, opt_type, data):
- print "Parsing Mesg Data"
- try:
- if len(data) < 8:
- raise ReqInvalidError()
- sender_token, recv_id = struct.unpack("!LL", data[:8])
- msg = data[8:]
- print (sender_token, recv_id, msg)
- return struct.pack("!B", 1)
- except struct.error:
- raise ReqInvalidError()
-
-class LocationManager(DataManager):
-
- class LocationInfo(Base):
- __tablename__ = "location_info"
- uid = Column(Integer, primary_key = True)
- lat = Column(Float(precesion = 64))
- lng = Column(Float(precesion = 64))
- # More: last_update
-
- def location_update_handle(self, opt_type, data):
- print "Parsing a Location Update"
- try:
- if len(data) < 8:
- raise ReqInvalidError()
- sender_token, lat, lng = struct.unpack("!Ldd", data)
- print "Updating location data with following info:"
- print (sender_token, lat, lng)
-
- user = self.piz_srv. \
- user_mgr.get_user_by_token(sender_token)
- session = Session()
- LInfo = LocationManager.LocationInfo
- q = session.query(LInfo).filter(LInfo.uid == user.id)
- entry = q.first()
- entry.lat = lat
- entry.lng = lng
- session.commit()
- print "Location update succeeded!"
- return struct.pack("!BB", 2, 0)
- except TokenInvalidError:
- print "Location update failed!"
- return struct.pack("!BB", 2, 1)
- except struct.error:
- raise ReqInvalidError()
-
- def location_request_handle(self, opt_type, data):
- print "Parsing a Location Request"
- try:
- if len(data) != 8:
- raise ReqInvalidError()
- sender_token, gid = struct.unpack("!LL", data)
- print "Requesting location data with following info:"
- print (sender_token, gid)
- session = Session()
- UInfo = UserManager.User
- LInfo = LocationManager.LocationInfo
- user_list = session.query(UInfo).filter(UInfo.gid == gid).all()
- reply = struct.pack("!BL", 3, len(user_list))
- for user in user_list:
- loc = session.query(LInfo).filter(LInfo.uid == user.id).first()
- reply += struct.pack("!Ldd", user.id, loc.lat, loc.lng)
- print get_hex(reply)
- return reply
- except struct.error:
- raise ReqInvalidError()
-
-class PiztorServer():
-
-
- class GenericHandler(SocketServer.StreamRequestHandler):
-
- def handle(self):
- print self.piz_srv
- sock = self.request
- sock.settimeout(100)
-# sock.setblocking(0)
- data = ""
- try:
- while True:
-# ready = select.select([sock], [], [], 10)
-# if not ready[0]:
-# raise ReqReadError()
- buff = sock.recv(4096)
- if len(buff) == 0:
- break # terminated
- else:
- data += buff
- sock.shutdown(socket.SHUT_RD)
-
- print "Got the data:" + get_hex(data)
-
- if len(data) < 1:
- print "invalid length"
- raise ReqInvalidError()
- opt_id = struct.unpack("!B", data[0])[0]
- print opt_id
- reply = self.piz_srv.mgr_map[opt_id](opt_id, data[1:])
- sock.sendall(reply)
- finally:
- sock.close()
-
- class ForkingEchoServer(SocketServer.ForkingMixIn, SocketServer.TCPServer):
- pass
-
- def __init__(self, host, port):
- PiztorServer.GenericHandler.piz_srv = self
- srv = PiztorServer.ForkingEchoServer((host, port),
- PiztorServer.GenericHandler)
- srv.request_queue_size = 100
-# srv.timeout = 2
- self.server = srv
-
- self.user_mgr = UserManager(self)
- self.mesg_mgr = MesgManager(self)
- self.location_mgr = LocationManager(self)
-
- self.mgr_map = [ self.user_mgr.authentication_handle,
- self.mesg_mgr.mesg_sending_handle,
- self.location_mgr.location_update_handle,
- self.location_mgr.location_request_handle]
-
- Base.metadata.create_all(engine)
-
-
- def run(self):
- try:
- self.server.serve_forever()
- except KeyboardInterrupt:
- print "Exiting..."
- self.server.shutdown()
- print "Server shutdown"
-
-if __name__ == "__main__":
-
- ps = PiztorServer("localhost", 9990)
- ps.run()
diff --git a/server/ptp.rst b/server/ptp.rst
deleted file mode 100644
index 4092399..0000000
--- a/server/ptp.rst
+++ /dev/null
@@ -1,93 +0,0 @@
-Piztor Transmission Protocol v0.1
----------------------------------
-
-- General
-
- - Request
-
- ::
-
- +---1b---+-------?b--------+
- | OPT ID | SPECIFIC DATA |
- +-uchar--+-----------------+
-
- - Response
-
- ::
-
- +---1b---+------?b---------+
- | OPT ID | SPECIFIC DATA |
- +-uchar--+-----------------+
-
-- Authentication
-
- - Request
-
- ::
-
- +--1b---+-----?b------+-----?b-----+
- | 0x00 | USERNAME | PASSWORD |
- +-uchar-+-------------+------------+
-
- - Response
-
- ::
-
- +--1b---+-----4b-----+---1b----+
- | 0x00 | USER_TOKEN | STATUS |
- +-uchar-+-----int----+--uchar--+
-
- ``STATUS`` :
-
- - 0x00 for success
- - 0x01 for failure
-
-- Location Update
-
- - Request
-
- ::
-
- +--1b---+------4b------+-----8b-----+------8b-----+
- | 0x02 | SENDER_TOKEN | LATITUDE | LONGITUDE |
- +-uchar-+------int-----+---double---+---double----+
-
- - Response
-
- ::
-
- +--1b---+---1b---+
- | 0x02 | STATUS |
- +-uchar-+--uchar-+
-
- ``STATUS`` :
-
- - 0x00 for success
- - 0x01 for invalid token
-
-- Location Information
-
- - Request
-
- ::
-
- +--1b---+-----4b-------+------4b-----+
- | 0x03 | SENDER_TOKEN | GROUP_ID |
- +-uchar-+-----int------+-----int-----+
-
- - Response
-
- ::
-
- +--1b---+-----4b----+------20b-------+-----+
- | 0x03 | ENTRY_CNT | LOCATION_ENTRY | ... |
- +-uchar-+---int-----+----------------+-----+
-
- ``LOCATION_ENTRY`` :
-
- ::
-
- +---4b----+----8b----+-----8b----+
- | USER_ID | LATITUDE | LONGITUDE |
- +---int---+--double--+--double---+
-
diff --git a/server/rush.py b/server/rush.py
deleted file mode 100644
index f01804c..0000000
--- a/server/rush.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from subprocess import Popen
-procs = []
-
-try:
- for i in xrange(10):
- p = Popen(["python", "client.py", str(i)])
- procs.append(p)
- #p.wait()
- print "done"
-
-except KeyboardInterrupt:
- print "killing"
- for p in procs:
- p.kill()