Eve Weinberg

Beacon Game Questions

I’ve commented in the code itself, but here is a long list if things I want to understand, mostly in order of how the flow of information jumps around as one plays the game:


LOGIN QUESTIONS:

on server.js /login route, where do these information come from:

thisUser.ip = request.ip; // get submitted client IP address
thisUser.adminKey = request.body.adminKey;

 

what is this function v4():

var thisUser = {
score : 0,
token : uuid.v4() // generate a token
};

 

how does the config file know the user’s IP?

 

//isn’t the first parameter “user.ip” true always bc we’re in a forEach loop?

users.forEach(function(user) {

if (user.ip && user.ip != thisUser.ip) {

 

when, where, how, is the service.UUID created in the config file?

exports.serviceUuid = ‘AAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE’;

 

when we call .end() on server.js, what socket is it closing?


 

CLAIM BEACON QUESTIONS (about existing code provided):

When we hit ‘claim beacon’ and post to route ‘/beacon’, how does it know our token?

What is happening when unlockEgg() gets called? It looks like it’s hitting a route called /start but I don’t see that?


 

CLIENT’S CORDOVA APP

Now, the big next question? How do we write something to run on a mobile device to sniff for these beacons automatically? Following the readME.md

First thing I did was $ cordova create BeaconClientEve

then $ cd BeaconClientEve

then $  cordova platform add android

then I replaced the www folder with Tom’s css,img,index.html, and js

then, ran $cordova prepare

then $cordova run

and received error:

Error: Failed to find ‘ANDROID_HOME’ environment variable. Try setting setting it manually.
Failed to find ‘android’ command in your ‘PATH’. Try update your ‘PATH’ to include path to valid SDK directory.

 

ok..i never installed android :)

 

scrap that, i’m going to use phone gap and follow these instructions:

http://itp.nyu.edu/~sve204/alwaysonalwaysconnected_spring15/week1.html

 

we will use Nobel and follow Tom’s BLE scan example and subscribe example.

 

if you know the UUID we are looking for – add it into this line:

if (state === ‘poweredOn’) {
noble.startScanning([‘UUID goes here no dashes’], false);

 

subscribeExample /

test.js

 

timeHat – line 10, add in charachteristic there.

 

nobel.on(readPeripheral, )

this connects to it, and read the services,

what are services and characteristics?

nobel.read()

line 54, charachteristic[c].read(functionName)

in that function —

functionNmae(error, data){

data.readIntLE()

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Next Post

Previous Post

Leave a Reply

© 2017 Eve Weinberg

Theme by Anders Norén