diff --git a/docs/架构设计/逻辑视图设计.md b/docs/架构设计/逻辑视图设计.md index 207e442..ce8f8f4 100644 --- a/docs/架构设计/逻辑视图设计.md +++ b/docs/架构设计/逻辑视图设计.md @@ -280,13 +280,22 @@ const ( cmd指令数据结构示例 ``` +type command_body struct { + System int + Baseline int + Fastscan int + User string + Pwd string +} + + type command_msg struct { Cmd int Ack int - ReqSn int - Crc int + ReqSn int + Body command_body + Crc int } - ``` cmd指令json格式打包示例 @@ -294,12 +303,22 @@ cmd指令json格式打包示例 ``` func cmd_packaging(cmd Command)([]byte,error){ + body:=command_body{ + System:1, + Baseline:1, + Fastscan:1, + User:"", + Pwd:"", + } + pkg:=command_msg{ Cmd:int(cmd), Ack:0, ReqSn:Req_sn, + Body:body, Crc:0, } + Req_sn+=1 json_pkg, err := json.Marshal(pkg) if err != nil { @@ -308,6 +327,8 @@ func cmd_packaging(cmd Command)([]byte,error){ return json_pkg,err } +转换的json格式举例:{"Cmd":0,"Ack":0,"ReqSn":0,"Body":{"System":1,"Baseline":1,"Fastscan":1,"User":"","Pwd":""},"Crc":0} + ``` cmd指令发送