This repository has been archived by the owner on May 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Paper UI: display representation property in Things view & Inbox (#5169)
* Add representation property to dicovered inbox entries * Remove thing UID display from inbox results * Add Magic discovery service Signed-off-by: Henning Treu <henning.treu@telekom.de>
- Loading branch information
1 parent
14c1825
commit aa0278b
Showing
8 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
...gic/src/main/java/org/eclipse/smarthome/magic/binding/internal/MagicDiscoveryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright (c) 2014,2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.eclipse.smarthome.magic.binding.internal; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.UUID; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService; | ||
import org.eclipse.smarthome.config.discovery.DiscoveryResult; | ||
import org.eclipse.smarthome.config.discovery.DiscoveryResultBuilder; | ||
import org.eclipse.smarthome.config.discovery.DiscoveryService; | ||
import org.eclipse.smarthome.core.thing.Thing; | ||
import org.eclipse.smarthome.core.thing.ThingUID; | ||
import org.eclipse.smarthome.magic.binding.MagicBindingConstants; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
/** | ||
* The {@link MagicDiscoveryService} magically discovers magic things. | ||
* | ||
* @author Henning Treu - initial contribution | ||
* | ||
*/ | ||
@NonNullByDefault | ||
@Component(service = DiscoveryService.class, immediate = true) | ||
public class MagicDiscoveryService extends AbstractDiscoveryService { | ||
|
||
public MagicDiscoveryService() throws IllegalArgumentException { | ||
super(new HashSet<>(Arrays.asList(MagicBindingConstants.THING_TYPE_CONFIG_THING)), 0); | ||
} | ||
|
||
@Override | ||
protected void startScan() { | ||
String serialNumber = createRandomSerialNumber(); | ||
DiscoveryResult discoveryResult = DiscoveryResultBuilder | ||
.create(new ThingUID(MagicBindingConstants.THING_TYPE_CONFIG_THING, serialNumber)) | ||
.withRepresentationProperty(Thing.PROPERTY_SERIAL_NUMBER) | ||
.withProperty(Thing.PROPERTY_SERIAL_NUMBER, serialNumber).withLabel("Magic Thing").build(); | ||
thingDiscovered(discoveryResult); | ||
} | ||
|
||
private String createRandomSerialNumber() { | ||
return UUID.randomUUID().toString(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
<td>{{key}}</td> | ||
<td>{{value}}</td> | ||
</tr> | ||
</table> | ||
</table> |