-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm-glucose.py is working. It fetches all the cgm pages and tries to d…
…ecode them. Still working on the mm-history, not sure which are the correct pages to fetch
- Loading branch information
Showing
5 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
SERIAL="417540" | ||
PORT="/dev/ttyUSB0" | ||
FOLDER="./data/" | ||
|
||
if [ ! -e ${PORT} 2>/dev/null ]; then | ||
echo "Cannot find USB dongle!" | ||
exit 1 | ||
fi | ||
|
||
# Get the number of pages | ||
./bin/mm-send-comm.py --init --serial ${SERIAL} --port ${PORT} --prefix-path ${FOLDER} --prefix ReadCurGlucosePageNumber --save sleep 0 > ${FOLDER}ReadCurGlucosePageNumber.markdown | ||
|
||
|
||
pages=`cat ${FOLDER}ReadCurGlucosePageNumber.markdown | grep -Po "page': \K([0-9]*)" | head -n 1` | ||
glucose=`cat ${FOLDER}ReadCurGlucosePageNumber.markdown | grep -Po "glucose': \K([0-9]*)" | head -n 1` | ||
start=$(expr $pages - $glucose) | ||
|
||
for page in `seq ${start} ${pages}`; do | ||
`./bin/mm-send-comm.py --serial ${SERIAL} --port ${PORT} --prefix-path ${FOLDER} tweak ReadGlucoseHistory --page ${page} --save > ${FOLDER}ReadGlucoseHistory-page-${page}.markdown` | ||
`./bin/mm-send-comm.py --serial ${SERIAL} --port ${PORT} --prefix-path ${FOLDER} tweak ReadHistoryData --page ${page} --save > ${FOLDER}ReadHistoryData-page-${page}.markdown` | ||
|
||
echo "Decoding page ${page}.." | ||
`./list_cgm.py ${FOLDER}ReadGlucoseHistory-page-${page}.data > ${FOLDER}ReadGlucoseHistory-page-${page}.json` | ||
|
||
curl --header "Content-type: application/json" --request POST --data-binary "@data/ReadGlucoseHistory-page-${page}.json" http://localhost:9000/upload | ||
|
||
echo "Decoding page ${page}.." | ||
`./list_dates.py ${FOLDER}ReadHistoryData-page-${page}.data > ${FOLDER}ReadHistoryData-page-${page}-dates.json` | ||
`./list_history.py ${FOLDER}ReadHistoryData-page-${page}.data > ${FOLDER}ReadHistoryData-page-${page}-history.json` | ||
#curl --header "Content-type: application/json" --request POST --data-binary "@data/ReadHistoryData-page-${page}.json" http://localhost:9000/upload | ||
|
||
done | ||
|
||
#Page: 58 | ||
#./bin/mm-send-comm.py --serial 417540 --port /dev/ttyUSB0 --prefix-path ./ tweak ReadGlucoseHistory --page 58 --save | ||
#python ./list_cgm.py ./ReadGlucoseHistory-page-58.data |