Code Monkey home page Code Monkey logo

bloodsheltie's Introduction

Build Status bloodSheltie

This is the successor to blood-shepherd, a sync api to read data from the Dexcom Platinum G4 receiver.

This is a Objective-C library meant to support applications that would want to consume Dexcom data and do something useful in some way. Make it count.

While no applications (besides the rough bloodSheltie-cli that just logs the data) have been written using it, it's new and I'm actually building the first user-facing application using bloodSheltie. Therefore, I consider it functionally usable at this time and I'll be filling the blanks if any as I build Glukloader on top of it.

You are welcome to open issues or get in touch with me on twitter at @alex_normand.

Supported data

  • Glucose readings.
  • Calibration values.
  • User events: insulin, carbs, exercise, health.
  • Manufacturing parameters (including serial number).

Usage

// Get the SyncManager
SyncManager *syncManager = [SyncManager instance];

// Register an observer to get notified of device events, including
// the sync start/sync complete. The sync completion event includes
// the SyncData as well as the SyncTag that can be provided on
// initialization to get only new data.
[syncManager registerEventListener:[[LoggingObserver alloc] init]];
[syncManager start:[SyncTag initialSyncTag]];

Your observer should be ready to handle the most important event that is syncComplete. The SyncCompletionEvent has 3 very important fields:

ORSSerialPort *port;
SyncTag *syncTag;
SyncData *syncData;

The SyncData holds all supported data fetched during the sync. It's best to look at SyncData and the models for more details.

The SyncTag should be saved for future initialization of your application to resume fetching of new data at the last high watermark. SyncTag implements NSCoding but, if you want to do json, you can do something like

Serialize to JSON:

RecordSyncTag *tag = [RecordSyncTag tagWithRecordNumber:@10 pageNumber:@12];
NSDictionary *JSONDictionary = [MTLJSONAdapter JSONDictionaryFromModel:tag];

NSError *error;
NSString *serializedTag = [EncodingUtils dictionaryToJSON:JSONDictionary error:&error];

Deserialize to JSON:

NSDictionary *deserializedDictionary = [EncodingUtils stringToJsonDictionary:serializedTag error:&error];
RecordSyncTag *deserializedTag = [MTLJSONAdapter modelOfClass:RecordSyncTag.class fromJSONDictionary:deserializedDictionary error:&error];
XCTAssertEqualObjects(deserializedTag, tag);

System Requirements

bloodSheltie has been tested on Mac OS X 10.9 (Mavericks) but it might also run on prior versions of OS X.

Getting started

To add bloodSheltie to your application:

  1. Add the bloodSheltie repository as a submodule of your application's repository.
  2. Run script/bootstrap from within the bloodSheltie folder.
  3. Drag and drop bloodSheltie.xcodeproj into your application's Xcode project or workspace.
  4. On the "Build Phases" tab of your application target, add bloodSheltie to the "Link Binary With Libraries" phase.
    • bloodSheltie must also be added to any "Copy Frameworks" build phase. If you don't already have one, simply add a "Copy Files" build phase and target the "Frameworks" destination.
  5. Add "$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" $(inherited) to the "Header Search Paths" build setting (this is only necessary for archive builds, but it has no negative effect otherwise).
  6. If you added bloodSheltie to a project (not a workspace), you will also need to add the appropriate bloodSheltie target to the "Target Dependencies" of your application.

TODO

  • More tests.
  • Support for more settings.
  • Support for more data.

License

This projected is licensed under the terms of the MIT license.

bloodsheltie's People

Contributors

alexandre-normand avatar

Watchers

 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.