use of org.openhab.core.library.types.RawType in project openhab-addons by openhab.
the class KodiConnection method downloadImage.
@Nullable
private RawType downloadImage(String url) {
logger.debug("Trying to download the content of URL '{}'", url);
RawType downloadedImage = HttpUtil.downloadImage(url);
if (downloadedImage == null) {
logger.debug("Failed to download the content of URL '{}'", url);
}
return downloadedImage;
}
use of org.openhab.core.library.types.RawType in project openhab-addons by openhab.
the class IpCameraHandler method processSnapshot.
public void processSnapshot(byte[] incommingSnapshot) {
lockCurrentSnapshot.lock();
try {
currentSnapshot = incommingSnapshot;
if (cameraConfig.getGifPreroll() > 0) {
fifoSnapshotBuffer.add(incommingSnapshot);
if (fifoSnapshotBuffer.size() > (cameraConfig.getGifPreroll() + gifRecordTime)) {
fifoSnapshotBuffer.removeFirst();
}
}
} finally {
lockCurrentSnapshot.unlock();
currentSnapshotTime = Instant.now();
}
if (updateImageChannel) {
updateState(CHANNEL_IMAGE, new RawType(incommingSnapshot, "image/jpeg"));
} else if (firstMotionAlarm || motionAlarmUpdateSnapshot) {
updateState(CHANNEL_IMAGE, new RawType(incommingSnapshot, "image/jpeg"));
firstMotionAlarm = motionAlarmUpdateSnapshot = false;
} else if (firstAudioAlarm || audioAlarmUpdateSnapshot) {
updateState(CHANNEL_IMAGE, new RawType(incommingSnapshot, "image/jpeg"));
firstAudioAlarm = audioAlarmUpdateSnapshot = false;
}
}
use of org.openhab.core.library.types.RawType in project addons by smarthomej.
the class ImageItemConverter method process.
@Override
public void process(@Nullable ContentWrapper content) {
if (content == null) {
updateState.accept(UnDefType.UNDEF);
return;
}
String mediaType = content.getMediaType();
updateState.accept(new RawType(content.getRawContent(), mediaType != null ? mediaType : RawType.DEFAULT_MIME_TYPE));
}
Aggregations