'Inteligenty' dom ze sterownikiem PLC

Główna => Programowanie => Wątek zaczęty przez: meskas w Stycznia 15, 2013, 08:02:52 am

Tytuł: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 15, 2013, 08:02:52 am
Hi,
maybe you can help me with jquery problem?
When i run test connections script i get this error in Google chrome console.
XMLHttpRequest cannot load http://192.168.1.1/READPI. Origin null is not allowed by Access-Control-Allow-Origin.
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 15, 2013, 08:40:07 am
Hello,

It is a know issue related to same-origin-policy (http://en.wikipedia.org/wiki/Same_origin_policy) not to WAGO.  Here is an article explaining what to do:

http://www.edom-plc.pl/index.php?option=com_content&view=article&id=82:problemy-z-poczeniem&catid=37:wizualizacjehtml&Itemid=74&lang=en

Good luck!
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 15, 2013, 08:49:47 am
Still getting same problem...
Tried to add test connection script to wago and it works, but that PLC doesn't have required space for all web page...
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 15, 2013, 10:38:23 am
When you open Chrome, do you get a message like/similar to this one?

http://www.edom-plc.pl/plugins/content/mavikthumbnails/thumbnails/550x30-images-stories-e-dom-chrome_message.png

Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 15, 2013, 01:22:07 pm
Fixed the problem :)
just added (dataType: 'jsonp') to ajax call, but them the output info must be parsed in different way
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 15, 2013, 03:06:16 pm
I'm glad

Pls share the code once you get it working
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 16, 2013, 08:39:46 am
I will post my code here,
but now i have trouble with WRITEPI... i can't get it to write value to my PLC i can use READPI and i read it normally.

When i use ajax call i get WRITEPI status 302 redirected.... maybe you have some ideas?
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 16, 2013, 10:42:51 am
Hi,

I have never had such a problem.  What code do you use now to read/write from/to WAGO?
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 16, 2013, 12:53:50 pm
Solved my mystery of write :) looked at your code and saw that in WRITE you need to use ADR1 VALUE1 FORMAT1 in READ  you just use ADR and FORMAT, now working on jsonp data parsing, so i will post my read and write codes here :)
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 17, 2013, 09:27:19 am
Hi,

I am very curious, how you got around the SOP restriction.  I analyzed JSNOP before but thought that access to the response file from the server is neccessary.  I will be happy to see that information to be wrong! 
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: meskas w Stycznia 17, 2013, 10:38:46 am
Yeah... i failed with JSON... :)
Android was able to do it without JSON, but my browsers still hang with cross browsing....
So now it is a long way to code it on my pc then to upload to Android and then to test it...
Tytuł: Odp: Test connection problem
Wiadomość wysłana przez: admin w Stycznia 17, 2013, 11:02:36 am
...but then the original file should be just fine.  It works well on Android (see the source file of the Android App (http://www.edom-plc.pl/index.php?option=com_content&view=article&id=94%3Aandroidappcode&catid=36%3Asterowanie&Itemid=70&lang=en), link at the bottom), but fails on PC unless you use Chrome with the --disable-web-security option (browser restart neccessary)... So all my work is done on PC, almost no testing on Android device.