差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
openinstru_protocol [2021/02/22 21:51]
gongyusu
openinstru_protocol [2021/02/22 22:02] (当前版本)
gongyusu
行 1: 行 1:
-==== Command Format ====+## 命令格式
  
 ---- ----
-  * The JSON data below is expanded for readability. ​ All JSON should be minified (white space removed) before transmission+  * 下面的JSON数据已扩展以提高可读性。在传输之前,应将所有JSON缩小(删除空白)
-  * Unless otherwise noted all commands are sent using the POST method when using HTTP+  * 除非另有说明,否则使用HTTP时,所有命令均使用POST方法发送
-  * All Digilent Instrumentation ​Protocol commands must be a JSON object or a chunked transfer+  * 所有Digilent Instrumentation协议命令必须是JSON对象或分块传输
-    * **JSON ​Object** +    * **JSON对象** 
-      * Must start with a '​{' ​character and ends with a '​}' ​character+      * 必须以'​{'​字符开头,并以'​}'​字符结尾
-      * May be followed by one or more '​\r\n'​. +      * 可能后跟一个或多个'\ r \ n'. 
-    *  **Chunked Transfer** +    *  **大块转移** 
-      * Composed of one or more chunks+      * 由一个或多个块组成
-      * Each chunk must begin with the number of bytes in the chunk in ASCII hexidecimal format followed by one '​\r\n'​, the binary data, and one '​\r\n'​. +      * 每个块必须以ASCII十六进制格式的块中的字节数开头,后跟一个'\ r \ n',二进制数据和一个'\ r \ n'. 
-        * The chunk length does not include the '​\r\n' ​between the chunk length and the data+        * 块长度在块长度和数据之间不包含'\ r \ n'. 
-        * The chunk length does not include the trailing ​'​\r\n' ​after the binary data+        * 块长度不包含二进制数据后的尾随'\ r \ n'. 
-      * Each chunked transfer is terminated with a zero length chunk.+      * 每个分块传输都以零长度的分块终止.
       * Ex.       * Ex.
 <​code>​ <​code>​
行 25: 行 25:
 \r\n \r\n
 </​code>​ </​code>​
 +
 +## 多命令
 +
 +----
 +可以使用多命令在单个事务中发送多个命令。
 +
 +### 举例:
 +<WRAP group>
 +<WRAP half column>
 +**Command**
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​voltage":​3300
 +         },
 +         {
 +            "​command":"​getVoltage"​
 +         }
 +      ],
 +      "​2":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​voltage":​5000
 +         }
 +      ]
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +<WRAP half column>​**Response**</​WRAP>​
 +<​code>​
 +{
 +   "​dc":​{
 +      "​1":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​statusCode":​0,​
 +            "​wait":​500
 +         },
 +         {
 +            "​command":"​getVoltage",​
 +            "​statusCode":​0,​
 +            "​wait":​100, ​           ​
 +            "​voltage":​3300
 +         }
 +      ],
 +      "​2":​[
 +         {
 +            "​command":"​setVoltage",​
 +            "​statusCode":​0,​
 +            "​wait":​500
 +         }
 +      ]
 +   }
 +}
 +</​code>​
 +</​WRAP>​
 +\\
 +\\
 +
 +