Search in sources :

Example 1 with ThingStatusInfoBuilder

use of org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder in project smarthome by eclipse.

the class ThingManager method buildStatusInfo.

private ThingStatusInfo buildStatusInfo(ThingStatus thingStatus, ThingStatusDetail thingStatusDetail, String description) {
    ThingStatusInfoBuilder statusInfoBuilder = ThingStatusInfoBuilder.create(thingStatus, thingStatusDetail);
    statusInfoBuilder.withDescription(description);
    return statusInfoBuilder.build();
}
Also used : ThingStatusInfoBuilder(org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder)

Example 2 with ThingStatusInfoBuilder

use of org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder in project smarthome by eclipse.

the class FSInternetRadioHandlerJavaTest method verifyConfigurationError.

private void verifyConfigurationError() {
    ThingStatusInfoBuilder statusBuilder = ThingStatusInfoBuilder.create(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR);
    ThingStatusInfo statusInfo = statusBuilder.withDescription("Configuration incomplete").build();
    verify(callback, atLeast(1)).statusUpdated(radioThing, statusInfo);
}
Also used : ThingStatusInfoBuilder(org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.eclipse.smarthome.core.thing.ThingStatusInfo)

Example 3 with ThingStatusInfoBuilder

use of org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder in project smarthome by eclipse.

the class BaseThingHandler method updateStatus.

/**
 * Updates the status of the thing.
 *
 * @param status the status
 * @param statusDetail the detail of the status
 * @param description the description of the status
 * @throws IllegalStateException if handler is not initialized correctly, because no callback is present
 */
protected void updateStatus(ThingStatus status, ThingStatusDetail statusDetail, @Nullable String description) {
    synchronized (this) {
        if (this.callback != null) {
            ThingStatusInfoBuilder statusBuilder = ThingStatusInfoBuilder.create(status, statusDetail);
            ThingStatusInfo statusInfo = statusBuilder.withDescription(description).build();
            this.callback.statusUpdated(this.thing, statusInfo);
        } else {
            throw new IllegalStateException("Could not update status, because callback is missing");
        }
    }
}
Also used : ThingStatusInfoBuilder(org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.eclipse.smarthome.core.thing.ThingStatusInfo)

Example 4 with ThingStatusInfoBuilder

use of org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder in project smarthome by eclipse.

the class FSInternetRadioHandlerJavaTest method verifyOnlineStatusIsSet.

private void verifyOnlineStatusIsSet() {
    ThingStatusInfoBuilder statusBuilder = ThingStatusInfoBuilder.create(ThingStatus.ONLINE, ThingStatusDetail.NONE);
    ThingStatusInfo statusInfo = statusBuilder.withDescription(null).build();
    verify(callback, atLeast(1)).statusUpdated(radioThing, statusInfo);
}
Also used : ThingStatusInfoBuilder(org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.eclipse.smarthome.core.thing.ThingStatusInfo)

Aggregations

ThingStatusInfoBuilder (org.eclipse.smarthome.core.thing.binding.builder.ThingStatusInfoBuilder)4 ThingStatusInfo (org.eclipse.smarthome.core.thing.ThingStatusInfo)3