-
Notifications
You must be signed in to change notification settings - Fork 2
Shake my egg
Here, a user first scans the QR-code on the egg. This QR-code contains a unique ID which allows the user to claim that he or she has found the egg. Subsequently, the user shakes the egg. Which wakes-up the microprocessor and a LoRa packet is sent to the TTN which registers the egg. Thereafter, the user needs to claim the egg by means of the code from the QR-code. A database will contain all the eggs with their corresponding locations and their finders.
The egg will feature an XXXXXX (@Guus/Geoff) which offers the functionality to wake the microprocessor when a shaking motion is detected. A LoRa message is made containing a unique hard-coded ID. This ID will be used at the DB to link the finder with the egg.
The egg will include:
- QR-code containing its unique ID
- Accelerometer XXXXX (@Guus/Geoff)
All eggs will operate in the same TTN application. This application will include an integration with a DB. When a message is received from the egg, the unique ID will be sent to a DB with the corresponding local time. This timestamp will be used to validate the claim that an egg is found by the user. More precisely, the maximum time between receiving the shake LoRa message and the registration needs to be less than one minute. Otherwise, the linking has not succeeded.
The application will have an MQTT integration to notify the users that an egg is shaken. The specific location of the egg will be, however, unknown to the users. They will only know that an egg was shaken. More information regarding MQTT for TTN can be found here.
Application key needed for MQTT: ttn-account-v2.YYnDLDchvZxg5z7RCTRaO9o2ksDCbGxPrZncfmbAQKc
A PHP script will integrate the users claim and the egg shake with the database: dramco.be/demos/shake-my-egg/api/user-claim
. The script will check the condition as explained in Section TTN.
The database will be hosted at dramco.be
. The database will include the following table:
Unique Egg ID | latitude | longitude | timestamp Shake | User |
---|---|---|---|---|
144e65465 | 51.173822 | 3.958036 | 1528243230 | Gilles C |
5354ee351 | 51.061153 | 3.708705 | 1519849029 | |
564f6f46 | 51.091819 | 3.967715 |
Register a claim for an egg by a user.
URL : dramco.be/demos/shake-my-egg/api/user-claim.php
Method : POST
Auth required : No
Permissions required : None
Data examples
Partial data is not allowed.
{
"name": "player007",
"egg_id" : 144e65465
}
Condition : Data provided is valid.
Code : 200 OK
Content example : Response will reflect back the claim.
If the claim was successful:
{
"success": true,
"latitude" : 51.173822,
"longitude" : 3.958036
}
If not:
{
"success": false
}
Request the number of eggs which are still hidden or found and their location.
URL : dramco.be/demos/shake-my-egg/api/hidden-eggs.php
Method : GET
Auth required : No
Permissions required : None
Code : 200 OK
Content example : Response will contain the number of eggs that are still hidden and found (+ their location).
{
"hidden":1,
"found":2,
"locations":
[
{
"latitude":"51.1738",
"longitude":"3.95804"
},
{
"latitude":"51",
"longitude":"3"
}
]
}
URL : dramco.be/demos/shake-my-egg/api/location.php?id={id}
Method : GET
Auth required : No
Permissions required : None
Code : 200 OK
Content example : Response will contain the location of the requested egg (id).
{
"id":"1",
"latitude":"51.1738",
"longitude":"3.95804"
}
Unregister a claim for an egg by a user.
URL : dramco.be/demos/shake-my-egg/api/remove-user.php?id={id}
Method : GET
(ino not the best method)
Auth required : No
Permissions required : None
Code : 200 OK