cfaagaard / CGM.NET

Datalogger for the 600-series pump.
MIT License
9 stars 15 forks source link

Enhancement request: Ability to use CGM.Communication decoupled from the UI.. #6

Closed emorrison1962 closed 7 years ago

emorrison1962 commented 7 years ago

I'd like to be able to headlessly spawn CGM.Communication, and observe selected message responses from the pump. (Pump History) Does the current design support this? If so, could you add...say a unit test project showing how to do this?

Thanks in advance, Eric.

cfaagaard commented 7 years ago

The current design do support this. The only challenge you will have is getting the USB communication working. That is why I chose UWP to start with. If I was going to get a "normal" unit test project working I would need a 32bit USB communication. Tested this a lot in the beginning of the project. Tried several.

But I will get a unit test project started. Because you can also re-play a log file, so you do not need CNL/pump for developing/testing. You can even re-play a wireshark file, if for example you have recorded your carelink upload. And for those scenarios you do not need USB communication.

I'll be back.....

cfaagaard commented 7 years ago

And yes, I have tried the uwp unit testing.... so slow....

cfaagaard commented 7 years ago

Just added a unit test project where I read a portion of yesterdays log file. The log file has history with: lost sensor signal, change of sensor, a bit high BG and a stable night with a few low warnings...... so your typical T1D night....

in total about 650 events for 2 days. Not all events are done yet in terms of figuring out the bytes.

You can have a look at the uploadlogic. Here you can see how I use the events to upload it to Nightscout.

cfaagaard commented 7 years ago

Just added win32 USB communication to the unit test project. And a small unit test as an example of a non-UI way of doing it. You should be able to take that code into a console project if you wish.

emorrison1962 commented 7 years ago

Thanks, Christian!