Gateway Backend
The gateway backend has several tasks. First, it communicates with the Cups via the MQTT broker. It also writes all relevant data to the MongoDb.
In addition, the gateway communicates with the cloud, it loads user data from the cloud and pushes this data back into the cloud at the end of an event.
Finally, the backend also provides many API endpoints for the frontend.
The following endpoints are provided:
GET /Returns “Welcome to the Gateway backend!”GET /cup/scanPerforms a nfc scan and returns either a cupid or an errorGET /cup/ping/{id}Flashes the LED of the corresponding cup for a short timeGET /cup/{id}Returns a Cup { Id string, Bat int, UserHandle string}POST /cup/{id}/modeSets the cup in the corresponding modeGET /cupsReturns all cupsGET /game/{id}Returns the current gameGET /nextUsed for the GuessWho game to fetch a new guess while omitting the already displayed players from the Cloud.GET /winnerUsed for the GuessWho game to get the winnerGET /user/{cupId}/disconnectDisconnects a user form a cup and uploads the data to the Cloud.POST /user/orderPerforms a scan and then adds a drink to the scanned userGET /user/{userHandle}/checkDownloads user information from the Cloud.GET /user/{userHandle}/cup/{cupId}/connectPerforms a scan and connects the user by creating/pulling a session in/from the Cloud.GET /leaderboardReturns the leaderboard of all games
For Demo purposes:
GET /offShuts down the LED for all cupsGET /chargeSets all cups into the charging LED mode