Пример #1
0
  /** 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());
  }
Пример #2
0
 @Override
 public void error(int code) {
   mMasterListener.error(code);
 }
Пример #3
0
 @Override
 public void doorOpened(int state) {
   mMasterListener.doorOpened(state);
 }
Пример #4
0
 @Override
 public void slavesFound(Master master, ArrayList<Slave> slaves) {
   mMasterListener.slavesFound(master, slaves);
 }
Пример #5
0
 @Override
 public void masterWithNoSlaves() {
   mMasterListener.masterWithNoSlaves();
 }