Coder Social home page Coder Social logo

xdrip-js's Introduction

xdrip-js

Join the chat at https://gitter.im/thebookins/xdrip-js Build Status

Please note this project is neither created nor backed by Dexcom, Inc. This software is not intended for use in therapy.

Prerequisites

Update node version. Please see wiki page for instructions https://github.com/thebookins/xdrip-js/wiki

Clients

See Lookout or xdrip-js-logger for two examples of applications built using this library.

Installation

cd ~/src
git clone https://github.com/thebookins/xdrip-js.git
cd xdrip-js
sudo npm install

Testing

npm test

Usage

Example

sudo node example <######> where <######> is the 6-character serial number of the transmitter.

To see verbose output, use sudo DEBUG=* node example <######>, or replace the * with a comma separated list of the modules you would like to debug. E.g. sudo DEBUG=smp,transmitter,bluetooth-manager node example <######>.

Events

See Node.js EventEmitter docs for more info on the event API.

Glucose read event

glucose = {
  inSession: <bool>,
  glucoseMessage: {
    status: <0: "ok" | 0x81: "lowBattery" | 0x83: "bricked">,
    sequence: <int>, // increments for each glucose value read
    timestamp: <int>, // in seconds since transmitter start
    glucoseIsDisplayOnly: <bool>,
    glucose: <int>, // in mg/dl
    state: <int>, // calibration state
    trend: <int>
  },
  timeMessage: {
    status: <0: "ok" | 0x81: "lowBattery" | 0x83: "bricked">,
    currentTime: <int>, // in seconds since transmitter start
    sessionStartTime: <int> // in seconds since transmitter start
  },
  status: <0: "ok" | 0x81: "lowBattery" | 0x83: "bricked">,
  state: <int>, // calibration state
  transmitterStartDate: <int>, // epoch time
  sessionStartDate: <int>, // epoch time
  readDate: <int>, // epoch time
  isDisplayOnly: <bool>,
  filtered: <float>, // mg/dl
  unfiltered: <float>, // mg/dl
  glucose: <int>, // mg/dl
  trend: <int>,
  canBeCalibrated: <bool>
}

transmitter.on('glucose', callback(glucose));

Message processed

details = {
  time: <int> // epoch time
}

transmitter.on('messageProcessed', callback(details));

Calibration data

calibrationData = {
  date: <int>, // epoch time
  glucose: <int> //mg/dl
};
transmitter.on('calibrationData', callback(calibrationData));

Transmitter disconnected

transmitter.on('disconnect', callback);

xdrip-js's People

Contributors

thebookins avatar efidoman avatar gitter-badger 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.