예제 #1
0
def WR_SYSTEM_StartTest():
    """开始系统测试"""

    #先删除存在的数据文件
    datapath = GetTestDataPath()
    if os.path.exists(datapath):
        os.remove(datapath)

    WWSGC.SendUnixCmd(WWSGC.START_SYSTEMTEST, 0.0, 0.0, 0, 0, 0.0)

    GO_VHUtility.SysStat.StartSysTest()

    return WEB_JSON_Suc
예제 #2
0
def WR_SYSTEM_StopTest():
    """结束系统测试"""

    WWSGC.SendUnixCmd(WWSGC.STOP_SYSTEMTEST, 0.0, 0.0, 0, 0, 0.0)

    GO_VHUtility.SysStat.StopSysTest()

    #等待数据准备好
    timeout = 5
    while timeout > 0:
        if os.path.exists(GetTestDataPath()):
            break
        timeout = timeout - 1
        time.sleep(1)

    retinfo = {}
    retinfo["weightype"] = GO_VHUtility.SysStat.GetWeighType()

    return retinfo
예제 #3
0
def WR_SYSTEM_Authentication():
    """验证系统合法性"""

    Data = request.files.get('filename')
    if Data.file:
        RawData = Data.file.read()
        FileWrite = open(WWSGC.FILE_Certificate(), 'w+')
        FileWrite.write(RawData)
        FileWrite.close()

        #通知底层去验证
        WWSGC.SendUnixCmd(WWSGC.VERIFY_DEVICE, 0.0, 0.0, 0, 0, 0.0)

        #等待验证结果并返回给用户
        timeout = 5
        while timeout > 0:
            if GO_VHUtility.SysStat.GetDevLegal():
                return WEB_JSON_Suc
            timeout = timeout - 1
            time.sleep(1)

    return WEB_JSON_Err