Skip to content

Cozie Development Guide

Prageeth Jayathissa edited this page Nov 9, 2019 · 5 revisions

Video Tutorial Playlist

https://www.youtube.com/playlist?list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA

Step By Step

1. Installation

https://www.youtube.com/watch?v=oLrP8FDAQd8&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=2&t=0s

Make sure you have npm, and node installed on your system

git init
git clone git@github.com:buds-lab/cozie.git
cd cozie
npm install
npx fitbit

Once successful you can open the Fitbit OS Simulator, run build, and then install to launch the project

2. Clockface

https://www.youtube.com/watch?v=Hys7XBrEMdg&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=2

Based off this design https://github.com/gedankenstuecke/Minimal-Clock

3. Uploading to the app store

Generally, you should just make a pull request and PJ will update the app on the store. However if you would like to create a completely new clone then this tutorial explains how

https://www.youtube.com/watch?v=5JaCrZBZbt0&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=3

4. Data Transfer from the the cellphone to the fitbit

https://www.youtube.com/watch?v=PapzIbgKyIQ&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=4

This is done using the following methods, and is a bit of a headache

filesystem: https://dev.fitbit.com/build/reference/device-api/fs/

5. Data Transfer from the fitbit to the cellphone

Also the same methods as in Section 4

https://www.youtube.com/watch?v=4Vj2H2CcgHc&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=5

6. Interacting with GUI elements

https://www.youtube.com/watch?v=HIwnjRJzFJA&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=6

7. Switching Between Screens

https://www.youtube.com/watch?v=Ue8fATt4EHc&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=7

8 Sending Data to the Cloud

This is done through an Amazon API Gateway. See https://github.com/buds-lab/cozie-gateway for the source AWS API Code.

let url = `https://ay1bwnlt74.execute-api.us-east-1.amazonaws.com/test`
fetch(url, {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(data) // data here is the cozie feedback data object
      })
      .then(res => {
          console.log(JSON.stringify(res))
      })
      .catch(function(error) {
          console.log('There has been a problem with your fetch operation: ', error.message);
      });

https://www.youtube.com/watch?v=qsJHL0tsaBc&list=PLkQs5WJXVHbiBDjmv-1tBYNUQOkmNCctA&index=8