Giter Club home page Giter Club logo

jewelapp's Introduction

Jewelapp

Jewelbots App for iOS/Android

Setup

TBA, this is an unfinished application. If you like, you can ask us questions on Slack here.

Build

  1. gulp - updates www folder
  2. ionic build ios - prepare app to be built in xcode
  3. XCode - Product -> Archive

Basic HTML stuff can be tested in the browser with ionic serve, but the bluetoothle library is not supported in the browser or emulator, so most of your testing will need to happen on a device itself.

See instructions to build and deploy to your phone here

Dependencies

Reading Firmware Services and Characteristics

Important Services and Characteristics

  • Service 180A - Device information

    • Firmware Revision: characteristic 2A26
    • Manufacturer Name: characteristic 2A29
  • Service 63400001-1A1E-5704-0A53-844BD14254A1 - Jewelbots Information

    • Read Friends List: characteristic 63400002-1A1E-5704-0A53-844BD14254A1 (referred to as 0002)
    • Write Friends List: characteristic 63400003-1A1E-5704-0A53-844BD14254A1 (referred to as 0003)

Friends List Data Structure

  • The friends will come from device as a flattened uint8array each "friend" is 8 bytes of the array, up to I think 16 friends so a if the friend list is [1,2,3,4,5,6,7,1,2,10,11,12,13,14,15,3] that's really 2 "friends" of [1,2,3,4,5,6,7,2] and [2,10,11,12,13,14,15,3].

  • In practice, it will always be "full", and any unused friend "slots" will be all zeroes.

  • The breakdown of each friend is first byte index, second-seventh bytes address (stored reversed), eighth byte color

    • e.g. [friend index 0, device address (reversed) 1-6, color 7]
    • so [1,97,134,83,125,97,221,2] is:
      • friend.index = 1 (first friend always 1, should never be 0, so 0 here means empty)
      • friend.address = 221:97:125:83:134:97 (reversed from how stored on device)
      • friend.color = 2 (blue)
  • Color codes: 0 = red, 1 = green, 2 = blue, 3 = cyan (will be more later but only 4 currently active)

Basic Bluetoothle Library Usage

iOS

Scan for devices ex: pair-ctrl.js

ionicReady().then(function () {
  // use initialize to get bluetooth up and running. will error if bluetooth not enabled on phone
  return $cordovaBluetoothle.initialize(params)
})
.then(function (data) {
  //startScan() scans for devices. You can filter with params
  return $cordovaBluetoothle.startScan(params);
})
.then(function (data) {
  for(var i=0;i < data.length; i++) {
    if (data[i].status === 'scanResult' && data[i].advertisement.isConnectable) {
      console.log(data[i])
    }
  }
  //make sure to stopScan()
  return $cordovaBluetoothle.stopScan();
})

Read Characteristics ex: dashboard-ctrl.js

On iOS, you will need to follow the same basic pattern to read a characteristic:

  1. initialize() bluetooth
  2. connect() to device
  3. discover services() for device
  4. discover characteristics() for a service
  5. read() a characteristic

You have to do this even if you already know which service and characteristic you want. Trying to go straight to the read() will result in an error.

var result = $cordovaBluetoothle.initialize({'request': true})
.then(function(data) {
  return $timeout($cordovaBluetoothle.connect(params))
})
.then(function(response) {
  return $cordovaBluetoothle.services({address: deviceId})
})
.then(function(response) {
  return $cordovaBluetoothle.characteristics({address: deviceId, service: "180A"});
})
.then(function(response) {
  return $cordovaBluetoothle.read({address: DataService.GetDeviceId(), service: "180A", characteristic: "2A26"})
})

jewelapp's People

Contributors

gortok avatar haydanek avatar sarace avatar sarajo avatar scottcreynolds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.