caveble¶
Cave Surveying Bluetooth Protocol - communicate via BLE with paperless cave surveying tools e.g. TopoDroid
Author(s): Phil Underwood
Implementation Notes¶
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class caveble.SurveyProtocolService¶
This service provide a BLE style interface to access data from the device
- ACK0 = 85¶
Acknowledge a leg with sequence bit 0
- ACK1 = 86¶
Acknowledge a leg with sequence bit 1
- DEVICE_OFF = 52¶
Turn device off
- LASER_OFF = 55¶
Turn laser off
- LASER_ON = 54¶
Turn laser on
- START_CAL = 49¶
Start Calibration
- STOP_CAL = 48¶
Finish calibration
- TAKE_SHOT = 56¶
Take a reading
- async background_task(callback: Callable[[int], Coroutine] | None = None)¶
You can use this as a background async task instead of doing regular polls. It will check for new messages and if there are any outstanding outgoing messages every 100ms or so.
- Parameters:
callback (Callable) – Async function to call with any messages received, function must take one argument, which will be an integer matching one of the above constants
- Returns:
None
- poll() int | None¶
Check to see if any messages need sending or re-sending. This should be called every 100ms or so. It will send any data due to be sent and will resend data if no acknowledgement has been received. It will also return any messages received (one of
START_CAL,STOP_CAL,START_SILENT,STOP_SILENTetc). Note the memory access commands are currently unsupported and will be ignored.- Returns:
None (if no command received) or an int of one of the above constants