mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-22 16:48:04 +01:00
Add esp ble error code mappings (#292)
This commit is contained in:
parent
483b1122a3
commit
d4c44a3ccf
@ -1,4 +1,5 @@
|
||||
# flake8: noqa
|
||||
from .ble_defs import ESP_CONNECTION_ERROR_DESCRIPTION, BLEConnectionError
|
||||
from .client import APIClient
|
||||
from .connection import APIConnection, ConnectionParams
|
||||
from .core import (
|
||||
|
30
aioesphomeapi/ble_defs.py
Normal file
30
aioesphomeapi/ble_defs.py
Normal file
@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import IntEnum
|
||||
|
||||
|
||||
class BLEConnectionError(IntEnum):
|
||||
"""BLE Connection Error."""
|
||||
|
||||
ESP_GATT_CONN_UNKNOWN = 0
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3E
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100
|
||||
ESP_GATT_CONN_NONE = 0x0101
|
||||
|
||||
|
||||
ESP_CONNECTION_ERROR_DESCRIPTION = {
|
||||
BLEConnectionError.ESP_GATT_CONN_UNKNOWN: "Connection failed for unknown reason",
|
||||
BLEConnectionError.ESP_GATT_CONN_L2C_FAILURE: "Connection failed due to L2CAP failure",
|
||||
BLEConnectionError.ESP_GATT_CONN_TIMEOUT: "Connection failed due to timeout",
|
||||
BLEConnectionError.ESP_GATT_CONN_TERMINATE_PEER_USER: "Connection terminated by peer user",
|
||||
BLEConnectionError.ESP_GATT_CONN_TERMINATE_LOCAL_HOST: "Connection terminated by local host",
|
||||
BLEConnectionError.ESP_GATT_CONN_FAIL_ESTABLISH: "Connection failed to establish",
|
||||
BLEConnectionError.ESP_GATT_CONN_LMP_TIMEOUT: "Connection failed due to LMP response timeout",
|
||||
BLEConnectionError.ESP_GATT_CONN_CONN_CANCEL: "Connection cancelled",
|
||||
BLEConnectionError.ESP_GATT_CONN_NONE: "No connection to cancel",
|
||||
}
|
Loading…
Reference in New Issue
Block a user