Skip to content

Commit

Permalink
Add additional checks for BLE data
Browse files Browse the repository at this point in the history
also update docker file for Bookworm
  • Loading branch information
mvadu committed Jun 27, 2023
1 parent cd903f9 commit 59d4e95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ RUN apt-get update \
git \
libbluetooth3 \
libbluetooth-dev \
python-dev \
#python-dev \
python-dev-is-python3 \
&& pip install -r requirements.txt \
&& pip install git+https://github.com/pybluez/pybluez \
&& git clone https://github.com/colin-guyon/py-bluetooth-utils.git --depth=1 \
Expand Down
5 changes: 4 additions & 1 deletion mi_atc_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def le_advertise_packet_handler(mac, adv_type, data, rssi):
Both atc1441 and pvvx forks send data on GATT Service 0x181A Environmental Sensing
"""
exit_stat = not exit_event.is_set()
if struct.unpack('<H', data[3:5])[0] != 0x181A:
if adv_type != 0x00: #check if its ADV_IND: Connectable Scannable Undirected advertising.
return exit_stat

if len(data) > 6 and struct.unpack('<H', data[3:5])[0] != 0x181A:
return exit_stat

# data format adds mac as part of data structure.
Expand Down

0 comments on commit 59d4e95

Please sign in to comment.