Commit e8e59064 authored by Andres Käver's avatar Andres Käver

hw3

parent b8f192cd
......@@ -56,4 +56,45 @@ Person +----< PersonContact >----+ Contact type
Andres - akaver - skype
- akaver2 - skype
- akaver@itcollege.ee - skype
\ No newline at end of file
#### HW03 Final Project - GPS SportMap
***Deadline 2021-01-03 23:59:59***
App like endomondo, nike run, strava, runtastic, etc.
General idea - app, that would help you in unknown terrain with navigation and training.
App is based on Google Maps (or openstreetmap or some other) and built-in GPS functionality.
Display map, and update your location on map display.
Allow toggling of "keep map constantly centered", "keep north-up / direction up / user chosen-up".
When tracking is started, start to draw trail from start to current location.
Allow user to set checkpoints (permanent) and waypoints (single) on track. Ie when adding new waypoint, remove previous.
Calculate and display direct and travelled distance from start, last checkpoint and last waypoint.
Time elapsed from start, overall pace (in minutes per km) in every three sections.
Save all the sessions and all the checkpoints to database.
Allow user to view/delete old sessions - display statistics and track on map.
For controlling the app from lock screen, implement sticky custom layout notification - UI similar to what you have under the map.
When user stops session, ask for confirmation. Do not let to start/stop session from lock-screen.
Constantly(after every position update) update notification to display current info - distances and pace.
GPS listener and notification intents broadcast listener has to be implemented in service, otherwise app cannot be kept running in background.
App has to support rotation (and state has to be restored) - move buttons from bottom to left-or-right screen edge in landscape mode.
Provide on-screen real compass (must be possible to turn on-and-off). Google maps rotation indicator is not a compass.
Provide session export possibility - ie as email attachment for example. File format - gpx.
https://www.topografix.com/gpx_manual.asp (checkpoints as waypoints in gpx format).
Gpx entries have to contain coordinates of every location update and user set WP coordinates and timestamp (for later track analysis and animation).
Allow creating user account and sync data to central Web-API/Rest backend (provided by teacher).
Change app icon into something more meaningful.
***Checkpoint - CP*** - some predefined marked location on terrain and on paper map. When you did find the CP, mark it's location in app. Gets saved to DB.
***Waypoint - WP*** - temporary marker, used to measure smaller segments on terrain to find path to next CP. When placing new WP, previous one is removed. WPs do not get saved to DB.
# HW3 - Backend
All projects for SportMap:
https://git.akaver.com/com-akaver-sportmap
Full source code for the backend is visible here:
https://git.akaver.com/com-akaver-sportmap/sportmap-aspnet
ERD schema is simple:
* GpsSession - training sessions
* GpsLocation - locations for session (WP, CP, regular)
* GpsLocationType - LocationTypes for location
Base url for RESTful api: https://sportmap.akaver.com/api/v1.0/
Check the latest api version from swagger documentation:
https://sportmap.akaver.com/swagger/index.html
Set the header on every request:
***Content-Type application/json***
Create account, log in - get and save the jwt.
POST https://sportmap.akaver.com/api/v1.0/account/register
Payload in body as json:
~~~~json
{
"email": "akaver1@akaver.com",
"password": "Kala.maja2020",
"lastName": "Andres",
"firstName": "Käver"
}
~~~~
or
POST https://sportmap.akaver.com/api/v1.0/account/login
Payload in body as json:
~~~~json
{
"email": "akaver1@akaver.com",
"password": "Kala.maja2020",
}
~~~~
Response for successful register and login:
~~~~json
{
"token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjU2MGIxMWM5LWVlYTYtNDNhMy1jYTViLTA4ZDdlMTc3MGNhOSIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJha2F2ZXJAYWthdmVyLmNvbSIsIkFzcE5ldC5JZGVudGl0eS5TZWN1cml0eVN0YW1wIjoiMlozVzZEMkozT1RTS0dNQ0xMU09IM1ZZS1pUQkxYRk4iLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3JvbGUiOlsidXNlciIsImFkbWluIl0sImV4cCI6MTU4OTYxNDczNSwiaXNzIjoiY29tLmFrYXZlci5zcG9ydG1hcCIsImF1ZCI6ImNvbS5ha2F2ZXIuc3BvcnRtYXAifQ.B0YNH-0rUgethh3TgdQXV7s3PcM87OgQBPJ2VTnBnw4d64dG4z-V4QztKbwYyPUNRtdzc7Gc89Bdsi2egYjdgA",
"status": "User akaver@akaver.com logged in."
}
~~~~
On every request include token and content-type in request header:
***Authorization Bearer eyJhbGciOiJIU...***
***Content-Type application/json***
There are 3 RESTful endpoints defined for your app:
* https://sportmap.akaver.com/api/v1.0/GpsSessions
* https://sportmap.akaver.com/api/v1.0/GpsLocations
* https://sportmap.akaver.com/api/v1.0/GpsLocationTypes
Start a new session:
POST https://sportmap.akaver.com/api/v1.0/GpsSessions
Payload in body as json:
~~~json
{
"name": "2020-04-15",
"description": "2020-04-15 evening run",
"recordedAt": "2020-04-15T23:41:57.352165+03:00",
"minSpeed": 420,
"maxSpeed": 600,
}
~~~
Response will be:
~~~json
{
"name": "2020-04-15",
"description": "2020-04-15 evening run",
"recordedAt": "2020-04-15T23:41:57.352165+03:00",
"duration": 0,
"speed": 0,
"distance": 0,
"climb": 0,
"descent": 0,
"appUserId": "560b11c9-eea6-43a3-ca5b-08d7e1770ca9",
"id": "b310e8ce-eebd-47b0-91c3-08d7e17d70ab"
}
~~~~
Save the session id!
Duration, speed etc will be calculated by the backend as data arrives.
Get the list of location types (these are predefined in db, id's and types are fixed)
GET https://sportmap.akaver.com/api/v1.0/GpsLocationTypes
Response will be:
~~~~json
[
{
"name": "LOC",
"description": "Regular periodic location update",
"id": "00000000-0000-0000-0000-000000000001"
},
{
"name": "WP",
"description": "Waypoint - temporary location, used as navigation aid",
"id": "00000000-0000-0000-0000-000000000002"
},
{
"name": "CP",
"description": "Checkpoint - found on terrain the location marked on the paper map",
"id": "00000000-0000-0000-0000-000000000003"
}
]
~~~~
Post the location updates to backend:
POST https://sportmap.akaver.com/api/v1.0/GpsLocations
Payload in body as json:
~~~json
{
"recordedAt": "2020-04-15T23:51:57.352165+03:00",
"latitude": 23.456,
"longitude": 59.789,
"accuracy": 15.5,
"altitude": 75.7,
"verticalAccuracy": 13.9,
"gpsSessionId": "b310e8ce-eebd-47b0-91c3-08d7e17d70ab",
"gpsLocationTypeId": "00000000-0000-0000-0000-000000000001"
}
~~~
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment