Giter Site home page Giter Site logo

cgmblekit's Introduction

LoopKit

Build Status Carthage compatible project chat

LoopKit is a set of tools to speed up development of your own closed-loop insulin delivery app. It is agnostic to treatment decisions and input sources.

Loop

Loop is a full-featured app built on top of LoopKit.

LoopKit provides

  • Data storage and retrieval, using HealthKit and Core Data as appropriate
  • Protocol types for representing data models in a flexible way
  • Common calculation algorithms like Insulin On Board
  • Boilerplate user interfaces like editing basal rate schedules and carb entry

LoopKit does not provide

  • Treatment decisions: Your Diabetes May Vary.
  • Device communications: Device-specific libraries are maintained separately.

License

LoopKit is available under the MIT license. See the LICENSE file for more info.

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

cgmblekit's People

Contributors

achkars avatar aranasaurus avatar bjorkert avatar camji55 avatar cfaagaard avatar darinkrauss avatar hummelstrand avatar isthispaul avatar kdisimone avatar ktomy avatar loudnate avatar mylma avatar nhamming avatar pi4ohhi7 avatar ps2 avatar readmecritic avatar rickpasetto avatar thebookins avatar whiten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cgmblekit's Issues

G6 Roadmap / POC

I was just curious if anyone has gotten their hands on a G6 yet to determine how much effort may be required to make it compatible. Keep up the great work!

Can this run on iOS 14?

Does CGMBLEKit work for iOS 14? I am a willing and able beta-tester if y'all want me to try it! I'm giving it a go on my own right now, and was able to build it by doing some things:

After it builds successfully, I now get this error when it runs on my iphone after clicking the play button:

dyld[4787]: Library not loaded: @rpath/SwiftCharts.framework/SwiftCharts
  Referenced from: /private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/LoopKitUI
  Reason: tried: '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/System/Library/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file)
Library not loaded: @rpath/SwiftCharts.framework/SwiftCharts
  Referenced from: /private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/LoopKitUI
  Reason: tried: '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/LoopKitUI.framework/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4ADC-A5A2-513B009FB87C/ResetTransmitter.app/Frameworks/SwiftCharts.framework/SwiftCharts' (no such file), '/usr/lib/swift/SwiftCharts.framework/SwiftCharts' (no such file), '/private/var/containers/Bundle/Application/E7FE86C2-46F5-4A
(lldb) 

When it builds and opens, its just a blank screen

Missing RemoteSettings.plist

When I import this project into xCode I see error

/Users/dennis/dev/xDripG5/xDripG5/RemoteSettings.plist:0: error: reading data: The file “RemoteSettings.plist” couldn’t be opened because there is no such file.

Should this file be included in the repo or is it a user-specific file?

I hate to ask, but does it work for anyone on iOS 15.5 w/ Mac OS 12.4 and Xcode 13.4

Followed the instructions as best I could, but getting 4 issues after I run it (below).
Tried using iOS 12 and 15.5 in the Build Settings (Deployment), but same errors.

Any ideas on fixes?
Fingers crossed.
-mv

ISSUES:

CGMBLEKit Group
> Swift Compiler Error Group
/Users/mikevaughn/Downloads/CGMBLEKit-dev 2/CGMBLEKit/Glucose+SensorDisplayable.swift:10:8: No such module 'LoopKit'

Swift Compiler Warning Group
/Users/mikevaughn/Library/Developer/Xcode/DerivedData/CGMBLEKit-avwqvbcocbyexiajepgvoorwkwmt/Build/Intermediates.noindex/CGMBLEKit.build/Debug-iphoneos/CGMBLEKit.build/Objects-normal/arm64/SessionStartTxMessage.dia:1:1:
Could not read serialized diagnostics file: error("Invalid diagnostics signature")

Uncategorized Group
Command CompileSwift failed with a nonzero exit code
Command EmitSwiftModule failed with a nonzero exit code

(screen shot)

Screen Shot 2022-07-01 at 1 12 41 AM

What is Transmitter ID?

Hi,

Thanks for your project. What does Transmitter ID mean and why it's 500000 by default? Where do I get it?

Also I'm not getting any data from the transmitter. Could you recommend how to debug it?

EDIT:
I'm also getting the following messages in xCode when running example app:

2016-09-24 20:25:31.931362 xDripG5_Example[1930:775871] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2016-09-24 20:25:34.032436 xDripG5_Example[1930:775871] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2016-09-24 20:25:34.032508 xDripG5_Example[1930:775871] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction

Could you explain what do they mean?

Implementation on raspberry Pi

Hello,

Thank you for this project.
I just started with BLE and worked with projects like MI Bands and MI Scales and so this project seems amazing. I wanted to know if we can have an implementation of the passive mode on a raspberry Pi or any similar devices.

I think its possible if we have the UUIDS and the characteristic values but the authentication and the decoding of the data is some thing I am not sure of.

Is there any solution for this?

Thank you

Build failures

Fresh clone, build fails with "cartfile uncategoriized command phaseScriptExecution" and compileswift failures

-- I've plugged in my iPhone X (12.3.1) but xcode is only reflecting 12.2 as a target. Probably naiveté on my part; but is there a more detailed blow by blow for self hosted compilation/installation of this sw?

secondary errors: "failed to create provisioning profile" and "no profiles for 'com.loopkit.ReetTransmitter'....

Runtime error on start

I'm not a Swift developer, and rarely work in Xcode; I'm just trying to build the ResetTrasmitter app. Any help is appreciated.

macOS 10.14.6
Xcode 11.2
Tried on iOS 11.4 and iOS 12.3.1

The following exception occurs on the first run of the app every time. I have even tried old releases (2.1.1), and other branches (xcode11, dev).

2019-10-31 23:18:28.525462-0400 ResetTransmitter[299:19291] *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named _UITextLayoutView' *** First throw call stack: (0x184d8ed8c 0x183f485ec 0x184d8ec6c 0x18f16f5fc 0x18f16f8b0 0x18f16f470 0x18edc9be4 0x18ede2860 0x18f5bbb18 0x10493b148 0x10493b208 0x18f00dfec 0x18f16f738 0x18f16f8b0 0x18f16f470 0x18edc9be4 0x18f1c8820 0x18f16f738 0x18f16f8b0 0x18f16f470 0x18edc9be4 0x18efdbd5c 0x18f16f738 0x18f16f470 0x18f305080 0x18f16f738 0x18f16f8b0 0x18f16f470 0x18f3055d8 0x18f16f738 0x18f16f8b0 0x18f16f470 0x18f3058f4 0x18f16f738 0x18f16f470 0x18f00dc94 0x18f16f738 0x18f16f8b0 0x18f16f470 0x18f00cfe4 0x18ee3eaa8 0x18ea82074 0x18e9f2850 0x18e9a6b14 0x18ea54e1c 0x18ea542d8 0x18ea53c14 0x18ea536a4 0x18ea473a8 0x18e99f6f4 0x188f15fec 0x188f1a17c 0x188e86830 0x188eae364 0x18ed89680 0x184d372bc 0x184d36a7c 0x184d347b0 0x184c54da8 0x186c39020 0x18ec71758 0x10492c2d8 0x1846e5fc0) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

When trying to connect the G5 ,IT disconnect from Us......

Dear :
how can i solve this question ?

When execution to “discoverCharacteristics(characteristicsToDiscover, for: service)”
the G5 disconnect from Center,called "didDisconnectPeripheral" 。 What should I do about this。。?please reply ,thanks !

 if characteristicsToDiscover.count > 0 {
                peripheral.discoverCharacteristics(characteristicsToDiscover, for: service)
            } else {
                self.peripheral(peripheral, didDiscoverCharacteristicsFor: service, error: nil)
   }

Non-linear observation pattern

the current listenToControl sequence is far too rigid than it needs to be. The simpler approach by @mddub in G4ShareSpy should be adopted in xDripG5.

App crash on reset then Error Domain=CBATTErrorDomain Code=14 “Peer removed pairing information”

Hello all,

I had to get a new phone and rebuild the reset app. My reset app has crashed upon pairing or just after. I then attempted to reset again and got the message in this screenshot.

I have attempted this with master and dev branches on 2 versions of iOS (13.4 & 13.6.1) with 2 devices (SE2020 and 6S). I attempted 3 different transmitters throughout troubleshooting, all with 80xxxx and all with previously successful resets. All with good batteries.
D799CF5F-3A38-4851-8847-9D60C46F9AF7

Does anyone have any idea what I am doing wrong?

Thanks in advance,
Brad

Always get "Transmitter error: Unable to parse auth challenge: timeout" with newer transmitters

Hi guys!, I'm always getting "Transmitter error: Unable to parse auth challenge: timeout" with these G6 newer transmitters that showed @ps2 in his v3.1 version.

I've:

  • Removed every transmitter from bluetooth paired devices
  • Deleted Dexcom apps
  • Restarted iPhone

With an older one (July 2019), it does ask me for pairing, but next it throws me an exception and app crashes. It does reset the transmitter.

Any Ideas?

CRC function

If you'd like to calculate CRC for messages, this should work:
static func calculateCRC(byte: UInt8) -> UInt16
{
``var crc : UInt16 = 0x00;``var x = crc >> 8 ^ UInt16(byte)``x ^= x>>4 `` ``return (crc << 8) ^ (UInt16(x << 12)) ^ (UInt16(x << 5)) ^ (UInt16(x))
}

Unknown sensor data: 1c0701 and 10

I guess message opcode 0x1c and message 0x10

The 0x1c I saw three times on 5/9 the 0x10 once, roughly 400 ms seconds before a 0x1c

Everytime there was a "Signal Loss" situation for a while before receiving it.

Maybe some kind of keep-alive, or "ping" response?

Dependency Analisys error

I installed this project but when I trying to compile it in XCode 9 I receive error that some files used Swift 2 and I need to try use XCode 8 to transfer project.
In XCode 9: The "Swift language version" (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift.
But when I try to use accessible in XCode 9: swift 3.2 or swift 4 - it still not work.

How I can fix this issue for XCode 9?

offer for support G5 connectivity

Hi,

I receive a lot of questions on https://github.com/JohanDegraeve/iosxdripreader related to interaction with loopkit. My app is able to connect to G5.

Looking at the issues here I have the impression that this is not progressing but would be useful for loop ?

I do not know swift and am not able to analyse the code here, but I might be able to offer support.

Johan

"Encryption is insufficient" error when PassiveMode is disabled

Seems that with my newest transmitter, every request that gets sent to the transmitter results in the error "Encryption is insufficient". Had to modify xDripG5 to get the error information (specifically the error handling at the end of writeValueAndWait in BluetoothManager); on the stock main branch it just shows up as a timeout.

won't compile for iOS 10

For some reason the availability check here doesn't protect the code inside, and the compiler complains with dyld: Symbol not found: _CBConnectPeripheralOptionStartDelayKey, when compiling for iOS 10.x.

No such module 'LoopKit'

Upon attempting to build the app to my iPhone 7, a Swift Complier Error appears saying that is cannot find the LoopKit module in Glucose+SensorDisplayable.swift

error "error writing time request: timeout" - or "Unknown Data: 5100 [..]" (disappeared on restart)

I've finally managed to get the xDripG5-Example project. (I think by opening up the xcWorkspace file instead of just the project - I might start a blog called "War With xCode". I originally got a "unknown data: 51.." error - which didn't make sense as that looks like it's just a authStatusRxMessage. I restarted the iPod and opened the app WITHOUT having the Dexcom app running, and it I guess got past that error. (Both Stay Connected and Run Alongside are selected)

Now it manages to get past the authentication, but fails with "Error writing time request: timeout" Does this mean that Dexcom has changed the "update interval" for the transmitter and so the app times out waiting for a response? The sensor is going to end in 2 hours - could that affect things?

If I open the Dexcom app, it gives me the "Signal Lost" thing for about a minute (I assume waiting for the transmitter to send something), and then get a BG value (in the Dexcom app). Then I close the Dexcom app (hitting the "Home" button - I assume it's still open in the background) and opening the xDrip example.

After closing the Dxcom app, it again gives me the "unknown data" error with a data string of "51000102e67b20016a62e004e010000c032312d" (different from before - I assume it's a different BG value) which again looks like a authStatusRxMessage. Is this because the Dexcom app "opened" the sensor and sent the time request, and now the xDrip example can't process (or seemingly even recognize by opcode) the StatusRx for some reason?

Thanks,
Jim

When switching to a new transmitter, stop restoring the first one

BluetoothManager only assumes there's one peripheral we care about, which isn't true as we continue to restore the original one.

In the interest of reusing BluetoothManager in other use cases and projects, let's always ask the delegate (in this case, the Transmitter class) for permission before connecting.

Instructions / example for using passiveMode = false + backfill?

I've been able to follow the excellent instructions and get the example app working with my Dexcom G6. Example app works as expected in passive mode. But when passiveModeEnabledSwitch is on, I get "Unable to parse auth challenge: timeout".

I'd like to use this lib to extract data directly from the transmitter, without using the Dexcom app, and it clearly supports this feature.

But I don't see in either Loop code or this example app how to effectively request from the device ALL of the glucose data. Is this in use by any of the apps consuming CGMBLEKit that you're aware of?

My intention is to create a flutter wrapper of this functionality to use in a research app. Any guidance or suggestions?

Support backfilling glucose values

Newer transmitters when longer out of range will do a bulk reply of past glucose values. This does not seem to be interpreted by xDripG5 and will only interpret the single next value afaict. It would be nice to backfill this data by calling the callback multiple times to the listening app. Not sure if this should rather go into the Loop/Loop issue tracker as it could in theory pull that data from dexcom-share.

fails to connect after restoring peripheral from state

I have noticed at times that when I run the example app with the same transmitter ID as a previous session, the app fails to scan or connect. Rather than seeing the expected log messages (Scanning for peripherals or Reconnecting to known peripheral ... in 180.0 s) I just see the message Restoring peripheral from state .... This is on latest dev and iOS 11.2.5.

Crashes on iOS13 - Bluetooth permissions?

I've installed on iOS 13.2 and the app which worked fine on iOS12 seems to crash on reset transmitter when reset button is pressed. I think in iOS13 there are changes with requests for Ble access - namely it needs to be approved. There is no prompt for ble access so I am theorizing that this is why it is crashing. anyone else having this issue?

object deallocated error using ResetTransmitter

Got the following fatal error using ResetTransmitter. Seems to be related to reconnecting to the peripheral after a reset operation.

2018-05-10 16:53:29.149269+1000 ResetTransmitter[563:353271] [Transmitter] Reading glucose
2018-05-10 16:53:29.150712+1000 ResetTransmitter[563:353271] [Transmitter] Initiating a disconnect
2018-05-10 16:53:31.222157+1000 ResetTransmitter[563:353282] [BluetoothManager] Re-connecting to known peripheral 62738C40-1479-47FB-97A4-B4447C697B50
2018-05-10 16:53:31.227716+1000 ResetTransmitter[563:353168] [BluetoothManager] centralManager(_:didConnect:): <CBPeripheral: 0x1702eb700, identifier = 62738C40-1479-47FB-97A4-B4447C697B50, name = DexcomA4, state = connected>
2018-05-10 16:53:31.228459+1000 ResetTransmitter[563:353282] [CoreBluetooth] API MISUSE: Forcing disconnection of unused peripheral <CBPeripheral: 0x1702eb700, identifier = 62738C40-1479-47FB-97A4-B4447C697B50, name = DexcomA4, state = connected>. Did you forget to cancel the connection?
Fatal error: Attempted to read an unowned reference but the object was already deallocated2018-05-10 16:53:31.242279+1000 ResetTransmitter[563:353282] [CoreBluetooth] XPC connection invalid
2018-05-10 16:53:31.244835+1000 ResetTransmitter[563:353271] Fatal error: Attempted to read an unowned reference but the object was already deallocated

CalibrationTxMessage, SessionStartTxMessage, SessionStopTxMessage

Hey, first off, thank you so incredibly much for all of the awesome work you've put into this project. It's been instrumental in getting my readings onto my android device. I'm pretty close to being ready to open the project up, but in the mean time I thought I'd share some of the messages I've been able to decipher. Unfortunately I don't code swift well enough to give you a pull request, but hopefully I've documented the messages well enough that you can easily whip them out in swift. Attached here are the java files for CalibrationTxMessage, SessionStartTxMessage, and SessionStopTxMessage.

Carthage build issue with SwiftCharts package

I've previously been able to build and run the app but I'm getting errors when trying to update carthage. Any tips?

Build Failed Task failed with exit code 1: /usr/bin/xcrun lipo -create /Users/wes/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/SwiftCharts/0.6.5/Build/Intermediates.noindex/ArchiveIntermediates/SwiftCharts/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/SwiftCharts.framework/SwiftCharts /Users/wes/Library/Caches/org.carthage.CarthageKit/DerivedData/12.1_12A7403/SwiftCharts/0.6.5/Build/Products/Release-iphonesimulator/SwiftCharts.framework/SwiftCharts -output /Users/wes/Downloads/CGMBLEKit-dev/Carthage/Build/iOS/SwiftCharts.framework/SwiftCharts

Could passive mode be implemented on another device?

Hi, thank you so much for this project! I am new to BLE and have a probably very basic question.

I got the example app running on an iPhone alongside the Dexcom G5 app. Now I'm wondering if it's possible to implement this passive mode – meaning eavesdropping on the communication between the transmitter and the Dexcom app – on a different device than the iPhone running the Dexcom app?

The way I understand BLE this should be possible – the other device would not communicate with the transmitter at all, just listen for the messages intended for the iPhone and decrypt them using the transmitter ID...

(My project is to build a wearable device with something like https://docs.particle.io/datasheets/mesh/xenon-datasheet/)

Error writing transmitter challenge: timeout

I am trying to get xDripG5 working with PassiveMode turned off (Dexcom App is uninstalled). However, I am getting the error "Error writing transmitter challenge: timeout" Any ideas? Is there any 'tricks/configurations' to getting xDripG5 communication working as a "standalone" app? (No dexcom app).

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.