Hi Igor,
I want to read device properties using the REST API. But jsTangORB compatible with version rc1-0.4 of the TANGO REST API does not support reading of device properties.
So I tried a workaround. TANGO Database Server exposes a command DbGetDeviceProperty to read device properties. So I created a proxy to the TANGO Database Device (sys/database/2) and invoked DbGetDeviceProperty command with DevVarStringArray as input parameter containing TANGO Device Name and name of property to be read.
I have added a TestProperty in TANGO Test (sys/tg_test/1) device.
Below is the code snippet:
var TangoTest = new DeviceProxy({url:'http://localhost:8080/mtango/js',device:'sys/database/2'});
var testStrArr = ["sys/tg_test/1", "TestProperty"];
TangoTest.executeCommand("DbGetDeviceProperty",{
argin:testStrArr
},{
onSuccess:function(response) {
console.log("Success response is : " + JSON.stringify(response));
},
onFailure:function(response) {
console.log("Failure response is : " + JSON.stringify(response));
}
});
But I get failed response. Below is the output on the console:
Failure response is : {"errors":[{"reason":"UnhandledException","description":"Response is committed, can't handle exception","severity":"ERR","origin":"org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:148)"},{"reason":"NotFoundException","description":"Could not find resource for full path: http://localhost:8080/mtango/js/mtango/device/sys/database/2/DbGetDeviceProperty=sys/tg_test/1,TestProperty?argin=sys%2Ftg_test%2F1&argin=TestProperty&cbk=MVC.JsonP._cbs.cnfRRg","severity":"ERR","origin":"org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:112)"}],"quality":"FAILURE","timestamp":1501246741912,"responseText":"[object Object]","src":"http://localhost:8080/mtango/js/mtango/device/sys/database/2/DbGetDeviceProperty=sys/tg_test/1,TestProperty"}
I think the issue is related to the war file.
Please have a look at it.
Regards,
Lochan