Handling the # TODO: Handle failure in the _IRQ_ENCRYPTION_UPDATE event
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- networking
Direzione di ricerca
Inizia tracciando _security_irq e DeviceConnection._connected, quindi confronta i valori di stato riportati con bluetooth.h e con la gestione esistente degli eventi di connessione e pairing. Determina il comportamento previsto per gli errori di crittografia, le disconnessioni, le connessioni mancanti e gli eventi di pairing; il lavoro è completato quando l’applicazione riceve risultati coerenti e documentati per ogni caso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- Python
- Stelle
- 2.9k
- Fork
- 1.1k
- Merge medio
- 7g 6h
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di micropython/micropython-lib
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
micropython/micropython-lib#1074 ·
-
needs-info
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
micropython/micropython-lib#943 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
micropython/micropython-lib#931 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
micropython/micropython-lib#795 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
micropython/micropython-lib#762 ·
Tutte le issue di micropython/micropython-lib
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
bancolombia/sentinel#23 ·
-
test md ApertaCI
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100