We have to first scan all the devices, we defined a list that contained all the Ble devices we got after scanning, and showed them in the app.
|
Algorithm 1if(first_scanning): // first time scanning devices add all the devices to view_list, foundBleDevice_list show all the devices in the view_list on app |
Algorithm 2if(specified): // user specified the device clear all the devices in view_list // clear all the devices add target_device to view_list // only shows the target device target_mac = target_device.getMacAddr() keep scanning, if (device.getMacAddr() == target_mac): update the rssi_value // update the distance |
After specifying the device, the app will keep tracking the device until it is out of range. BluetoothAdapter and its built-in methods are used to get the information of BLE devices.
|
We used serialport and nmea-0183 with Node.js to help us retrieve the geo data from GPS breakout and parse the data into proper format in Intel Edison. After acquiring and parsing the data, we put the data into DynamoDB. Note that the time we fetch from the GPS module is in UTC zone, therefore we have to deduct 4 in order to get the current time in EST.
|
Algorithm 3if (serialPort is open): // port open, retrieve data gps = nmea.parse(data) time, date, lat, lng = gps[‘time’]-4, gps[‘date’], gps[‘lat’], gps[‘lng’] put_item_to_DynamoDB(time,date,lat,lng) |
Algorithm 4most_recent_data = get_data_from_DynamoDB(); add marker to Google Map; |
When geo data is retrieved in Edison, we store the geo data in DynamoDB. At the app side, we get the geo data using the AWS library, and show the most recent geo data in our app[9]
|