Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:mervis-ide:65-webpanel:webpanel-api [2017/06/21 14:36]
m.chlupac [Request]
en:mervis-ide:65-webpanel:webpanel-api [2019/05/21 09:57]
m.chlupac
Line 6: Line 6:
  
 ==== Request ==== ==== Request ====
 +
 +**URL:** ''http://[ip-address-of-the-plc]/login.cgi''
  
 <code js>{ <code js>{
Line 11: Line 13:
   //optional - only for non-authenticated access   //optional - only for non-authenticated access
   //credentials   //credentials
-  c: {u: karel, p: x} +  c: {u: "karel", p: "x"}
 }</code> }</code>
  
Line 18: Line 20:
 <code js>{ <code js>{
   ver : 1,//version   ver : 1,//version
-  code: ok, //return code +  code: "ok", //return code 
-  msg: “”, //error message +  msg: "", //error message 
-  c : {u: karel, p:x} //must be used for further communication+  c : {u: "karel", p:"x"} //must be used for further communication
 }</code> }</code>
  
Line 26: Line 28:
  
 ==== Request ==== ==== Request ====
 +
 +**URL:** ''http://[ip-address-of-the-plc]/values.cgi''
  
 <code js>{ <code js>{
Line 31: Line 35:
   //optional - only for non-authenticated access   //optional - only for non-authenticated access
   //credentials   //credentials
-  c: {u: karel, p: x},+  c: {u: "karel", p: "x"},
   //variable IDs   //variable IDs
-  v: [ svc://defaultConnection/myVarId1+  v: [ "svc://defaultConnection/myVarId1"
-     svc://otherConnection/xxxYYYYDDD]+     "svc://otherConnection/xxxYYYYDDD"]
 }</code> }</code>
  
   * variable ID is unique string - in future, may be different for different platforms/protocol versions (uPLC - int?, SharkRT - string)   * variable ID is unique string - in future, may be different for different platforms/protocol versions (uPLC - int?, SharkRT - string)
  
-=== Variable specification for RT2 ===+=== Variable specification for Mervis RT ===
  
   * svc - protocol   * svc - protocol
Line 50: Line 54:
  
   - JSON string (AngularJS default behaviour): <code js>{"ver":1,"c":{"u":"karel","p":"x"},"v":["svc://defaultConnection/myVarId1","svc://otherConnection/xxxYYYYDDD"]}</code>   - JSON string (AngularJS default behaviour): <code js>{"ver":1,"c":{"u":"karel","p":"x"},"v":["svc://defaultConnection/myVarId1","svc://otherConnection/xxxYYYYDDD"]}</code>
-  - converted into POST parameters (jQuery default behaviour): +  - converted into POST parameters (jQuery default behaviour):<code>ver=1&c%5Bu%5D=karel&c%5Bp%5D=x&v%5B%5D=svc%3A%2F%2FdefaultConnection%2FmyVarId1&v%5B%5D=svc%3A%2F%2FotherConnection%2FxxxYYYYDDD</code>
- <code>ver=1&c%5Bu%5D=karel&c%5Bp%5D=x&v%5B%5D=svc%3A%2F%2FdefaultConnection%2FmyVarId1&v%5B%5D=svc%3A%2F%2FotherConnection%2FxxxYYYYDDD</code>+
  
-The best solution would be to support both versions. Easier is now the JSON string. 
  
 ==== Response ==== ==== Response ====
Line 72: Line 74:
 === Encoding of values - version 1 === === Encoding of values - version 1 ===
  
-Ea  Unordered List Itemch value is transmitted as a big endian binary representation of the specified variable (and its offset and length).+  Each value is transmitted as a big endian binary representation of the specified variable (and its offset and length).
  
 ===== Command Request ===== ===== Command Request =====
Line 78: Line 80:
 ==== Request ==== ==== Request ====
  
 +**URL:** ''http://[ip-address-of-the-plc]/command.cgi''
  
 <code js>{ <code js>{
Line 83: Line 86:
      //optional - only for non-authenticated access      //optional - only for non-authenticated access
  //credentials  //credentials
- c: {u: karel, p: x},+ c: {u: "karel", p: "x"},
 v: [{ v: [{
-     i: svc://defaultConnection/myVarId1, //variable Id+     i: "svc://defaultConnection/myVarId1", //variable Id
      //digital setter      //digital setter
-     time: 20.0, //digital setter has some time property... +     time: "20.0", //digital setter has some time property... 
-     state: 2, //state that should be applied +     state: "2", //state that should be applied 
-     defaultValue: 6, //some default value+     defaultValue: "6", //some default value
      //analogPlusMinusInit, TPG, ...      //analogPlusMinusInit, TPG, ...
      set: 5,      set: 5,
-     //set: <?cdata....?>” //TPG+     //set: "<?cdata....?>//TPG
      //login - pin      //login - pin
-     login: 1234+     login: "1234"
      }      }
    ]    ]
Line 104: Line 107:
  
 ==== Request ==== ==== Request ====
 +
 +**URL:** ''http://[ip-address-of-the-plc]/history.cgi''
  
 <code js>{ <code js>{
Line 109: Line 114:
      //optional - only for non-authenticated access      //optional - only for non-authenticated access
  //credentials  //credentials
- c: {u: karel, p: x}, + c: {u: "karel", p: "x"}, 
-v: [ {i:svc://defaultConnection/myVarId1+v: [ {i:"svc://defaultConnection/myVarId1"
       from: XXXX,        from: XXXX, 
       to: YYYY       to: YYYY
       },       },
-     {i:svc://defaultConnection/myVarId1+     {i:"svc://defaultConnection/myVarId1"
       from: XXXX,        from: XXXX, 
       to: YYYY       to: YYYY
Line 121: Line 126:
 }</code> }</code>
  
 +==== Response ====
  
- +<code javascript>{ 
-===== Configuration Response ===== + "ver": 1, 
- + "code": "ok", 
-<code js>{ + "msg": "", 
-  ver : 1,//version + "v": [{ 
-  platform“uPLC”+  "i": "svc://DefaultConnection/15[0,1]", 
-  maxVariablesInRequest5+  "v"[{ 
-  maxRequestSize1500, //http body size in bytes +   "t": 636579093300049300, 
-  preferedLanguage“en-US” +   "v": "00" 
-}</code> +  }, 
- +  { 
 +   "t"636579093600055900, 
 +   "v": "00" 
 +  }], 
 +  "n"10 
 + }, 
 + { 
 +  "i": "svc://DefaultConnection/16[0,1]", //variable ID 
 +  "v"
 + { 
 +  "t": 636579093300049300,                //timestamp (UTC) 
 +  "v": "00"                               //value 
 + }, 
 + { 
 +  "t": 636579093600055900, 
 +  "v": "00" 
 + },"n": 10                                //offset for the following request. -1 = reading finished 
 +}
 +
 +</code>
  
  
  • © Energocentrum Plus, s.r.o. 2017 - 2024