Add systemd service file. Replace readme.md with project.org to md.
Logging to SQLite database
Break into multiple files
A Common Lisp package and systemd service for logging Racebox Mini sensor data.
Many functions in the current implementation repeatedly use (dbus:with-open-bus () …) in the same call. Change it to only opens the bus once and put all calls in a single open.
(ql:quickload :racebox-tools)
;; Return a list of name/object pairs for each RaceBox Mini nearby.
(racebox-tools:list-racebox-devices)
;; By default these all use the first RaceBox Mini in the list returned
;; by (racebox-tools:list-racebox-devices), but there's an optional parameter.
;; Disconnect first so connect won't error out.
(racebox-tools:disconnect)
(racebox-tools:connect)
;; Read metadata UUIDs for manufacturer, serial, hardware/firmware versions.
(racebox-tools:read-metadata)
;; Get a racebox-mini-data-message structure holding the raw integer values
;; described in the RaceBox Mini Data Message
(let ((racebox-value (racebox-tools:read-current-value)))
(swank:inspect-in-emacs racebox-value))
(racebox-tools:disconnect)
Connect to the first seen RaceBox:
(ql:quickload :racebox-tools)
(let ((my-racebox (first ;; First name/object pair
(first ;; Get the name
(racebox-tools:list-racebox-devices)))))
(racebox-tools:connect :device-name my-racebox)
(racebox-tools:read-metadata :device-name my-racebox)
(let ((result (racebox-tools:read-current-value :device-name my-racebox)))
(swank:inspect-in-emacs result))
(racebox-tools:disconnect :device-name my-racebox))
Make sure file:///home/jeremiah/src/lisp/ is in file:///home/jeremiah/.config/common-lisp/source-registry.conf.d/projects.conf with this code:
(:tree (:home "src/lisp/"))
Clone racebox-tools and dbus-tools into file:///home/jeremiah/src/lisp/
mkdir -p $HOME/src/lisp/
cd $HOME/src/lisp/
git clone git@github.com:jl2/racebox-tools.git
git clone git@github.com:jl2/dbus-tools.git
Edit <./racebox-recorder.service> and replace 'jeremiah' with your username.
sudo cp racebox-tools/racebox-recorder.service /etc/systemd/services/
systemctl start racebox-recorder
After a second the RaceBox LED should shine blue and a new .db file should show up in file:///home/jeremiah/src/lisp/racebox-tools/databases.
# Connect interactively to RaceBox device
sudo gatttool -t random -b <RaceboxAddress> -I
# Type this in to connect:
connect
# Type this to read data:
char-read-hnd f
ISC
Copyright (c) 2023 Jeremiah LaRocco <jeremiahlarocco@fastmail.com>