7 unresolved threads
7 unresolved threads
Merge request reports
Activity
requested review from @liyinjie
assigned to @limeng
59 import AcpHub 60 from acp_plc.plchandler import VarList 61 from acp_plc.plchandler import VarInfo 62 import acp_plc.plchandler 63 def main(): 64 acpclient = AcpHub.AcpClient(200,"PLCCTRL") 65 timeout_ms = 1000 66 max_retry = 5 67 req = AcpHub.pyacp.acp_idl.Request() 68 req.write_req.id_group = acp_plc.plchandler.Idgroups.PLC_WRITESYMBOL 69 data = VarList() 70 varinfo = VarInfo() 71 unsigned_char_array_0 = bytes([1]) 72 varinfo.psz_name = "Application.GVL.OP21.test01" 73 varinfo.psz_type = "BOOL" 74 varinfo.ul_type_id = 0 ul_type_id =
PLC_TYPE_CLASS_HIGH | PLC_TYPE_CLASS_LOW
changed this line in version 2 of the diff
9 9 10 10 首先 [安装 pyacp]({{< relref "/docs/download" >}}). 11 11 12 ### Install (Two ways) 13 #### 1. pip install pyacp changed this line in version 3 of the diff
1 --- 2 name: messages_protobuf_compile 3 language: python 4 library: pyacp 5 --- 6 ### 前提 7 如果您需要手动编译业务协议,请在python内安装betterproto,并且您需要protoc 8 关于安装protoc: changed this line in version 4 of the diff
49 #destory:销毁当前订阅端 50 def destory(self): 51 52 class AcpPublisher:#发布订阅模式下的发布端,用于发布数据给接受者,支持一对多 53 54 #构造函数: device id与topic唯一确定通信端。 55 def __init__(self,device_id: Union[int],topic: Union[str]): 56 #publish:主动推送数据,数据类型要和订阅端一致。ps:Request 和Response在这里不是请求和响应的意思,而是为了统一数据类型。换而言之,用Request和Response完全取决于用户需要 57 def publish(self,message : Union[acp_idl.Request,acp_idl.Response]): 58 #hassubscribers: 查看是否有订阅端等待接收数据,建议在真正发布数据前使用,并在检查到订阅端后再发布数据,避免不必要的资源浪费。 59 def hassubscribers(self): 60 #destroy:主动销毁发布端。 61 def destroy(self): 62 ``` 63 64 ## 协议描述 该章节建议直接引用到 请参考
[ACP 控制命令]({{< relref "/docs/acp/basic/basic/#acp-控制命令" >}})
.章节跳转
Edited by 李胤颉
135 if __name__ == "__main__": 136 main() 21 137 22 138 ``` 23 139 24 140 Client: 25 141 ```python 26 # 27 # Hello World client in Python 28 # Sends "Hello" to server, expects "World" back 29 # 142 from datetime import date 143 import sys 144 import AcpHub 145 def main(): 146 # ###########################Single varible############################################# changed this line in version 4 of the diff
6 6 library: pyacp 7 7 --- 8 8 9 ## Downloading 9 ## 下载 10 10 11 Unless you specifically want to develop pyacp, we recommend downloading 12 the pyacp source code or wheels from 11 除非您特别想开发pyacp,否则我们建议您下载 12 pyacp 源码或者 wheels 在如下链接 13 13 [PyPI](https://pypi.io/project/pyacp/), 14 or install with conda. 14 或者conda 安装 changed this line in version 4 of the diff
7 7 --- 8 8 9 ## Downloading 9 ## 下载 10 10 11 Unless you specifically want to develop pyacp, we recommend downloading 12 the pyacp source code or wheels from 11 除非您特别想开发pyacp,否则我们建议您下载 12 pyacp 源码或者 wheels 在如下链接 13 13 [PyPI](https://pypi.io/project/pyacp/), 14 or install with conda. 14 或者conda 安装 15 15 16 You can also get the latest source code from our GitHub repository, but 17 building from the repository will require that you install recent Cython. 16 您也可以从我们的GitHub存储库中获取最新的源代码,但是 这段翻译也不适用咱们
Edited by 李胤颉changed this line in version 4 of the diff
mentioned in commit 39b75710