Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@

# Claude local only configs
.claude/*.local.*
.claude/worktrees/

# IDE - JetBrains
.idea/
*.iml
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ bgl-read --list

### Output formats

| `--format` | Description |
|---|---|
| `json` | Device info and readings as pretty-printed JSON |
| `csv` | One reading per row, header included |
| `records` | Raw ASTM record text as received from the meter (useful for debugging) |
| `bytes` | Hex dump of every HID packet exchanged (TX and RX) |
| `--format` | Description |
|------------|------------------------------------------------------------------------|
| `json` | Device info and readings as pretty-printed JSON |
| `csv` | One reading per row, header included |
| `records` | Raw ASTM record text as received from the meter (useful for debugging) |
| `bytes` | Hex dump of every HID packet exchanged (TX and RX) |

Timestamps are in the meter's own local time (no timezone attached — the device
has no concept of timezone).
Expand All @@ -74,14 +74,14 @@ has no concept of timezone).

All Contour Next devices share USB vendor ID `0x1A79` (Ascensia / Bayer).

| Product ID | Device |
|------------|--------|
| `0x7800` | Contour Next One (USB-only variant) |
| `0x7440` | Contour Next USB |
| `0x7350` | Contour Next |
| `0x7900` | Ascensia Contour Next |
| `0x6220` | Contour Next Link |
| `0x6230` | Contour Next Link 2.4 |
| Product ID | Device |
|------------|-------------------------------------|
| `0x7800` | Contour Next One (USB-only variant) |
| `0x7440` | Contour Next USB |
| `0x7350` | Contour Next |
| `0x7900` | Ascensia Contour Next |
| `0x6220` | Contour Next Link |
| `0x6230` | Contour Next Link 2.4 |

The tool opens the first matching device it finds. Run `--list` to see what is
connected.
Expand Down
13 changes: 7 additions & 6 deletions bin/capture-bgl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ CAP_DIR="${PRJ_DIR}/captures"
DATE_CAP=$(date "+%Y%m%d")
PREFIX="${1:-unknown}"

echo_err() {
echo "$1" >&2
}

# Ensure the captures directory exists
mkdir -p "${CAP_DIR}/${DATE_CAP}"

cargo run -- --format csv --progress --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.csv"
cargo run -- --format json --progress --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.json"
# Read records first, to reduce device calls
cargo run -- --format records --progress --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.txt"
# Generate CSV and JSON from the records capture
cargo run -- --from-records "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.txt" --format csv --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.csv"
cargo run -- --from-records "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.txt" --format json --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.json"
# Finally, re-capture to get the bytes
# TODO: Need to fix this so that a proper binary is generated and that can generate
# the records file, which can in turn generate the other formats?
cargo run -- --format bytes --progress --output "${CAP_DIR}/${DATE_CAP}/${PREFIX}-bgl.hex"
Loading