diff --git a/leshan-server-demo/webapp/src/components/object/ObjectControl.vue b/leshan-server-demo/webapp/src/components/object/ObjectControl.vue
index b8a7348d5b..ee1c133d77 100644
--- a/leshan-server-demo/webapp/src/components/object/ObjectControl.vue
+++ b/leshan-server-demo/webapp/src/components/object/ObjectControl.vue
@@ -15,9 +15,27 @@
Create
+ Obs
+
+ {{ $icons.mdiEyeOffOutline }}
+
+ {{
+ $icons.mdiEyeRemoveOutline
+ }}
+ R
{
+ this.updateState(response.data, requestButton);
+ })
+ .catch(() => {
+ requestButton.resetState();
+ });
+ },
+ read(requestButton) {
+ this.axios
+ .get(`${this.requestPath()}${this.requestOption()}`)
+ .then((response) => {
+ this.updateState(response.data, requestButton);
+ if (response.data.success) {
+ this.$store.newObjectValue(
+ this.endpoint,
+ this.path,
+ response.data.content.instances
+ );
+ }
+ })
+ .catch(() => {
+ requestButton.resetState();
+ });
+ },
+ observe(requestButton) {
+ this.axios
+ .post(`${this.requestPath()}/observe${this.requestOption()}`)
+ .then((response) => {
+ this.updateState(response.data, requestButton);
+ if (response.data.success) {
+ this.$store.newObjectValue(
+ this.endpoint,
+ this.path,
+ response.data.content.instances
+ );
+ this.$store.setObserved(this.endpoint, this.path, true);
+ }
+ })
+ .catch(() => {
+ requestButton.resetState();
+ });
+ },
+ stopPassiveObserve(requestButton) {
+ this.axios
+ .delete(this.requestPath() + "/observe")
+ .then(() => {
+ requestButton.changeState("success");
+ this.$store.setObserved(this.endpoint, this.path, false);
+ })
+ .catch(() => {
+ requestButton.resetState();
+ });
+ },
+ stopActiveObserve(requestButton) {
+ this.axios
+ .delete(this.requestPath() + `/observe?active&timeout=${timeout.get()}`)
.then((response) => {
this.updateState(response.data, requestButton);
+ if (response.data.success) {
+ this.$store.newObjectValue(
+ this.endpoint,
+ this.path,
+ response.data.content.instances
+ );
+ this.$store.setObserved(this.endpoint, this.path, false);
+ }
})
.catch(() => {
requestButton.resetState();
diff --git a/leshan-server-demo/webapp/src/views/Client.vue b/leshan-server-demo/webapp/src/views/Client.vue
index 01fdbc41f5..d207b7649d 100644
--- a/leshan-server-demo/webapp/src/views/Client.vue
+++ b/leshan-server-demo/webapp/src/views/Client.vue
@@ -194,7 +194,14 @@ export default {
true
);
} else if (msg.kind == "single") {
- if (msg.val.kind === "instance") {
+ if (msg.val.kind === "obj") {
+ this.$store.newObjectValue(
+ this.$route.params.endpoint,
+ msg.res,
+ msg.val.instances,
+ false
+ );
+ } else if (msg.val.kind === "instance") {
this.$store.newInstanceValue(
this.$route.params.endpoint,
msg.res,