示例#1
0
def UpdateDeviceInfo(model_type):
    handleSql = pushToSql.handleSql()
    print("****************!!!!!!!!********************************")
    print(model_type)
    deviceFixId = request.args.get("deviceFixId")
    t = handleSql.returnDeviceInfo(deviceFixId, model_type)
    print(t)
    print(type(t))
    print(request.args.get("deviceFixId"))
    return Response(json.dumps(t), mimetype='application/json')
示例#2
0
def download_file(kindname, filename):
    handleSql = pushToSql.handleSql()
    deviceFixId = request.args.get("deviceFixId")
    deviceProvince = handleSql.selectRegion(deviceFixId)
    directory = os.getcwd()  # 假设在当前目录
    print(os.path.join(directory, "download", kindname + "_" + deviceProvince))
    print(filename)
    return send_from_directory(os.path.join(directory, "download",
                                            kindname + "_" + deviceProvince),
                               filename,
                               as_attachment=True)
示例#3
0
def resetConfigInfo():
    handleSql = pushToSql.handleSql()
    configInfo = request.get_data()  # bytes 类型
    configInfo = str(configInfo, encoding="utf-8")  # bytes类型转字符串
    configInfo = eval(configInfo)  # 字符串转字典
    # print(configInfo)
    # 收到网页端更新数据库的请求 可能更新 deviceList中设备,更新内容为{文件,频道列表} 我需要把文件列表 发给相
    # 应的设备,告诉其应该更新文件了。再发送其命令更新设备信息。 也就是说我需要向回发送两条命令
    # 发送而来的文件名字其实没有什么用,因为我不更新这个东西。
    # 发送而来的channelsList有用,我要更新数据库中图片的大小。

    # --- 更新数据库中图片的大小----
    channelsList = configInfo['channelsList']
    deviceList = configInfo['deviceList']
    for deviceFixId in deviceList:
        for channel in channelsList:
            channelName = channel['name']
            print(channel.keys())
            if "HDMI" in channel.keys():
                kind = "HDMI"
                leftTopX = channel['HDMI']['lt'][0]
                leftTopY = channel['HDMI']['lt'][1]
                rightBottomX = channel['HDMI']['rb'][0]
                rightBottomY = channel['HDMI']['rb'][1]
                handleSql.updatePictureSize(deviceFixId, channelName, kind,
                                            leftTopX, leftTopY, rightBottomX,
                                            rightBottomY)
            if "AV" in channel.keys():
                kind = "AV"
                leftTopX = channel['AV']['lt'][0]
                leftTopY = channel['AV']['lt'][1]
                rightBottomX = channel['AV']['rb'][0]
                rightBottomY = channel['AV']['rb'][1]
                handleSql.updatePictureSize(deviceFixId, channelName, kind,
                                            leftTopX, leftTopY, rightBottomX,
                                            rightBottomY)

            # handleSql.updatePictureSize(deviceFixId, channelName, leftTopX, leftTopY, rightBottomX, rightBottomY)
    # --  向客户端发送更新文件命令  ----

    print(sockeIdToSocketDict)
    print(fixIdToSocketIdDict)
    print(threadDict)

    filesList = configInfo['filesList']  # 需要更新文件类型
    print(filesList)
    for deviceFixId in deviceList:
        sendBackOrder(deviceFixId, "UpdateInfo,HDMI")
        sendBackOrder(deviceFixId, "UpdateInfo,AV")
        if filesList:
            for file in filesList:
                sendBackOrder(deviceFixId, 'UpdateModelFile,' + file)

    return "123"
示例#4
0
 def __init__(self, socketId, parent):
     super(Thread, self).__init__(parent)
     self.myParent = parent
     self.socketId = socketId  # socketID 可能是为socket编号
     self.hdmi_old_result = ""  # 为自动识别提供的 变量,可防止重复数据不停地输出
     self.av_old_result = ""  # 不共享变量
     self.handleSql = pushToSql.handleSql()
     self.pushDeviceInfoSignal.connect(self.pushDeviceInfo)
     self.pushResultInfoSignal.connect(self.pushResultInfo)
     self.pushPictureSizeSignal.connect(self.pushPictureSize)
     self.pushFileInfoSignal.connect(self.pushFileInfo)
     self.popDeviceSignal.connect(self.popDevice)
示例#5
0
def configureInfo():
    handleSql = pushToSql.handleSql()
    deviceFixIds = request.args.get(
        'data')  # 发来很多设备,说明有很多设备要配置。默认用户知道这一批修改格式相同
    deviceFixIds = eval(deviceFixIds)
    if len(deviceFixIds) != 0:
        deviceFixId = deviceFixIds[0]  # 只查一台设备
    else:
        return "123"
    configJson = handleSql.selectConfigInfo(deviceFixId)
    print(configJson)
    return configJson
示例#6
0
def resultInfo():
    handleSql = pushToSql.handleSql()
    deviceNameAndDate = request.args.get('data')
    deviceNameAndDateDict = eval(deviceNameAndDate)  # 字符串转字典
    deviceName = deviceNameAndDateDict['name']
    deviceDate = deviceNameAndDateDict['date']

    x = handleSql.selectResultInfo(deviceName, deviceDate)
    # print(sockeIdToSocketDict)
    # print(fixIdToSocketIdDict)
    # print(threadDict)
    return x
示例#7
0
def deviceInfo():
    handleSql = pushToSql.handleSql()
    region = request.args.get('data')  # 收到数据
    region = eval(region)  # 将数据转换成list 长度可能为1,2,3
    print(type(region))
    print(region)
    if len(list(region)) == 1:  # 如果长度为1 ,说明要查一个省
        regionProvince = region[0]
        deviceFixIdJson = handleSql.selectDeviceInfo(regionProvince)
    elif len(list(region)) == 2:  # 如果长度为2, 说明要查省市
        regionProvince = region[0]
        regionCity = region[1]
        deviceFixIdJson = handleSql.selectDeviceInfo(regionProvince,
                                                     regionCity)
    else:  # 如果长度为3, 说明要查省市区
        regionProvince = region[0]
        regionCity = region[1]
        regionArea = region[2]
        deviceFixIdJson = handleSql.selectDeviceInfo(regionProvince,
                                                     regionCity, regionArea)
    return deviceFixIdJson