Skip to content

Changed links in forms #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
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
19 changes: 9 additions & 10 deletions Thing.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class ThingAction {
// 2.11 Action object: A links array (An array of Link objects linking
// to one or more representations of an Action resource, each with an
// implied default rel=action.)
JsonArray inline_links = obj.createNestedArray("links");
JsonArray inline_links = obj.createNestedArray("forms");
JsonObject inline_links_prop = inline_links.createNestedObject();
inline_links_prop["href"] = "/things/" + deviceId + "/actions/" + id;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ class ThingItem {
// 2.9 Property object: A links array (An array of Link objects linking
// to one or more representations of a Property resource, each with an
// implied default rel=property.)
JsonArray inline_links = obj.createNestedArray("links");
JsonArray inline_links = obj.createNestedArray("forms");
JsonObject inline_links_prop = inline_links.createNestedObject();
inline_links_prop["href"] =
"/things/" + deviceId + "/" + resourceType + "/" + id;
Expand Down Expand Up @@ -461,7 +461,7 @@ class ThingEventObject {
break;
}

data["timestamp"] = timestamp;
//data["timestamp"] = timestamp;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave this, at least I don't see any immediate problems with having it.

}
};

Expand Down Expand Up @@ -695,10 +695,10 @@ class ThingDevice {
#endif
}

void serialize(JsonObject descr, String ip, uint16_t port) {
void serialize(JbsonObject descr, String ip, uint16_t port) {
descr["id"] = this->id;
descr["title"] = this->title;
descr["@context"] = "https://webthings.io/schemas";
descr["@context"] = " https://www.w3.org/2019/wot/td/v1";
Copy link
Owner

@relu91 relu91 Aug 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct value should be: ['https://www.w3.org./2019/wot/td/v1','https://webthings.io/schemas'].


if (this->description != "") {
descr["description"] = this->description;
Expand All @@ -723,17 +723,15 @@ class ThingDevice {
typeJson.add(*type);
type++;
}

JsonArray links = descr.createNestedArray("links");
/*
JsonArray links = descr.createNestedArray("forms");
{
JsonObject links_prop = links.createNestedObject();
links_prop["rel"] = "properties";
links_prop["href"] = "/things/" + this->id + "/properties";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can already be described in the TD the /properties please leave it and add as op member ['readallproperties', 'writeallproperties']

}

{
JsonObject links_prop = links.createNestedObject();
links_prop["rel"] = "actions";
links_prop["href"] = "/things/" + this->id + "/actions";
}

Expand All @@ -742,11 +740,12 @@ class ThingDevice {
links_prop["rel"] = "events";
links_prop["href"] = "/things/" + this->id + "/events";
}
*/

#ifndef WITHOUT_WS
{
JsonObject links_prop = links.createNestedObject();
links_prop["rel"] = "alternate";
//links_prop["rel"] = "alternate";

if (port != 80) {
char buffer[33];
Expand Down
4 changes: 2 additions & 2 deletions WiFi101WebThingAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class WebThingAdapter {
handleError();
}
return;
} else if (uri == deviceBase + "/properties") {
} /*else if (uri == deviceBase + "/properties") {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above

if (method == HTTP_GET || method == HTTP_OPTIONS) {
handleThingPropertiesGet(device->firstProperty);
} else {
Expand All @@ -330,7 +330,7 @@ class WebThingAdapter {
} else {
handleError();
}
return;
return;*/
} else {
ThingProperty *property = device->firstProperty;
while (property != nullptr) {
Expand Down