{"id":603,"date":"2015-04-22T18:33:21","date_gmt":"2015-04-22T18:33:21","guid":{"rendered":"http:\/\/itp.fromjia.com\/?p=603"},"modified":"2015-04-22T22:04:58","modified_gmt":"2015-04-22T22:04:58","slug":"beacon-scavenger-game","status":"publish","type":"post","link":"http:\/\/itp.fromjia.com\/?p=603","title":{"rendered":"Beacon Scavenger Game"},"content":{"rendered":"<p><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5049_s.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-612\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5049_s-1024x227.jpg\" alt=\"IMG_5049_s\" width=\"730\" height=\"162\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5049_s-1024x227.jpg 1024w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5049_s-300x67.jpg 300w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5049_s.jpg 1200w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><\/p>\n<p>Today&#8217;s Understanding Networks class was a Beacon scavenger hunt. Tom and Maria Paula hid a group of Beacons (Arduinos and Raspberry Pi) around the floor. These Beacons share the same service UUID and characteristic UUID. The assignment and challenge was to build an app that would scan, connect and read the values of these characteristics and earn points. The first team to earn 50 points unlocks the golden egg, which is the last Beacon to discover.<\/p>\n<p>The game rule was to get close enough to each Beacon to claim them. Since the server that was checking this had no way of knowing the actual RSSI value any Beacon was sending to my phone, I cheated a bit by hardcoding the RSSI into my app, so I can scan and claim Beacons even if I&#8217;m not close enough. My team earned the most points but lost\u00a0the golden egg, because another team had connected to it with the LightBlue app. Just shows how sometimes using readymade technology and manual labor can beat out\u00a0hours of coding something automated from scratch.<\/p>\n<p>The code for my app is <a href=\"https:\/\/github.com\/OhJia\/BeaconScavenger\">here<\/a>.<\/p>\n<p>Here&#8217;s how the app worked. We didn&#8217;t have time to make an UI for the app, so I just added some alerts and appended responses in JSON to the html to understand what&#8217;s going on.<\/p>\n<div id=\"attachment_614\" style=\"width: 586px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app3.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-614\" class=\"size-large wp-image-614\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app3-576x1024.png\" alt=\"After login and retrieving a token from the server, I tap the scan button to scan all Beacons with a specific service UUID and list them out.\" width=\"576\" height=\"1024\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app3-576x1024.png 576w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app3-169x300.png 169w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app3.png 750w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/a><p id=\"caption-attachment-614\" class=\"wp-caption-text\">After login and retrieving a token from the server, I tap the scan button to scan all Beacons with a specific service UUID and list them out.<\/p><\/div>\n<div id=\"attachment_615\" style=\"width: 586px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app2.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-615\" class=\"size-large wp-image-615\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app2-576x1024.png\" alt=\"I tap on any of the listed Beacons to connect, read the value, package its data into an object, and post it to the server to claim points. \" width=\"576\" height=\"1024\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app2-576x1024.png 576w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app2-169x300.png 169w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app2.png 750w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/a><p id=\"caption-attachment-615\" class=\"wp-caption-text\">I tap on any of the listed Beacons to connect, read the value, package its data into an object, and post it to the server to claim points.<\/p><\/div>\n<div id=\"attachment_616\" style=\"width: 586px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app_ge.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-616\" class=\"size-large wp-image-616\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app_ge-576x1024.png\" alt=\"So close to claiming the golden egg!\" width=\"576\" height=\"1024\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app_ge-576x1024.png 576w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app_ge-169x300.png 169w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/app_ge.png 750w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/a><p id=\"caption-attachment-616\" class=\"wp-caption-text\">So close to claiming the golden egg!<\/p><\/div>\n<p>Most importantly, we all got cupcakes in the end.<\/p>\n<p><a href=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5045.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-617\" src=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5045-1024x768.jpg\" alt=\"IMG_5045\" width=\"730\" height=\"548\" srcset=\"http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5045-1024x768.jpg 1024w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5045-300x225.jpg 300w, http:\/\/itp.fromjia.com\/wp-content\/uploads\/2015\/04\/IMG_5045-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s Understanding Networks class was a Beacon scavenger hunt. Tom and Maria Paula hid a group of Beacons (Arduinos and Raspberry Pi) around the floor. These Beacons share the same service UUID and characteristic UUID. The assignment and challenge was to build an app that would scan, connect and read the values of these characteristics [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-603","post","type-post","status-publish","format-standard","hentry","category-understanding-networks"],"_links":{"self":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=603"}],"version-history":[{"count":4,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions"}],"predecessor-version":[{"id":619,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=\/wp\/v2\/posts\/603\/revisions\/619"}],"wp:attachment":[{"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=603"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/itp.fromjia.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}