/** Opens a door if the user has a valid permission. */ public void openDoor(Master master, Slave slave) { Permission permission = getValidPermission(master, slave); if (permission == null) { mPermissionsListener.error(BluetoothClient.DONT_HAVE_PERMISSION); return; } mBluetoothClient = BluetoothClient.getInstance(mContext, this); if (!mBluetoothClient.isSupported()) { mBluetoothListener.bluetoothNotSupported(); return; } else if (!mBluetoothClient.isEnabled()) { mBluetoothListener.enableBluetooth(); return; } mMasterListener.doorOpening(); mBluetoothClient.executeOpenDoor(permission, master.getId(), slave.getId()); }