I have written to you on Facebook Fanpage and somebody replied me that you are interested in my software, so...
I created three applications that provide mock CPAP, control center board and presenting data in real time. I drew (big word xD ) at A4 paper my approach (in attachment below). I believe that my code will explain itself
... I really hope. all variables, object, functions, methods, classes and comments were written in english.
1) ARDUINO (my is arduino uno, ATMEGA 328P) - this code is written for mock data in your data frame protocol by UART. There are used 3 serial connection - hardware serial for debug and user-friendly display data frame in terminal; software serial 0 for generate error frames; software serial 1 for generate status data frames. I manually switch wires into my arduino ports for software serial. There is also simple LCD Display handling for display values sends from ANDROID APP. This code is very simple because it is mock and it only helps me in getting data from some hardware device like simulator.
2) PYTHON APP. It can be used on different platform - I tested with success on Lenovo Z-51 with Windows 10 and intel Core i5, Toshiba Satellite C55 with Ubuntu Mate and Raspberry Pi Zero W (!!!). Here I receive data from UART in infinite loop; wait for some data on UART; run webservice via flask framework -> this three main branch in three independent thread. Web service is used to provide two-way communication between Raspberry and ANDROID app. We can call http method for run some part of code into Raspberry.
When raspberry receive some bytes on UART - it parse this data, and retransmit by http into ANDROID app. There ANDROID app receive data and display on chart.
If we want to call some method on Raspberry, we must call HTTP request from some device (here from ANDROID app, but you can call from web browser, curl from terminal - so it can be next feature).
If you or somebody can and are able to code some GUI for python you can us my program as backend - feel free
so it is why I created android app.
3) ANDROID APP - it us as a VIEWER - it is some like user interface. It can not do something itself but can send call request to Raspberry to do something. Here I implemented scanning Serial port - both for linux and windows, setting Serial connection, setting webservice(Raspberry) and webserver(ANDROID), display 4 independent graph in real time at chart, send 5 seting value from ANDROID APP into CPAP device - entered by input text and slider. If you want it is possible to display e.g. some current values in text view indicator - but now I do not know how you handle this.
4) At Raspberry I implemented also possibility to connection with database and store data in tables to have historical data, but I do not know how many information will CPAP generate in what time interval. It is more important because inserting a lot of small rows into table in narrow time range is very time consuming so the appropriateness of this function in correlated with yours requirements and device features.
I do not know that you or somebody will you some of my applications or part of code but perhaps it will help someone to create something better and more efficient.
ALL CODE ARE PROTOTYPES!
ALL CODE are for free, NON COMMERCIAL use only, only for win the battle with COVID19, it can not be used even as part of COMMERCIAL CASES!
If you want please ask me here or by mail firstname.lastname@example.org
DOCUMENTATION AND IMAGES: https://bitbucket.org/lukaszjok/ventilaid_doc/
ARDUINO CODE: https://bitbucket.org/lukaszjok/ventilaid_arduino/
PYTHON CODE: https://bitbucket.org/lukaszjok/ventilaid_web_app/
ANDROID CODE: https://bitbucket.org/lukaszjok/ventilaid/
ANDROID APK FILE for install application on your smartphone: https://bitbucket.org/lukaszjok/ventila ... -debug.apk
(minimum Android 7.0 (API level 24))
Sorry for my not optimal code but this idea, solution approach, three programs were created less than 10 days after professional working hours in my small rented room by one person:) I used what I know and which was quick to implement.But with unlimited pasta, rice, toilet paper and black coffee