Java Code Examples for org.eclipse.smarthome.config.discovery.DiscoveryResult#getRepresentationProperty()
The following examples show how to use
org.eclipse.smarthome.config.discovery.DiscoveryResult#getRepresentationProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InboxConsoleCommandExtension.java From smarthome with Eclipse Public License 2.0 | 6 votes |
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)); } }
Example 2
Source File: DiscoveryResultDTOMapper.java From smarthome with Eclipse Public License 2.0 | 5 votes |
/** * Maps discovery result into discovery result data transfer object. * * @param discoveryResult the discovery result * @return the discovery result data transfer object */ public static DiscoveryResultDTO map(DiscoveryResult discoveryResult) { ThingUID thingUID = discoveryResult.getThingUID(); ThingUID bridgeUID = discoveryResult.getBridgeUID(); return new DiscoveryResultDTO(thingUID.toString(), bridgeUID != null ? bridgeUID.toString() : null, discoveryResult.getThingTypeUID().toString(), discoveryResult.getLabel(), discoveryResult.getFlag(), discoveryResult.getProperties(), discoveryResult.getRepresentationProperty()); }
Example 3
Source File: AutomaticInboxProcessor.java From smarthome with Eclipse Public License 2.0 | 4 votes |
private @Nullable String getRepresentationValue(DiscoveryResult result) { return result.getRepresentationProperty() != null ? Objects.toString(result.getProperties().get(result.getRepresentationProperty()), null) : null; }
Example 4
Source File: DiscoveryResultImpl.java From smarthome with Eclipse Public License 2.0 | 3 votes |
/** * Merges the content of the specified source {@link DiscoveryResult} into this object. * <p> * <i>Hint:</i> The {@link DiscoveryResultFlag} of this object keeps its state. * <p> * This method returns silently if the specified source {@link DiscoveryResult} is {@code null} or its {@code Thing} * type or ID does not fit to this object. * * @param sourceResult the discovery result which is used as source for the merge */ public void synchronize(DiscoveryResult sourceResult) { if ((sourceResult != null) && (sourceResult.getThingUID().equals(this.thingUID))) { this.properties = sourceResult.getProperties(); this.representationProperty = sourceResult.getRepresentationProperty(); this.label = sourceResult.getLabel(); this.timestamp = new Date().getTime(); this.timeToLive = sourceResult.getTimeToLive(); } }