def __init__(self, ble_device, role, connection_params=DEFAULT_CONNECTION_PARAMS, security_params=DEFAULT_SECURITY_PARAMS): """ :type ble_device: blatann.device.BleDevice """ self._ble_device = ble_device self._role = role self._ideal_connection_params = connection_params self._current_connection_params = DEFAULT_CONNECTION_PARAMS self.conn_handle = BLE_CONN_HANDLE_INVALID self.peer_address = "", self.connection_state = PeerState.DISCONNECTED self._on_connect = EventSource("On Connect", logger) self._on_disconnect = EventSource("On Disconnect", logger) self._on_mtu_exchange_complete = EventSource( "On MTU Exchange Complete", logger) self._on_mtu_size_updated = EventSource("On MTU Size Updated", logger) self._mtu_size = MTU_SIZE_DEFAULT self._preferred_mtu_size = MTU_SIZE_DEFAULT self._negotiated_mtu_size = None self._connection_based_driver_event_handlers = {} self._connection_handler_lock = threading.Lock() self.security = smp.SecurityManager(self._ble_device, self, security_params)
def __init__(self, ble_device, role, connection_params=DEFAULT_CONNECTION_PARAMS, security_params=DEFAULT_SECURITY_PARAMS, name="", write_no_resp_queue_size=1): """ :type ble_device: blatann.device.BleDevice """ self._ble_device = ble_device self._role = role self._name = name self._preferred_connection_params = connection_params self._current_connection_params = ActiveConnectionParameters( connection_params) self.conn_handle = BLE_CONN_HANDLE_INVALID self.peer_address = "", self.connection_state = PeerState.DISCONNECTED self._on_connect = EventSource("On Connect", logger) self._on_disconnect = EventSource("On Disconnect", logger) self._on_mtu_exchange_complete = EventSource( "On MTU Exchange Complete", logger) self._on_mtu_size_updated = EventSource("On MTU Size Updated", logger) self._on_data_length_updated = EventSource("On Data Length Updated", logger) self._on_phy_updated = EventSource("On Phy Updated", logger) self._mtu_size = MTU_SIZE_DEFAULT self._preferred_mtu_size = MTU_SIZE_DEFAULT self._negotiated_mtu_size = None self._preferred_phy = Phy.auto self._current_phy = Phy.one_mbps self._disconnection_reason = nrf_events.BLEHci.local_host_terminated_connection self._connection_based_driver_event_handlers = {} self._connection_handler_lock = threading.Lock() self.security = smp.SecurityManager(self._ble_device, self, security_params) self._db = gattc.GattcDatabase(ble_device, self, write_no_resp_queue_size) self._discoverer = service_discovery.DatabaseDiscoverer( ble_device, self)
def __init__(self, ble_device, role, connection_params=DEFAULT_CONNECTION_PARAMS, security_params=DEFAULT_SECURITY_PARAMS): """ :type ble_device: blatann.device.BleDevice """ self._ble_device = ble_device self._role = role self._ideal_connection_params = connection_params self._current_connection_params = DEFAULT_CONNECTION_PARAMS self.conn_handle = BLE_CONN_HANDLE_INVALID self.peer_address = "", self.connection_state = PeerState.DISCONNECTED self._on_connect = EventSource("On Connect", logger) self._on_disconnect = EventSource("On Disconnect", logger) self._mtu_size = 23 # TODO: MTU Exchange procedure self._connection_based_driver_event_handlers = {} self._connection_handler_lock = threading.Lock() self.security = smp.SecurityManager(self._ble_device, self, security_params)