Skip to content

thebookins/xdrip-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/xdrip-js/xdrip-js/wiki

Clients

See Lookout or Logger for two examples of applications built using this library.

Installation

cd ~/src
git clone https://github.com/xdrip-js/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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%