Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

openyou/libomron

Repository files navigation

libomron

by Kyle Machulis <[email protected]>

Nonpolynomial Labs - http://www.nonpolynomial.com

with contributions from

  • Brett Viren - SWIG Implementaiton, Python utils

  • And others

If you find libomron useful, please donate to the project at http://www.pledgie.com/campaigns/14372

Description

libomron is a mainly C-based implementation of the data retreival protocol for the USB enabled line of omron home medical equipment.

Supported Hardware

Blood Pressure Monitors * HEM-790-IT * BP-791-IT * M10-IT

Pedometers * HJ-720-IT

While basic communication functions in the library should work for any Omron product, there may be differences in packet layout and measure units between US/European/Japanese/etc products…​ We will try to cover these as requested, but the library itself is produced in the US, so that’s what I have easiest access to.

A Tale of Two Libraries

libomron comes in two flavors: Win32 and libusb-1.0. The Win32 version uses direct Win32 DDK calls to access the windows HID system, and reads raw reports from there (which means we aren’t required to install any specific drivers.). libusb-1.0 works for all platforms currently supporting the library.

Library Requirements (For Compilation)

To build on Ubuntu, you can pull the following packages to build the project from source.

  • libusb-1.0-0-dev

  • cmake

  • cmake-data

For OS X, there are build files available for homebrew and macports.

Build Notes

To build libomron, make a subdirectory in the source dir (called whatever you want), then go into that directory and run "cmake ..". This will generate the project files for your platform (makefiles for OS X and linux, visual studio for windows). For more information on project generators, look at the cmake documentation.

Notes on Compilation and Usage

Mac OS X

You will need to install the "Omron OS X Extension" in order to use omron software on OS X. The file and installation instructions are available on the libomron sourceforge site, or in the mac binary package if one is available. The kext should work on 10.5 or later.

Linux

The VID/PID pair of the omron will need to be blacklisted on linux in order to use libomron there without requiring root access. This can be done either in the kernel or through udev.

License

Copyright (c) 2009-2010, Kyle Machulis/Nonpolynomial Labs
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the Kyle Machulis/Nonpolynomial Labs nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Kyle Machulis/Nonpolynomial Labs ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL Kyle Machulis/Nonpolynomial Labs BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

Brett Viren’s README

(I’m including Brett’s README here because I’m too lazy to integrate it and just want to get 0.9.0 out. :) )

This is a fork of http://github.com/qdot/libomron I use to play around with my 790-IT. Much thanks to qDot for the original heavy lifting! The intention here is to scratch my own itch and feed any useful improvements back to qDot.

  • Overview

This fork adds:

  • Python bindings via SWIG

  • Python utilities including plotting, device autodetection

  • Random bug fixes/improvements on the C side

  • A simple Python/TK GUI app.

  • Installation

    • Pre-requirements

  • CMake

  • SWIG

    • Steps for installation, testing and running

Things are not as polished as they could be, but here is how to go from nothing to something.

It assumes these locations:

  • git clone to ~/git/libomron

  • build area in ~/opt/omron-build

  • install area in ~/opt/omron

0) Clone github repo by going to http://github.com/brettviren/libomron and selecting a method

cd ~/git
git clone ...

1) Go to resulting libomron/ directory and install needed qDot submodule (git://github.com/qdot/compily_buildd.git)

cd ~/git/libomron
git submodule update --init

2) Create and enter installation directory

mkdir -p ~/opt/omron-build
cd ~/opt/omron-build/

3) Run "cmake ~/git/libomron"

4) Run "make" and optionally "make DESTDIR=~/opt/omron install"

5) Plug in USB and find out device

lsusb | grep Omron
Bus 005 Device 006: ID 0590:0028 Omron Corp. HJ-720IT Pedometer

(note, my 790-IT blood pressure monitor is identified incorectly, but that is okay)

6) From the numbers above, set this env. var.:

export OMRON_DEV=/dev/bus/usb/005/006

7) Check that it is readable and writable by you:

ls -l $OMRON_DEV
groups

8) Finally, run the example to readout stored values

~/opt/omron/usr/local/bin/omron_790IT_test

9) Try out the python bindings do:

export PYTHONPATH=~/opt/omron/usr/local/python
python ~/opt/omron/usr/local/python/omron/omron_790IT_test.py
# (this will make a omron.sqlite3 in current directory
python ~/opt/omron/usr/local/python/omron/store.py
# (this will dump omron.sqlite3)
python ~/opt/omron/usr/local/python/omron/plot.py
# (this wlil plot all readouts)

10) Try the GUI app

# Set PYTHONPATH as above, and print help screen
python ~/opt/omron/usr/local/python/omron/gui -h
# Run it, point it to a data file, can be same one produced above
python ~/opt/omron/usr/local/python/omron/gui -f omron.sqlite3