Skip to content

Commit

Permalink
Merge pull request #1118 from tidepool-org/release-2.28.0
Browse files Browse the repository at this point in the history
v2.28.0 (UPLOAD-24, UPLOAD-297, UPLOAD-304 AND UPLOAD-313)
  • Loading branch information
gniezen authored Apr 8, 2020
2 parents b5b2eb0 + 5774516 commit d598040
Show file tree
Hide file tree
Showing 78 changed files with 1,407 additions and 183 deletions.
16 changes: 9 additions & 7 deletions app/components/UpdatePlease.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export default class UpdatePlease extends Component {
render() {
const { knowledgeBaseLink, updateText } = this.props;
return (
<div className={styles.outdated}>
<div className={styles.text}>
<p className={styles.paragraph}>{updateText.NEEDS_UPDATED}</p>
<p className={styles.paragraph}>{updateText.IMPROVEMENTS}</p>
<p className={styles.mostImportant}>
Follow <a className={styles.link} href={knowledgeBaseLink} target="_blank">these instructions</a> to do so.
</p>
<div className={styles.modalWrap}>
<div className={styles.modal}>
<div className={styles.text}>
<p className={styles.lineOne}>{updateText.NEEDS_UPDATED}</p>
<p className={styles.lineTwo}>{updateText.IMPROVEMENTS}</p>
<p className={styles.mostImportant}>
Follow <a className={styles.link} href={knowledgeBaseLink} target="_blank">these instructions</a> to do so.
</p>
</div>
</div>
</div>
);
Expand Down
35 changes: 26 additions & 9 deletions app/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,33 @@ export class App extends Component {
log: this.log
});

const addServers = (servers) => {
if (servers && servers.length && servers.length > 0) {
for (let server of servers) {
const protocol = server.name === 'localhost' ? 'http://' : 'https://';
const url = protocol + server.name + ':' + server.port;
serverdata[server.name] = {
API_URL: url,
UPLOAD_URL: url,
DATA_URL: url + '/dataservices',
BLIP_URL: url,
};
}
} else {
this.log('No servers found');
}
};

dns.resolveSrv('environments-srv.tidepool.org', (err, servers) => {
for (let server of servers) {
const protocol = server.name === 'localhost' ? 'http://' : 'https://';
const url = protocol + server.name + ':' + server.port;
serverdata[server.name] = {
API_URL: url,
UPLOAD_URL: url,
DATA_URL: url + '/dataservices',
BLIP_URL: url,
};
if (err) {
this.log(`DNS resolver error: ${err}. Retrying...`);
dns.resolveSrv('environments-srv.tidepool.org', (err2, servers2) => {
if (!err2) {
addServers(servers2);
}
});
} else {
addServers(servers);
}
});

Expand Down
21 changes: 19 additions & 2 deletions app/main.dev.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global __ROLLBAR_POST_TOKEN__ */
import _ from 'lodash';
import { app, BrowserWindow, Menu, shell, ipcMain, crashReporter } from 'electron';
import { app, BrowserWindow, Menu, shell, ipcMain, crashReporter, dialog } from 'electron';
import os from 'os';
import osName from 'os-name';
import open from 'open';
import { autoUpdater } from 'electron-updater';
import * as chromeFinder from 'chrome-launcher/dist/chrome-finder';
Expand Down Expand Up @@ -106,7 +107,23 @@ app.on('ready', async () => {

mainWindow.loadURL(`file://${__dirname}/app.html`);

mainWindow.webContents.on('did-finish-load', () => {
mainWindow.webContents.on('did-finish-load', async () => {
if (osName() === 'Windows 7') {
const options = {
type: 'info',
title: 'Please update to a modern operating system',
message:
`Windows 7 won't be patched for any new viruses or security problems
going forward.
While Windows 7 will continue to work, Microsoft recommends you
start planning to upgrade to Windows 10, or an alternative
operating system, as soon as possible.`,
buttons: ['Continue']
};
await dialog.showMessageBox(options);
}

mainWindow.show();
mainWindow.focus();
checkUpdates();
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tidepool-uploader",
"productName": "tidepool-uploader",
"version": "2.27.0",
"version": "2.28.0",
"description": "Tidepool Project Universal Uploader",
"main": "./main.prod.js",
"author": {
Expand Down
7 changes: 7 additions & 0 deletions app/reducers/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ const devices = {
source: {type: 'device', driverId: 'BayerContourNext'},
enabled: {mac: true, win: true, linux: true}
},
bayercontour: {
instructions: 'Plug in meter with cable and make sure meter is switched on',
key: 'bayercontour',
name: 'Ascensia (Bayer) Contour Next EZ, Contour or Contour Link',
source: {type: 'device', driverId: 'BayerContour'},
enabled: {mac: true, win: true, linux: true}
},
animas: {
instructions: 'Suspend and align back of pump with IR dongle front',
key: 'animas',
Expand Down
39 changes: 39 additions & 0 deletions docs/checklists/bayerContour.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Checklist for Blood Glucose Meter Implementation

(Key:

- `[x]` available in data protocol/documented in spec and implemented
- `[-]` available in data protocol/documented in spec but *not* yet implemented
- `[?]` unknown whether available in data protocol/documented in spec; *not* yet implemented
- `*[ ]` TODO: needs implementation!
- `[ ]` unavailable in data protocol and/or not documented in spec and not yet implemented)

### Required if Present

- `[x]` smbg values
- `[x]` units of smbg values (read from device, not hard-coded)
- `[x]` out-of-range values (LO or HI)
- `[x]` out-of-range value thresholds (e.g., often 20 for low and 600 for high on BGMs)
- `[ ]` date & time settings changes
- `[ ]` blood ketone values
- `[ ]` units of blood ketone values (read from device, not hard-coded)
- `[ ]` ketone out-of-range values
- `[ ]` ketone out-of-range value thresholds
- `[x]` use `common.checkDeviceTime(currentDeviceTime, timezone, cb)` to check against server time

### No Tidepool Data Model Yet

- `[x]` control (solution) tests (whether marked in UI or auto-detected) - until we have a data model, these should be discarded
- `[ ]` device settings, other than date & time (e.g., target blood glucose range)
- `[-]` tag/note (e.g., pre- vs. post-meal)

### Tidepool ingestion API

Choose one of the following:

- `[ ]` legacy "jellyfish" ingestion API
- `[x]` platform ingestion API

### Known implementation issues/TODOs

*Use this space to describe device-specific known issues or implementation TODOs **not** contained in the above datatype-specific sections.*
2 changes: 2 additions & 0 deletions docs/checklists/caresensNPremierBluetooth.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ Choose one of the following:
### Known implementation issues/TODOs

*Use this space to describe device-specific known issues or implementation TODOs **not** contained in the above datatype-specific sections.*

It is not possible to distinguish between CareSens models when uploading via Bluetooth, as the Bluetooth advertising name for Premier and Dual meters uses the same format ("CareSens + 4 digits")
23 changes: 21 additions & 2 deletions lib/core/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import abbottFreeStyleLite from '../drivers/abbott/abbottFreeStyleLite';
import abbottFreeStyleLibre from '../drivers/abbott/abbottFreeStyleLibre';
import abbottFreeStyleNeo from '../drivers/abbott/abbottFreeStyleNeo';
import bayerContourNext from '../drivers/bayer/bayerContourNext';
import bayerContour from '../drivers/bayer/bayerContour';
import animasDriver from '../drivers/animas/animasDriver';
import medtronicDriver from '../drivers/medtronic/medtronicDriver';
import medtronic600Driver from '../drivers/medtronic600/medtronic600Driver';
Expand Down Expand Up @@ -76,6 +77,7 @@ device.deviceDrivers = {
AbbottFreeStyleLibre: abbottFreeStyleLibre,
AbbottFreeStyleNeo: abbottFreeStyleNeo,
BayerContourNext: bayerContourNext,
BayerContour: bayerContour,
Animas: animasDriver,
Medtronic: medtronicDriver,
Medtronic600: medtronic600Driver,
Expand All @@ -96,6 +98,7 @@ device.deviceComms = {
AbbottFreeStyleNeo: hidDevice,
Tandem: serialDevice,
BayerContourNext: hidDevice,
BayerContour: serialDevice,
Animas: serialDevice,
Medtronic: hidDevice,
Medtronic600: hidDevice,
Expand Down Expand Up @@ -180,6 +183,13 @@ device.driverManifests = {
{ vendorId: 6777, productId: 30720 }, // Bayer Contour Next One
],
},
BayerContour: {
mode: 'serial',
usb: [
{ vendorId: 6777, productId: 24577, driver: 'ftdi' }, // Official Bayer cable
{ vendorId: 1027, productId: 24577, driver: 'ftdi' }, // FTDI cable
],
},
Animas: {
mode: 'serial',
bitrate: 9600,
Expand Down Expand Up @@ -393,12 +403,21 @@ device.detectUsbSerial = (driverId, cb) => {

const getDevice = (results) => {
const devices = _.map(results, (result) => {
let userSpaceDriver = null;
for (let i = 0; i < driverManifest.usb.length; i++) {
if (driverManifest.usb[i].vendorId === parseInt(result.vendorId, 16)
&& driverManifest.usb[i].productId === parseInt(result.productId, 16)) {
userSpaceDriver = driverManifest.usb[i].driver;
}
}

const retval = {
driverId,
vendorId: result.vendorId,
productId: result.productId,
usbDevice: result.device,
path: result.comName,
userSpaceDriver,
path: result.path,
};
if (driverManifest.bitrate) {
retval.bitrate = driverManifest.bitrate;
Expand Down Expand Up @@ -437,7 +456,7 @@ device.detectUsbSerial = (driverId, cb) => {
if (driverManifest.usb[i].vendorId === vendorId
&& driverManifest.usb[i].productId === productId) {
if (device.os === 'mac') {
if (matching.comName.match('/dev/tty.+')) {
if (matching.path.match('/dev/tty.+')) {
return true;
}
} else {
Expand Down
74 changes: 74 additions & 0 deletions lib/drivers/bayer/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"extends": "airbnb",
"parser": "babel-eslint",
"plugins": ["lodash"],
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"max-len": "warn",
"import/order": "warn",
"no-plusplus": [
"error",
{
"allowForLoopAfterthoughts": true
}
],
"lodash/prefer-lodash-method": "off",
"arrow-parens": "warn",
"operator-linebreak": "warn",
"no-else-return": "warn",
"object-curly-newline": "warn",
"implicit-arrow-linebreak": "warn"
},
"overrides": [
{
"files": [
"bayerContourNext.js",
],
"rules": {
"func-names": "warn",
"no-var": "warn",
"vars-on-top": "warn",
"no-unused-vars": "warn",
"object-shorthand": "warn",
"comma-dangle": "warn",
"space-before-function-paren": "warn",
"no-param-reassign": "warn",
"prefer-template": "warn",
"no-useless-escape": "warn",
"keyword-spacing": "warn",
"indent": "warn",
"spaced-comment": "warn",
"eqeqeq": "warn",
"space-infix-ops": "warn",
"prefer-arrow-callback": "warn",
"no-shadow": "warn",
"array-bracket-spacing": "warn",
"no-use-before-define": "warn",
"no-else-return": "warn",
"no-bitwise": "warn",
"consistent-return": "warn",
"no-plusplus": "warn",
"no-continue": "warn",
"no-loop-func": "warn",
"object-curly-spacing": "warn",
"key-spacing": "warn",
"padded-blocks": "warn",
"no-console": "warn",
"no-multi-spaces": "warn",
"no-mixed-operators": "warn",
"max-len": "warn",
"prefer-destructuring": "warn",
"no-buffer-constructor": "warn",
"no-restricted-syntax": "warn",
"camelcase": "warn",
"no-underscore-dangle": "warn"
}
}
],
"settings": {
"lodash": 3,
"import/resolver": node
}
}
62 changes: 62 additions & 0 deletions lib/drivers/bayer/bayerConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* == BSD2 LICENSE ==
* Copyright (c) 2020, Tidepool Project
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the associated License, which is identical to the BSD 2-Clause
* License as published by the Open Source Initiative at opensource.org.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the License for more details.
*
* You should have received a copy of the License along with this program; if
* not, you can obtain one from Tidepool Project at tidepool.org.
* == BSD2 LICENSE ==
*/

export const ASCII_CONTROL = {
ACK: 0x06,
CR: 0x0D,
ENQ: 0x05,
EOT: 0x04,
ETB: 0x17,
ETX: 0x03,
LF: 0x0A,
NAK: 0x15,
STX: 0x02,
CAN: 0x18,
};

export const MODELS = {
Bayer6200: 'Contour Next Link', // mg/dL
Bayer6210: 'Contour Next Link 2.4', // mg/dL
Bayer6300: 'Contour Next Link', // mmol/L
Bayer7350: 'Contour Next', // mg/dL & mmol/L
Bayer7390: 'Contour USB', // mg/dL
Bayer7410: 'Contour Next USB', // mg/dL & mmol/L
Contour7800: 'Contour Next One', // mg/dL & mmol/L
Bayer7150: 'Contour',
Bayer7160: 'Contour Next EZ',
Bayer7220: 'Contour',
Bayer7600: 'Contour Plus',
};

export const COMMANDS = {
READ: [0x52, 0x7c], // R|
WRITE: [0x57, 0x7c], // W|
DATE: [0x44, 0x7c], // D|
TIME: [0x54, 0x7c], // T|
};

export const METHODS = {
B: 'whole blood',
P: 'plasma',
C: 'capillary',
};

export const MARKS = {
B: 'pre-meal',
A: 'post-meal',
D: 'logbook',
};
Loading

0 comments on commit d598040

Please sign in to comment.