File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/main/java/com/beowulfe/hap Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ public abstract class BaseCharacteristic<T> implements Characteristic {
22
22
private final Logger logger = LoggerFactory .getLogger (BaseCharacteristic .class );
23
23
24
24
private final String type ;
25
+ private final String shortType ;
25
26
private final String format ;
26
27
private final boolean isWritable ;
27
28
private final boolean isReadable ;
@@ -46,6 +47,7 @@ public BaseCharacteristic(
46
47
}
47
48
48
49
this .type = type ;
50
+ this .shortType = this .type .replaceAll ("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$" , "$1" );
49
51
this .format = format ;
50
52
this .isWritable = isWritable ;
51
53
this .isReadable = isReadable ;
@@ -94,11 +96,10 @@ protected CompletableFuture<JsonObjectBuilder> makeBuilder(int instanceId) {
94
96
JsonObjectBuilder builder =
95
97
Json .createObjectBuilder ()
96
98
.add ("iid" , instanceId )
97
- .add ("type" , type )
99
+ .add ("type" , shortType )
98
100
.add ("perms" , perms .build ())
99
101
.add ("format" , format )
100
- .add ("events" , false )
101
- .add ("bonjour" , false )
102
+ .add ("ev" , false )
102
103
.add ("description" , description );
103
104
setJsonValue (builder , value );
104
105
return builder ;
Original file line number Diff line number Diff line change @@ -65,8 +65,10 @@ public HttpResponse listing() throws Exception {
65
65
}
66
66
67
67
private CompletableFuture <JsonObject > toJson (Service service , int interfaceId ) throws Exception {
68
+ String shortType =
69
+ service .getType ().replaceAll ("^0*([0-9a-fA-F]+)-0000-1000-8000-0026BB765291$" , "$1" );
68
70
JsonObjectBuilder builder =
69
- Json .createObjectBuilder ().add ("iid" , ++interfaceId ).add ("type" , service . getType () );
71
+ Json .createObjectBuilder ().add ("iid" , ++interfaceId ).add ("type" , shortType );
70
72
List <Characteristic > characteristics = service .getCharacteristics ();
71
73
Collection <CompletableFuture <JsonObject >> characteristicFutures =
72
74
new ArrayList <>(characteristics .size ());
You can’t perform that action at this time.
0 commit comments