~jl2/racebox-tools

Add systemd service file.  Replace readme.md with project.org to md.
Logging to SQLite database
Break into multiple files

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~jl2/racebox-tools
read/write
git@git.sr.ht:~jl2/racebox-tools

You can also use your local clone with git send-email.

#Table of Contents

  1. racebox-tools
    1. About
    2. TODOs
      1. Replace dbus-tools with more efficient dbus equivalents
    3. REPL Examples
    4. Running as a Service
    5. Requirements
      1. D-Bus
      2. Bluez
      3. A Bluetooth Lower Energy host
    6. Shell Scripts
    7. License
  2. Plan
    1. Fill in a TODO list.

#racebox-tools

#About

A Common Lisp package and systemd service for logging Racebox Mini sensor data.

#TODOs

#Replace dbus-tools with more efficient dbus equivalents

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.

#REPL Examples

(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))

#Running as a Service

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.

#Requirements

#D-Bus

#Bluez

#A Bluetooth Lower Energy host

#Shell Scripts

# 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

#License

ISC

Copyright (c) 2023 Jeremiah LaRocco <jeremiahlarocco@fastmail.com>

#Plan

#TODO Fill in a TODO list.

Do not follow this link