mTANGO Rest API

Hi Vatsal,

I will have a look
Hi Igor,

Any updates on this?

Vatsal
Hi Vatsal,

Looks like there is a bug mtango.war. If you look through server's log you will see the following:


INFO 12-07-2017 13:49:57 [http-nio-8080-exec-16 - o.t.w.s.f.TimeWatcher] Serving request. Stopwatch is active.
DEBUG 12-07-2017 13:49:57 [http-nio-8080-exec-16 - o.j.r.l.i.Slf4jLogger] PathInfo: /mtango/device/sys/tg_test/1/ampli=100.25
INFO 12-07-2017 13:49:57 [http-nio-8080-exec-16 - o.t.w.s.f.AccessControlFilter] Method is not allowed: put
INFO 12-07-2017 13:49:57 [http-nio-8080-exec-16 - o.t.w.s.f.TimeWatcher] Request processing time (nano):2426080
INFO 12-07-2017 13:49:57 [http-nio-8080-exec-16 - o.t.w.s.f.TimeWatcher] Request processing time (ms):2

Notice `Method is not allowed: put` even though mtango-js user has write access to the device.

We never experienced this due to read only applications. I have fixed this - you can use new war file: https://bitbucket.org/hzgwpn/mtangorest.server/downloads/mtangorest.server-rc1-0.4.zip

Concerning DevDouble I confirm that it works in FF and not in Chrome. As we are using FF by default this is not going to be fixed soon.j

Regards,

Hi Igor,

Thanks for resolving the issue. We have tested it and its working.

Will get in touch with you in case of any additional issues. Also let us know when jsTangORB compatible with rc5 (the next major update for Tango REST API) is released. We would like to play with it.

Regards,
Vatsal Trivedi
Edited 7 years ago
Hi Igor,

In the updated war file there is an issue while reading "State" of a TANGO Device.

Regards,
Apurva
Hi Apurva,

Works fine for me:


<script>
var TangoTest = new DeviceProxy({url:'http://localhost:8080/mtango/js',device:'sys/tg_test/1'});

TangoTest.state({}, {
   onSuccess:function(response) {
       debugger;
       console.debug("Response — " + JSON.stringify(response));
   },
   onFailure:function(response) {
       debugger;
       console.debug("Response — " + JSON.stringify(response));
   }
});
</script>

Gives this console output:


Sending request: http://localhost:8080/mtango/js/mtango/device/sys/tg_test/1/State
jsTangO…-0.1.js (line 3611)
Request has succeed: http://localhost:8080/mtango/js/mtango/device/sys/tg_test/1/State
jsTangO…-0.1.js (line 3617)
Response — {"errors":[],"argout":{"value":10},"quality":"VALID","timestamp":1500976579598,"responseText":"[object Object]","src":"http://localhost:8080/mtango/js/mtango/device/sys/tg_test/1/State"}
/test/ (line 24)
Edited 7 years ago
Hi Igor,

Thanks for the solution. It is just that we were able to read "State" of the tango device in the form of string using previous mtango.war file. With this mtango.war file, we get "State" as an integer value.

Regards,
Apurva
OK,

I see.

Will have a look
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
Hi Lochan,

I have uploaded new versions of jsTangORB and mtango.war:

jsTangORB-rc1-1.0.3.zip

mtangoserver-rc1-0.5.zip

Using this ones I can read device properties:


Sending request: http://localhost:8080/mtango/js/mtango/device/sys/database/2/DbGetDeviceProperty=X
Request has succeed: http://localhost:8080/mtango/js/mtango/device/sys/database/2/DbGetDeviceProperty=X
Success response is : {"errors":[],"argout":["sys/tg_test/1","1","TestProperty","1","blah blah"],"timestamp":1501344685895,"responseText":"[object Object]","src":"http://localhost:8080/mtango/js/mtango/device/sys/database/2/DbGetDeviceProperty=X"}

@Vatsal, this also fixes a few tests of yours:


Executing command DevVarULong64Array — Success!!! 11,12

Executing command DevVarULongArray — Success!!! 11,12

Executing command DevVarUShortArray — Success!!! 11,12
 
Register or login to create to post a reply.