@@ -555,10 +555,10 @@ class ThingDevice {
555
555
}
556
556
557
557
void serialize (JsonObject descr, String ip, uint16_t port) {
558
- descr[" id" ] = this ->id ;
558
+ descr[" id" ] = " uri: " + this ->id ;
559
559
descr[" title" ] = this ->title ;
560
560
JsonArray context = descr.createNestedArray (" @context" );
561
- context.add (" https://www.w3.org. /2019/wot/td/v1" );
561
+ context.add (" https://www.w3.org/2019/wot/td/v1" );
562
562
563
563
if (this ->description != " " ) {
564
564
descr[" description" ] = this ->description ;
@@ -575,28 +575,26 @@ class ThingDevice {
575
575
descr.createNestedObject (" securityDefinitions" );
576
576
JsonObject nosecSc = securityDefinitions.createNestedObject (" nosec_sc" );
577
577
nosecSc[" scheme" ] = " nosec" ;
578
- descr[" security" ] = " nosec_sc" ;
578
+ JsonArray securityJson = descr.createNestedArray (" security" );
579
+ securityJson.add (" nosec_sc" );
579
580
580
581
JsonArray typeJson = descr.createNestedArray (" @type" );
581
582
const char **type = this ->type ;
582
583
while ((*type) != nullptr ) {
583
584
typeJson.add (*type);
584
585
type++;
585
586
}
586
-
587
- JsonArray forms = descr.createNestedArray (" forms" );
588
- {
587
+
588
+ ThingProperty *property = this ->firstProperty ;
589
+ if (property != nullptr ) {
590
+ JsonArray forms = descr.createNestedArray (" forms" );
589
591
JsonObject forms_prop = forms.createNestedObject ();
590
592
forms_prop[" rel" ] = " properties" ;
591
593
JsonArray context = forms_prop.createNestedArray (" op" );
592
594
context.add (" readallproperties" );
593
595
context.add (" writeallproperties" );
594
596
forms_prop[" href" ] = " /things/" + this ->id + " /properties" ;
595
- }
596
597
597
-
598
- ThingProperty *property = this ->firstProperty ;
599
- if (property != nullptr ) {
600
598
JsonObject properties = descr.createNestedObject (" properties" );
601
599
while (property != nullptr ) {
602
600
JsonObject obj = properties.createNestedObject (property->id );
0 commit comments