diff --git a/MFRC522-RPi/.gitignore b/.gitignore
similarity index 100%
rename from MFRC522-RPi/.gitignore
rename to .gitignore
diff --git a/FLPClient APK/AndroidManifest.xml b/FLPClient APK/AndroidManifest.xml
deleted file mode 100644
index 120e380..0000000
--- a/FLPClient APK/AndroidManifest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/FLPClient APK/MainActivity.java b/FLPClient APK/MainActivity.java
deleted file mode 100644
index d6fc745..0000000
--- a/FLPClient APK/MainActivity.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package com.example.fusedlocation;
-
-import android.Manifest;
-import android.content.DialogInterface;
-import android.content.pm.PackageManager;
-import android.location.Location;
-import android.os.Build;
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.ActivityCompat;
-import android.support.v7.app.AlertDialog;
-import android.support.v7.app.AppCompatActivity;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GoogleApiAvailability;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.location.LocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationServices;
-
-import java.util.ArrayList;
-
-public class MainActivity extends AppCompatActivity
- implements GoogleApiClient.ConnectionCallbacks,
- GoogleApiClient.OnConnectionFailedListener, LocationListener{
-
- private Location location;
- private TextView locationTv;
- private GoogleApiClient googleApiClient;
- private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
- private LocationRequest locationRequest;
- private static final long UPDATE_INTERVAL = 5000, FASTEST_INTERVAL = 5000; // = 5 seconds
- // lists for permissions
- private ArrayList permissionsToRequest;
- private ArrayList permissionsRejected = new ArrayList<>();
- private ArrayList permissions = new ArrayList<>();
- // integer for permissions results request
- private static final int ALL_PERMISSIONS_RESULT = 1011;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- locationTv = findViewById(R.id.location);
- // we add permissions we need to request location of the users
- permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);
- permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);
-
- permissionsToRequest = permissionsToRequest(permissions);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- if (permissionsToRequest.size() > 0) {
- requestPermissions(permissionsToRequest.toArray(
- new String[permissionsToRequest.size()]), ALL_PERMISSIONS_RESULT);
- }
- }
-
- // we build google api client
- googleApiClient = new GoogleApiClient.Builder(this).
- addApi(LocationServices.API).
- addConnectionCallbacks(this).
- addOnConnectionFailedListener(this).build();
- }
-
- private ArrayList permissionsToRequest(ArrayList wantedPermissions) {
- ArrayList result = new ArrayList<>();
-
- for (String perm : wantedPermissions) {
- if (!hasPermission(perm)) {
- result.add(perm);
- }
- }
-
- return result;
- }
-
- private boolean hasPermission(String permission) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- return checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED;
- }
-
- return true;
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- if (googleApiClient != null) {
- googleApiClient.connect();
- }
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- if (!checkPlayServices()) {
- locationTv.setText("You need to install Google Play Services to use the App properly");
- }
- }
-
- @Override
- protected void onPause() {
- super.onPause();
-
- // stop location updates
- if (googleApiClient != null && googleApiClient.isConnected()) {
- LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, this);
- googleApiClient.disconnect();
- }
- }
-
- private boolean checkPlayServices() {
- GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
- int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
-
- if (resultCode != ConnectionResult.SUCCESS) {
- if (apiAvailability.isUserResolvableError(resultCode)) {
- apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST);
- } else {
- finish();
- }
-
- return false;
- }
-
- return true;
- }
-
- @Override
- public void onConnected(@Nullable Bundle bundle) {
- if (ActivityCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
- && ActivityCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- return;
- }
-
- // Permissions ok, we get last location
- location = LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
-
- if (location != null) {
- locationTv.setText("Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
- }
-
- startLocationUpdates();
- }
-
- private void startLocationUpdates() {
- locationRequest = new LocationRequest();
- locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
- locationRequest.setInterval(UPDATE_INTERVAL);
- locationRequest.setFastestInterval(FASTEST_INTERVAL);
-
- if (ActivityCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
- && ActivityCompat.checkSelfPermission(this,
- Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- Toast.makeText(this, "You need to enable permissions to display location !", Toast.LENGTH_SHORT).show();
- }
-
- LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
- }
-
- @Override
- public void onConnectionSuspended(int i) {
- }
-
- @Override
- public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
- }
-
- @Override
- public void onLocationChanged(Location location) {
- if (location != null) {
- locationTv.setText("Latitude : " + location.getLatitude() + "\nLongitude : " + location.getLongitude());
- }
- }
-
- @Override
- public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
- switch(requestCode) {
- case ALL_PERMISSIONS_RESULT:
- for (String perm : permissionsToRequest) {
- if (!hasPermission(perm)) {
- permissionsRejected.add(perm);
- }
- }
-
- if (permissionsRejected.size() > 0) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- if (shouldShowRequestPermissionRationale(permissionsRejected.get(0))) {
- new AlertDialog.Builder(MainActivity.this).
- setMessage("These permissions are mandatory to get your location. You need to allow them.").
- setPositiveButton("OK", new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- requestPermissions(permissionsRejected.
- toArray(new String[permissionsRejected.size()]), ALL_PERMISSIONS_RESULT);
- }
- }
- }).setNegativeButton("Cancel", null).create().show();
-
- return;
- }
- }
- } else {
- if (googleApiClient != null) {
- googleApiClient.connect();
- }
- }
-
- break;
- }
- }
-}
diff --git a/FLPClient APK/README.md b/FLPClient APK/README.md
deleted file mode 100644
index e5e0228..0000000
--- a/FLPClient APK/README.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# FusedLocationProvider Client
-
-### Overview
-Contains the code for building the FusedLocationProvider Client app in Android for fetching GPS data using Google API. This is based from this [Medium](https://medium.com/@ssaurel/getting-gps-location-on-android-with-fused-location-provider-api-1001eb549089) article and I modified it to send the GPS data to Raspberry Pi via TCP.
-
-### Reference
-https://medium.com/@ssaurel/getting-gps-location-on-android-with-fused-location-provider-api-1001eb549089
diff --git a/FLPClient APK/activity_main.xml b/FLPClient APK/activity_main.xml
deleted file mode 100644
index f81a8d9..0000000
--- a/FLPClient APK/activity_main.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/FLPClient APK/build.gradle b/FLPClient APK/build.gradle
deleted file mode 100644
index bbeb32b..0000000
--- a/FLPClient APK/build.gradle
+++ /dev/null
@@ -1,29 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 28
- defaultConfig {
- applicationId "com.example.fusedlocation"
- minSdkVersion 23
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'com.android.support:appcompat-v7:28.0.0'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
- implementation 'com.google.android.gms:play-services-location:15.0.1'
- testImplementation 'junit:junit:4.12'
- androidTestImplementation 'com.android.support.test:runner:1.0.2'
- androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
-}
diff --git a/MFRC522-RPi/MFRC522(backup).py b/MFRC522(backup).py
similarity index 100%
rename from MFRC522-RPi/MFRC522(backup).py
rename to MFRC522(backup).py
diff --git a/MFRC522-RPi/README.md b/README.md
similarity index 54%
rename from MFRC522-RPi/README.md
rename to README.md
index b69a1a2..5811549 100644
--- a/MFRC522-RPi/README.md
+++ b/README.md
@@ -23,3 +23,12 @@ A simple script that utilizes the Raspberry Pi and a MFRC522 module to emulate t
## Usage
1. Install SPI-Py from [here](https://github.com/lthiery/SPI-Py)
2. Run ``` python app.py ```
+
+## Experimental Variants
+Two variants will be implemented with this project. These variants will implement distance-dependent fare rate using GPS data from an Android phone. Vincenty's Formulae will be used for approximating the P2P distance.
+
+1. GPSL+ Variant
+* a variant that will use the GPSLogger app for dynamic fare charges by retrieving location data using an Android phone
+
+2. FCPClient Variant
+* similar to GPSL+. However, unlike GPSL+, this variant will use the [Fused Location Provider API](https://developers.google.com/location-context/fused-location-provider/) for fetching location data and implement a TCP socket for retrieving data
diff --git a/MFRC522-RPi/__init__.py b/__init__.py
similarity index 100%
rename from MFRC522-RPi/__init__.py
rename to __init__.py
diff --git a/MFRC522-RPi/app.py b/app.py
similarity index 100%
rename from MFRC522-RPi/app.py
rename to app.py
diff --git a/MFRC522-RPi/cards.py b/cards.py
similarity index 100%
rename from MFRC522-RPi/cards.py
rename to cards.py
diff --git a/MFRC522-RPi/module/MFRC522.py b/module/MFRC522.py
similarity index 100%
rename from MFRC522-RPi/module/MFRC522.py
rename to module/MFRC522.py
diff --git a/MFRC522-RPi/module/__init__.py b/module/__init__.py
similarity index 100%
rename from MFRC522-RPi/module/__init__.py
rename to module/__init__.py
diff --git a/MFRC522-RPi/module/base.py b/module/base.py
similarity index 100%
rename from MFRC522-RPi/module/base.py
rename to module/base.py
diff --git a/MFRC522-RPi/module/read_card.py b/module/read_card.py
similarity index 100%
rename from MFRC522-RPi/module/read_card.py
rename to module/read_card.py
diff --git a/MFRC522-RPi/module/wipe_card.py b/module/wipe_card.py
similarity index 100%
rename from MFRC522-RPi/module/wipe_card.py
rename to module/wipe_card.py
diff --git a/MFRC522-RPi/module/write_card.py b/module/write_card.py
similarity index 100%
rename from MFRC522-RPi/module/write_card.py
rename to module/write_card.py