Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
some api playaround
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineThreepwood committed Jan 11, 2017
1 parent c781603 commit 5ec8754
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions remote/src/main/java/org/openbase/bco/dal/remote/unit/Units.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import rst.domotic.unit.UnitConfigType.UnitConfig;
import rst.rsb.ScopeType;

/**
/**
* @author <a href="mailto:[email protected]">Divine Threepwood</a>
*/
public class Units {
Expand Down Expand Up @@ -385,7 +385,7 @@ public static UnitRemote getUnitByScope(final String scope, boolean waitForData)
throw new NotAvailableException("Unit[" + scope + "]", ex);
}
}

/**
* Method establishes a connection to the unit referred by the given unit label and location scope.
* The returned unit remote object is fully synchronized with the unit controller and all states locally cached.
Expand Down Expand Up @@ -424,6 +424,28 @@ public UnitRemote getUnitByLabelAndLocationScope(final String label, final Strin
}
}

// public enum UnitClass {
// LIGHT(LightRemote.class);
//
// final Class unitRemoteClass;
//
// private UnitClass(final Class unitRemoteClass) {
// this.unitRemoteClass = unitRemoteClass;
// }
//
// public Class getUnitClass() {
// return unitRemoteClass;
// }
// }
//
// public static <UR extends UnitRemote> UR getUnit(final String unitId, boolean waitForData, final UnitClass unitClass) throws NotAvailableException, InterruptedException {
// try {
// return (UR) getUnit(unitId, waitForData, unitClass.getUnitClass());
// } catch (ClassCastException ex) {
// throw new NotAvailableException("Unit[" + unitId + "]", new InvalidStateException("Requested Unit[" + unitId + "] is not compatible with defined UnitRemoteClass[" + unitRemoteClass + "]!", ex));
// }
// }

public static LightRemote getLightUnit(final UnitConfig unitConfig, boolean waitForData) throws NotAvailableException, InterruptedException {
return getUnit(unitConfig, waitForData, LightRemote.class);
}
Expand Down

0 comments on commit 5ec8754

Please sign in to comment.