use of org.eclipse.smarthome.config.discovery.DiscoveryResultFlag in project smarthome by eclipse.
the class PersistentInbox method matchFilter.
private boolean matchFilter(DiscoveryResult discoveryResult, InboxFilterCriteria criteria) {
if (criteria != null) {
String bindingId = criteria.getBindingId();
if ((bindingId != null) && (!bindingId.isEmpty())) {
if (!discoveryResult.getBindingId().equals(bindingId)) {
return false;
}
}
ThingTypeUID thingTypeUID = criteria.getThingTypeUID();
if (thingTypeUID != null) {
if (!discoveryResult.getThingTypeUID().equals(thingTypeUID)) {
return false;
}
}
ThingUID thingUID = criteria.getThingUID();
if (thingUID != null) {
if (!discoveryResult.getThingUID().equals(thingUID)) {
return false;
}
}
DiscoveryResultFlag flag = criteria.getFlag();
if (flag != null) {
if (discoveryResult.getFlag() != flag) {
return false;
}
}
}
return true;
}
use of org.eclipse.smarthome.config.discovery.DiscoveryResultFlag in project smarthome by eclipse.
the class InboxConsoleCommandExtension method clearInboxEntries.
private void clearInboxEntries(Console console, List<DiscoveryResult> discoveryResults) {
if (discoveryResults.isEmpty()) {
console.println("No inbox entries found.");
}
for (DiscoveryResult discoveryResult : discoveryResults) {
ThingTypeUID thingTypeUID = discoveryResult.getThingTypeUID();
ThingUID thingUID = discoveryResult.getThingUID();
String label = discoveryResult.getLabel();
DiscoveryResultFlag flag = discoveryResult.getFlag();
ThingUID bridgeId = discoveryResult.getBridgeUID();
Map<String, Object> properties = discoveryResult.getProperties();
console.println(String.format("REMOVED [%s]: %s [label=%s, thingId=%s, bridgeId=%s, properties=%s]", flag.name(), thingTypeUID, label, thingUID, bridgeId, properties));
inbox.remove(thingUID);
}
}
use of org.eclipse.smarthome.config.discovery.DiscoveryResultFlag in project smarthome by eclipse.
the class InboxConsoleCommandExtension method printInboxEntries.
private void printInboxEntries(Console console, List<DiscoveryResult> discoveryResults) {
if (discoveryResults.isEmpty()) {
console.println("No inbox entries found.");
}
for (DiscoveryResult discoveryResult : discoveryResults) {
ThingTypeUID thingTypeUID = discoveryResult.getThingTypeUID();
ThingUID thingUID = discoveryResult.getThingUID();
String label = discoveryResult.getLabel();
DiscoveryResultFlag flag = discoveryResult.getFlag();
ThingUID bridgeId = discoveryResult.getBridgeUID();
Map<String, Object> properties = discoveryResult.getProperties();
String representationProperty = discoveryResult.getRepresentationProperty();
String timestamp = new Date(discoveryResult.getTimestamp()).toString();
String timeToLive = discoveryResult.getTimeToLive() == DiscoveryResult.TTL_UNLIMITED ? "UNLIMITED" : "" + discoveryResult.getTimeToLive();
console.println(String.format("%s [%s]: %s [thingId=%s, bridgeId=%s, properties=%s, representationProperty=%s, timestamp=%s, timeToLive=%s]", flag.name(), thingTypeUID, label, thingUID, bridgeId, properties, representationProperty, timestamp, timeToLive));
}
}
Aggregations