Exemple #1
0
def SendMake(self, plan, flag, data, value, timeout, answer):
    if self.uid.flags["__isopen__"] is False:
        return

    if self.test["timeout"] > 0:
        self.test["timeout"] -= 0.1
        return

    if flag == '发送' or flag == 'Read' or flag == 'Set':
        # 曲线读配置文件发送
        if value == "config" and CuverInfo["Index"] == 0:
            cfg = pub.loadDefaultSettings("cuver.json")
            CuverInfo["List"] = CuverFonfig(cfg["start"], cfg["num"],
                                            cfg["density"])
            value = CuverInfo["List"][0]
            CuverInfo["Index"] += 1
        elif value == "config" and CuverInfo["Index"] > 0:
            if CuverInfo["Index"] < len(CuverInfo["List"]):
                value = CuverInfo["List"][CuverInfo["Index"]]
                CuverInfo["Index"] += 1
            elif CuverInfo["Index"] >= len(CuverInfo["List"]):
                self.test["Index"] += 1
                CuverInfo["Index"] = 0

        if ('NLY1502_LY_JSON' in plan) and (flag == 'Read' or flag == 'Set'):
            prtl = judgePrtl(plan)
            List = dict(zip([data], [value]))
            VList = []
            VList += [flag]
            VList += [List]
            senddata = prtl2Make(prtl, VList)
            print(senddata)
        elif flag == '发送':
            senddata = data
            print(senddata)

        # 显示 串口发送
        if self != None:
            mainlog = showinfo.addTimelog(senddata)
            self.uim.SendTextEdit.append(mainlog)
            showinfo.recLog(mainlog)

            # 串口发送
            serialSend(plan, senddata, self)

            # 保存发送帧,用于接收部分比对
            self.test["SendFrame"] = senddata
            self.test["Answer"] = answer

        if timeout == '':
            timeout = 3
        self.test["timeout"] = timeout
        print("SendProcess sendindex:", self.test["Index"] - 1)
        if CuverInfo["Index"] > 0:
            print("cuverindex:", CuverInfo["Index"] - 1)
    else:
        self.test["timeout"] = 0
        self.test["Index"] += 1
Exemple #2
0
 def upgradeCheckVision(self):
     prtl = judgePrtl("LY_JSON")
     data = "04A00101"
     value = ""
     List = dict(zip([data], [value]))
     VList = []
     VList += ["Read"]
     VList += [List]
     senddata = prtl2Make(prtl, VList)
     return senddata
Exemple #3
0
 def upgradeCheckVision(self):
     prtl = judgePrtl("LY_JSON")
     data = "04A00101"
     value = ""
     List = dict(zip([data], [value]))
     VList = {}
     # VList += ["Read"]
     # VList += [List]
     VList['Cmd'] = "Read"
     VList['DataValue'] = List
     senddata = prtl2Make(prtl, VList)
     return senddata
Exemple #4
0
 def upgradeStart(self):
     prtl = judgePrtl("LY_JSON")
     data = "04A00502"
     # 产品类型 + 版本日期 + 软件版本 + 硬件版本 + 文件总长 + 总包数 + 包长度 + 文件CRC校验 + 升级模式字
     # value = "28210000#18121716#01010002#01000000#0001f9c1#03f4#80#75d3#0000"
     value = "28210000#19042515#01000099#01010000#" + self.FILE_LEN + "#" + self.FILE_PACK_NUM + "#" + "80" + "#" + self.FILE_CRC + "#" + "0000"
     List = dict(zip([data], [value]))
     VList = []
     VList += ["UpDate"]
     VList += [List]
     senddata = prtl2Make(prtl, VList)
     return senddata
Exemple #5
0
    def upgradeCheckPack(self, sindex):
        prtl = judgePrtl("LY_JSON")
        data = "04A00503"
        # value = "594C#03#03F4#000" + sindex  # 索引号从1开始      厂家标识 + 设备类型 + 总包数 + 当前包序号 + 单包数据单元
        value = self.FILE_MANUIDEN + "#" + self.FILE_DEV_TYPE + "#" + self.FILE_PACK_NUM + "#000" + sindex  # 索引号从1开始      厂家标识 + 设备类型 + 总包数 + 当前包序号 + 单包数据单元

        List = dict(zip([data], [value]))
        VList = []
        VList += ["Read"]
        VList += [List]
        senddata = prtl2Make(prtl, VList)
        return senddata
Exemple #6
0
 def upgradeSendFile(self, i):
     sindex = hex(i + 1).replace("0x", "0000")[-4:]
     prtl = judgePrtl("LY_JSON")
     data = "04A00501"
     # print(value)
     value = pfun._strReverse(self.flist[i])
     # print(value)
     value = self.FILE_MANUIDEN + "#" + self.FILE_DEV_TYPE + "#" + self.FILE_PACK_NUM + "#" + sindex + "#" + value  # 字节倒序
     List = dict(zip([data], [value]))
     VList = []
     VList += ["UpDate"]
     VList += [List]
     senddata = prtl2Make(prtl, VList)
     return senddata
Exemple #7
0
 def upgradeStart(self):
     prtl = judgePrtl("LY_JSON")
     data = "04A00502"
     # 产品类型 + 版本日期 + 软件版本 + 硬件版本 + 文件总长 + 总包数 + 包长度 + 文件CRC校验 + 升级模式字
     # value = "28210000#18121716#01010002#01000000#0001f9c1#03f4#80#75d3#0000"
     value = "28210000#20121110#01031006#01030000#" + self.FILE_LEN + "#" +  self.FILE_PACK_NUM + "#" + "80" + "#" +  self.FILE_CRC + "#" + "0000"
     List = dict(zip([data], [value]))
     # VList = []
     # VList += ["UpDate"]
     # VList += [List]
     VList = {}
     VList['Cmd'] = "UpDate"
     VList['DataValue'] = List
     senddata = prtl2Make(prtl, VList)
     return senddata