2 Star 1 Fork 0

周一恒/Mode

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
PV.py 1.12 KB
一键复制 编辑 原始数据 按行查看 历史
Your Name 提交于 2023-11-21 15:51 . 提交暂存
from epics import PV
from logger import getLogger
import requests
import time
logger = getLogger("PV")
url = "http://127.0.0.1:8099/api/modeconf/notice"
class PV_Class():
def __init__(self):
self._uuid = "TEST:Mode:uuid"
self.task_id_conn = False
self.uuid_conn = False
self.uuid = PV(self._uuid,callback=self.onValueChange,connection_callback=self.onConnectionChange)
logger.info("Init finish")
def onConnectionChange(self,pvname=None ,conn= None,**kws):
if pvname == self._uuid:
self.uuid_conn = conn
def onValueChange(self,pvname=None, value=None, host=None, **kws):
if self.uuid_conn:
if not len(self.uuid.get(as_string = True)) == 0:
params = {"task_id":self.uuid.get(as_string = True).replace(" ","").split("&")[0],"uuid":self.uuid.get(as_string = True).replace(" ","").split("&")[1],"source":1}
res = requests.get(url = url,params = params)
logger.info("data:"+str(params)+"\tresult:"+str(res.text))
if __name__ == "__main__":
pv = PV_Class()
while True:
time.sleep(1)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zyh-j/mode.git
git@gitee.com:zyh-j/mode.git
zyh-j
mode
Mode
master

搜索帮助