Skip to content

Commit

Permalink
Add macos support
Browse files Browse the repository at this point in the history
  • Loading branch information
ignisf committed Feb 28, 2023
1 parent e38798e commit 7ada0cb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# sbm69

This project provides a library and a CLI to export blood pressure measurements
as CSV from Hans Dinslage GmbH/Silvercrest SBM69 Bluetooth Blood Pressure
Monitor devices.
from SilverCrest® SBM69 Bluetooth Blood Pressure Monitor devices.

## Installation

Expand All @@ -16,15 +15,17 @@ Just clone the repo and then execute:

For example:

$ sbm69
$ sbm69 > john-doe-blood-pressure-`date +%F`.csv

## Before first use

The device requires a one-time pairing in order to provide access to its stored
blood pressure measurements. Before the first connection attempt. In order to do
this, perform the following:
blood pressure measurements. Before the first connection attempt, perform the
following:

1. On Linux, start a terminal and run `bluetoothctl`.
### On Linux

1. Start a terminal and run `bluetoothctl`.
2. In a second terminal issue the `sbm69` command without any arguments.
3. Press the `M` button on the SBM69 device.
4. In the second terminal you will see output similar to this:
Expand All @@ -42,12 +43,25 @@ this, perform the following:
[CHG] Device B8:B7:7D:XX:XX:XX ServicesResolved: yes
[CHG] Device B8:B7:7D:XX:XX:XX Trusted: yes
Request passkey
[agent] Enter passkey (number in 0-999999):
[agent] Enter passkey (number in 0-999999):
```

6. Enter the passkey displayed on the SBM69 device's display before it
disappears.

### On macos

1. Start a terminal that [can request Bluetooth access](https://github.com/hbldh/bleak/issues/761).
Macos' default terminal should do.
2. Call the `sbm69` command.
3. You will be presented with a 'XXX.app would like to use Bluetooth' message.
Click OK.
4. Call the `sbm69` command again.
5. Press the `M` button of your SBM69 device.
6. You will be presented with a dialogue window asking you to enter a
passcode.
7. Enter the passcode displayed on the SBM69 device before it disappears.

## On the protocol

The device uses a protocol based on but not compliant to the Blood Pressure
Expand Down Expand Up @@ -95,7 +109,7 @@ The `Blood Pressure Feature` characteristic seems to provide incorrect data. It
indicates that the device only supports 'Pulse Rate Range Detection Support',
which is not the case.

The `Intermedia Cuff Pressure` characteristic is not usable because the device
The `Intermediate Cuff Pressure` characteristic is not usable because the device
does not activate Bluetooth during a measurement.

The `Blood Pressure Measurement` characteristic is used for transferring the
Expand Down Expand Up @@ -168,7 +182,6 @@ BloodPressureMeasurement bpm @ 0x00;
Note that the `medfloat16` fields from the HDP profile specification have been
replaced with `uint16` fields.
### Further reading:
* https://www.bluetooth.com/specifications/specs/gatt-specification-supplement/
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"construct >=2.10.68",
"inflection >=0.5.1"
]
description = "A library to retrieve blood pressure measurements from the Hans Dinslage GmbH/Silvercrest SBM69 Bluetooth Blood Pressure Monitor"
description = "A library to retrieve blood pressure measurements from the SilverCrest® SBM69 Bluetooth Blood Pressure Monitor"
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
2 changes: 1 addition & 1 deletion src/sbm69/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

__author__ = "Petko Bordjukov <bordjukov+p@gmail.com>"
__version__ = "0.3.0"
__version__ = "0.4.1"

from sbm69.connection import *

Expand Down
6 changes: 5 additions & 1 deletion src/sbm69/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ async def fetch_data(self) -> dict[str, str | construct.Container]:
max_attempts=2,
use_services_cache=True,
)
await connection.pair()

try:
await connection.pair()
except NotImplementedError:
pass

result["manufacturer_name"] = self._bytearray_as_string(
await connection.read_gatt_char(MANUFACTURER_NAME_CHAR_UUID)
Expand Down

0 comments on commit 7ada0cb

Please sign in to comment.