def disconnect_ble_device()

in src/ble/ble_uart_controller.py [0:0]


    def disconnect_ble_device(self, ble_mac):
        '''
            Disconnects a BLE Device gracefully and cleans up any resources.
        '''
        
        ######################################################
        # Disconnect and clean up a BleUartPeripheral object for the requested BLE device
        log.info('Disconnecting the BLE Device: {}'.format(ble_mac))

        # Normalise ble_mac to all upper case.
        ble_mac = ble_mac.upper()

        # If the device doesn't exist, just return.
        if not ble_mac in self.ble_devices:
            return

        # Get the BleUartPeripheral class for this device.
        ble_device = self.ble_devices[ble_mac]

        # Disconnect and clean up the BLE device thread
        ble_device.close_thread()

        # Pop the device from the active (connected) device list
        self.ble_devices.pop(ble_mac, None)