Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
cs:mervis-ide:65-webpanel:webpanel-api [2017/06/21 11:22] m.chlupac vytvořeno |
cs:mervis-ide:65-webpanel:webpanel-api [2017/06/21 12:08] m.chlupac |
||
---|---|---|---|
Řádek 1: | Řádek 1: | ||
- | FIXME **Tato stránka ještě není plně přeložena. Pomozte s dokončením překladu.**\\ // | ||
- | |||
====== Webpanel API ====== | ====== Webpanel API ====== | ||
- | Communication is based on HTTP protocol. Clients send HTTP POST request and get the response depending on the request. Each request must specify the credentials in case the credentials are specified for the project. | + | Oficiální verze popisu je dostupná pouze v angličtině: [[en:mervis-ide:65-webpanel:webpanel-api|]] |
- | + | ||
- | ===== Login ===== | + | |
- | + | ||
- | ==== Request ==== | + | |
- | + | ||
- | Data | + | |
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | //optional - only for non-authenticated access | + | |
- | // | + | |
- | c: {u: “karel”, | + | |
- | + | ||
- | }</ | + | |
- | + | ||
- | ==== Response ==== | + | |
- | + | ||
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | code: “ok”, //return code | + | |
- | msg: “”, //error message | + | |
- | c : {u: “karel”, | + | |
- | }</ | + | |
- | + | ||
- | ===== Data request ===== | + | |
- | + | ||
- | ==== Request ==== | + | |
- | + | ||
- | Data | + | |
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | //optional - only for non-authenticated access | + | |
- | // | + | |
- | c: {u: “karel”, | + | |
- | //variable IDs | + | |
- | v: [ “svc:// | + | |
- | | + | |
- | }</ | + | |
- | + | ||
- | * variable ID is unique string - in future, may be different for different platforms/ | + | |
- | + | ||
- | === Variable specification for RT2 === | + | |
- | + | ||
- | * svc - protocol | + | |
- | * Connection - generally, clients can request data from more sources (more or less corresponds to a connection definition of PLC). For local data (data belonging to the PLC that executes the request) it may be defaultconnection. | + | |
- | * Variable id: it has a form of commUID[offset, lenght]. CommUID can be retrieved from a .vlist file of the IDE 2 project and specifies a variable. Variables can be of a complex and large types. In this case a user can retrieve only a small part of the variable by using the offset and length. | + | |
- | * Example: < | + | |
- | * Represents a variable with the commUID 8776. 2 bytes from the offset 0 are returned. | + | |
- | + | ||
- | the POST body can be: | + | |
- | + | ||
- | | + | |
- | <code js> | + | |
- | | + | |
- | < | + | |
- | + | ||
- | The best solution would be to support both versions. Easier is now the JSON string. | + | |
- | + | ||
- | ==== Response ==== | + | |
- | + | ||
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | code: “ok”, //return code | + | |
- | msg: “”, //error message | + | |
- | v: [{ | + | |
- | i: “svc:// | + | |
- | v: ”ACA1”, // | + | |
- | q: “G”,// | + | |
- | t: 654654321654 //timestamp UTC, milliseconds since 1970 | + | |
- | } | + | |
- | ] | + | |
- | }</ | + | |
- | + | ||
- | === 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). | + | |
- | + | ||
- | ===== Command Request ===== | + | |
- | + | ||
- | ==== Request ==== | + | |
- | + | ||
- | + | ||
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | // | + | |
- | // | + | |
- | c: {u: “karel”, | + | |
- | v: [{ | + | |
- | i: “svc:// | + | |
- | // | + | |
- | time: ”20.0”, //digital setter has some time property... | + | |
- | | + | |
- | | + | |
- | // | + | |
- | set: 5, | + | |
- | // | + | |
- | // | + | |
- | | + | |
- | } | + | |
- | ] | + | |
- | }</ | + | |
- | + | ||
- | * Warning : only one variable is expected in the request for the tiniest (uPLC) platforms - other variables are ignored | + | |
- | + | ||
- | ===== Historical Data Request ===== | + | |
- | + | ||
- | ==== Request ==== | + | |
- | + | ||
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | // | + | |
- | // | + | |
- | c: {u: “karel”, | + | |
- | v: [ {i: | + | |
- | from: XXXX, | + | |
- | to: YYYY | + | |
- | }, | + | |
- | | + | |
- | from: XXXX, | + | |
- | to: YYYY | + | |
- | } | + | |
- | ] | + | |
- | }</ | + | |
- | + | ||
- | + | ||
- | + | ||
- | ===== Configuration Response ===== | + | |
- | + | ||
- | <code js>{ | + | |
- | ver : 1,// | + | |
- | platform: “uPLC”, | + | |
- | maxVariablesInRequest: | + | |
- | maxRequestSize: | + | |
- | preferedLanguage: | + | |
- | }</ | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ====== Native/ | + | |
- | + | ||
- | Note: big endian encoding (v1) | + | |
- | * integer (represents int8-int64) | + | |
- | * unsigned integer (represents uint8-uint64) | + | |
- | * double (double64) | + | |
- | * float (float32) | + | |
- | * bool (boolean - 0 ~ false, 1 ~ true) | + | |
- | * dt (date time - the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001) | + | |
- | * time (time - the number of 100-nanosecond intervals) | + | |
- | * Enums are encoded into 32-bit int | + |