Java Code Examples for org.eclipse.smarthome.config.discovery.DiscoveryResult#getBridgeUID()

The following examples show how to use org.eclipse.smarthome.config.discovery.DiscoveryResult#getBridgeUID() . 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 vote down vote up
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: InboxConsoleCommandExtension.java    From smarthome with Eclipse Public License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: DiscoveryResultDTOMapper.java    From smarthome with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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());
}