Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional checks for BLE data #15

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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