Handling the # TODO: Handle failure in the _IRQ_ENCRYPTION_UPDATE event
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- networking
Hướng nghiên cứu
Bắt đầu bằng cách lần theo _security_irq và DeviceConnection._connected, sau đó so sánh các giá trị trạng thái được báo cáo với bluetooth.h và cách xử lý hiện có đối với các sự kiện kết nối và pairing. Xác định hành vi mong đợi đối với lỗi mã hóa, ngắt kết nối, kết nối bị thiếu và các sự kiện pairing; được xem là hoàn tất khi ứng dụng nhận được kết quả nhất quán, có tài liệu cho từng trường hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I am using the btstack for the PICO_W. We have needed to do significant work to add pairing/encryption support from the BtStack but for the most part I think we have got the basics working. What I need to know is what to do with the aioble objects when errors occur. I have modified the code a little (slowly adding typing as I learn what things are) to look as follows:
pair_status: int = -1
def _security_irq(event: int, data: tuple[int, bool, bool, bool, int, int]):
global _modified
global pair_status
if event == _IRQ_ENCRYPTION_UPDATE:
pair_status = -1
# Connection has updated (usually due to pairing).
conn_handle, encrypted, authenticated, bonded, key_size, status = data
pair_status = status
logger.info("LNI: AIOBLE: encryption update") # type: ignore
if connection := DeviceConnection._connected.get(conn_handle, None):
logger.info(f'LNI: AIOBLE: Event triggered. Pairing status: {pair_status}') # type: ignore
connection.encrypted = encrypted
connection.authenticated = authenticated
connection.bonded = bonded
connection.key_size = key_size
if pair_status == 19: #ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION (in Bt Stack code - not so in MP code)
del DeviceConnection._connected[conn_handle] # Signal as disconnected
# TODO: Handle failure.
#if encrypted and connection._pair_event:
connection._pair_event.set()
I am assuming the status values are those defined in the btstack file bluetooth.h such that status value 0x13 is, for example, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION
What I dont know is exactly what to do in each case. Is the del DeviceConnection._connected[conn_handle] sufficient for the ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION case? Should I always set the event if the connection is not None?
What should be done if if connection := DeviceConnection._connected.get(conn_handle, None) gives None?
Are there certain exceptions I should raise to inform the application or do I need to create one?
- Ngôn ngữ chính
- Python
- Star
- 2.9k
- Fork
- 1.1k
- Merge trung bình
- 7 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 3
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của micropython/micropython-lib
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#1074 ·
-
needs-info
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
micropython/micropython-lib#943 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
micropython/micropython-lib#931 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#795 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
micropython/micropython-lib#762 ·
Tất cả issue của micropython/micropython-lib
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·