use of org.eclipse.smarthome.core.thing.binding.BridgeHandler in project smarthome by eclipse.
the class BridgeImpl method getHandler.
@Override
public BridgeHandler getHandler() {
BridgeHandler bridgeHandler = null;
ThingHandler thingHandler = super.getHandler();
if (thingHandler instanceof BridgeHandler) {
bridgeHandler = (BridgeHandler) thingHandler;
} else if (thingHandler != null) {
logger.warn("Handler of bridge '{}' must implement BridgeHandler interface.", getUID());
}
return bridgeHandler;
}
use of org.eclipse.smarthome.core.thing.binding.BridgeHandler in project smarthome by eclipse.
the class BeaconBluetoothHandler method initialize.
@Override
public void initialize() {
try {
address = new BluetoothAddress(getConfig().get(BluetoothBindingConstants.CONFIGURATION_ADDRESS).toString());
} catch (IllegalArgumentException e) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage());
return;
}
Bridge bridge = getBridge();
if (bridge == null) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Not associated with any bridge");
return;
}
BridgeHandler bridgeHandler = bridge.getHandler();
if (!(bridgeHandler instanceof BluetoothAdapter)) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Associated with an unsupported bridge");
return;
}
adapter = (BluetoothAdapter) bridgeHandler;
try {
deviceLock.lock();
device = adapter.getDevice(address);
device.addListener(this);
} finally {
deviceLock.unlock();
}
updateStatus(ThingStatus.UNKNOWN);
}
Aggregations