Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public abstract class BaseCharacteristic<T> implements Characteristic {
private final Logger logger = LoggerFactory.getLogger(BaseCharacteristic.class);

private final String type;
private final String shortType;
private final String format;
private final boolean isWritable;
private final boolean isReadable;
Expand All @@ -46,6 +47,7 @@ public BaseCharacteristic(
}

this.type = type;
this.shortType = this.type.replaceAll("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$", "$1");
this.format = format;
this.isWritable = isWritable;
this.isReadable = isReadable;
Expand Down Expand Up @@ -94,11 +96,10 @@ protected CompletableFuture<JsonObjectBuilder> makeBuilder(int instanceId) {
JsonObjectBuilder builder =
Json.createObjectBuilder()
.add("iid", instanceId)
.add("type", type)
.add("type", shortType)
.add("perms", perms.build())
.add("format", format)
.add("events", false)
.add("bonjour", false)
.add("ev", false)
.add("description", description);
setJsonValue(builder, value);
return builder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ public HttpResponse listing() throws Exception {
}

private CompletableFuture<JsonObject> toJson(Service service, int interfaceId) throws Exception {
String shortType =
service.getType().replaceAll("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$", "$1");
JsonObjectBuilder builder =
Json.createObjectBuilder().add("iid", ++interfaceId).add("type", service.getType());
Json.createObjectBuilder().add("iid", ++interfaceId).add("type", shortType);
List<Characteristic> characteristics = service.getCharacteristics();
Collection<CompletableFuture<JsonObject>> characteristicFutures =
new ArrayList<>(characteristics.size());
Expand Down