Skip to content

Commit

Permalink
Merge pull request #134 from aidee-health/HBP-178-Automatic-recording…
Browse files Browse the repository at this point in the history
…-when-on-body-as-before

Hbp 178 automatic recording when on body as before
  • Loading branch information
nkmnkm committed Feb 8, 2023
2 parents fec896e + bb66069 commit ef7f4b4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "embody-codec"
version = "1.0.17"
version = "1.0.18"
description = "Embody Codec"
authors = ["Aidee Health AS <hello@aidee.io>"]
license = "MIT"
Expand Down
9 changes: 9 additions & 0 deletions src/embodycodec/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ class NoOfPpgValuesAttribute(Attribute):
value: int


@dataclass
class DisableAutoRecAttribute(Attribute):
struct_format = ">B"
attribute_id = 0x75
value: int


@dataclass
class BatteryLevelAttribute(Attribute):
struct_format = ">B"
Expand Down Expand Up @@ -444,6 +451,8 @@ def decode_attribute(attribute_id, data: bytes) -> Attribute:
return TraceLevelAttribute.decode(data)
if attribute_id == NoOfPpgValuesAttribute.attribute_id:
return NoOfPpgValuesAttribute.decode(data)
if attribute_id == DisableAutoRecAttribute.attribute_id:
return DisableAutoRecAttribute.decode(data)
if attribute_id == BatteryLevelAttribute.attribute_id:
return BatteryLevelAttribute.decode(data)
if attribute_id == PulseRawAllAttribute.attribute_id:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def test_encode_decode_no_of_ppg_values() -> None:
do_test_encode_decode_attribute(attributes.NoOfPpgValuesAttribute(3), b"\x03")


def test_encode_decode_override_auto_rec() -> None:
do_test_encode_decode_attribute(attributes.DisableAutoRecAttribute(1), b"\x01")


def test_encode_decode_battery_level() -> None:
do_test_encode_decode_attribute(attributes.BatteryLevelAttribute(3), b"\x03")

Expand Down

0 comments on commit ef7f4b4

Please sign in to comment.