Search in sources :

Example 1 with ThingStatusInfoBuilder

use of org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder in project openhab-addons by openhab.

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.openhab.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.openhab.core.thing.ThingStatusInfo)

Example 2 with ThingStatusInfoBuilder

use of org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder in project openhab-addons by openhab.

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.openhab.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.openhab.core.thing.ThingStatusInfo)

Example 3 with ThingStatusInfoBuilder

use of org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder in project openhab-core by openhab.

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
 */
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 {
            logger.warn("Handler {} tried updating the thing status although the handler was already disposed.", this.getClass().getSimpleName());
        }
    }
}
Also used : ThingStatusInfoBuilder(org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder) ThingStatusInfo(org.openhab.core.thing.ThingStatusInfo)

Example 4 with ThingStatusInfoBuilder

use of org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder in project openhab-core by openhab.

the class ThingManagerImpl method buildStatusInfo.

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

Aggregations

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