def T_14_58Chip_A(product):
    u"5.8G芯片测试-测试5.8G芯片工作是否正常"
    try:
        __stateAtSerial(product)
        __getIVB().obuTest(product.productSlot).Test5_8G()
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_06_rs232Test_A(product):
    u"RS232测试-测试OBU串口工作是否正常"
    try:
        __stateAtSerial(product)
        __getIVB().obuTest(product.productSlot).TestUART()
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
Exemplo n.º 3
0
def finalFun(product):
    global finishedTestSlots
    finishedTestSlots += 1
    try:
        __getIVB().peripheralCtrl(product.productSlot).obuPowerCtrl(0x03) # OBU下电
        __getIVB().peripheralCtrl(product.productSlot).channelSelect(0x03)
    except IntegratedVATBoard.DeviceNoResponseException,e:
        pass
Exemplo n.º 4
0
def T_02_switchToDigitalTestBoard_A(product):
    u"切换数字测试板-切换到数字测试模式"
    time.sleep(1)
    __getIVB().peripheralCtrl(product.productSlot).channelSelect(0x04)
    __getIVB().peripheralCtrl(product.productSlot).obuPowerCtrl(0x01)
    #__getVersionDownloadBoard().powerOn(int(product.productSlot),False)
    # vdb = __getVersionDownloadBoard()
    # vdb.powerOn(int(product.productSlot),True)
    time.sleep(int(product.productSlot))
def __stateAtNLK(product):
    # 转入NuLink模式,用于读写Flash及下载版本
    if "channelState" not in product.param or product.param[
            "channelState"] != 0x01:
        try:
            __getIVB().peripheralCtrl(product.productSlot).channelSelect(0x01)
            product.param["channelState"] = 0x01
        except IntegratedVATBoard.DeviceNoResponseException, e:
            raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_11_testHFChip_A(product):
    u"测试高频芯片-测试高频芯片"
    global vstLock
    try:
        vstLock.acquire()
        __stateAtSerial(product)
        __getIVB().obuTest(product.productSlot).TestHFChip()
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def _T_13_TestVst_A(product):
    u"VST发送验证-控制OBU发送VST并使用监听确认"
    testTimes = 5
    try:
        __stateAtSerial(product)
        __getIVB().obuTest(product.productSlot).TestSendVst()
        if not __getVstChecker().checkRecv(product.productSlot, testTimes):
            raise TestItemFailException(failWeight=10,
                                        message=u'VST测试不通过:未监听到VST')
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def setup(product):
    SESSION["isMend"] = True
    global started
    if not started:
        started = True
        if IntegratedVatTrigger.INSTANCE is None: IntegratedVatTrigger()
        IntegratedVatTrigger.INSTANCE.closeClap()

    #OBU上电
    __getIVB().peripheralCtrl(product.productSlot).obuPowerCtrl(0x01)

    time.sleep(0.5)
def setup(product):
    SESSION["isMend"] = True
    #OBU上电
    global started
    if not started:
        started = True
        if IntegratedVatTrigger.INSTANCE is None: IntegratedVatTrigger()
        __allSlotToSerial()
        IntegratedVatTrigger.INSTANCE.closeClap()
        __getVstChecker().prepareToTest()
    __getIVB().peripheralCtrl(product.productSlot).obuPowerCtrl(0x01)
    time.sleep(0.7)
def T_15_staticCurrent_A(product):
    u"静态电流测试-读取静态电流值,并判断是否在阈值范围内"
    try:
        #staticCurrentRLock.acquire()
        __stateAtSerial(product)
        __getIVB().obuTest(product.productSlot).OBUEnterSleep()
        __getIVB().peripheralCtrl(product.productSlot).channelSelect(0x03)
        __getIVB().peripheralCtrl(product.productSlot).obuPowerCtrl(0x02)
        uiLog(u"切换到休眠状态,关闭串口")
        time.sleep(0.5)

        vtg = __getIVB().peripheralCtrl(
            product.productSlot).readObuCurrentVoltage(100)
        #staticCurrent = (vtg*100)/14.99/1000.0
        staticCurrent = (vtg / 1000.0) / 166375.0
        resultMap = {u"静态电流": staticCurrent}
        sl, sh = SP('gs11.staticCurrent.low', 0), SP('gs11.staticCurrent.high',
                                                     12e-6)
        if staticCurrent < sl or staticCurrent > sh:
            raise TestItemFailException(
                failWeight=10,
                message=u'静态电流测试不通过,值:%.2e,正常阈值%.2e-%.2e' %
                (staticCurrent, sl, sh),
                output=resultMap)
        return resultMap
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_12_readRfCard_A(product):
    u"高频读卡测试-测试高频读卡是否正常"
    testTimes = SP('gs11.testHf.number', 5, int)  #测试次数
    global vstLock
    try:
        vstLock.acquire()
        __stateAtSerial(product)
        failTimes = __getIVB().obuTest(product.productSlot).TestHF(testTimes)
        if failTimes != 0:
            raise TestItemFailException(failWeight=10,
                                        message=u'高频芯片读卡失败%d次' % failTimes)
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_10_batteryVoltage_A(product):
    u"电池电路电压测试-读取电池电路电压值,并判断是否在阈值内"
    try:
        __stateAtSerial(product)
        r = __getIVB().obuTest(product.productSlot).TestBattPower()
        sl, sh = SP('gs11.batteryPower.board.low',
                    3350), SP('gs11.batteryPower.board.high', 3480)
        if r < sl or r > sh:
            raise TestItemFailException(failWeight=10,
                                        message=u'电池电路电压测试不通过,值:%d,正常阈值%d-%d' %
                                        (r, sl, sh),
                                        output={u"电池电路电压": r})
        return {u"电池电路电压": r}
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_08_capacityVoltage_A(product):
    u"电容电路电压测试-读取电容电路电压值,并判断是否在阈值内"
    try:
        __stateAtSerial(product)
        r = __getIVB().obuTest(product.productSlot).TestCapPower()
        cl, ch = SP('gs11.capPower.board.low',
                    3030), SP('gs11.capPower.board.high', 3250)
        if r < cl or r > ch:
            raise TestItemFailException(failWeight=10,
                                        message=u'电容电压测试不通过,值:%d,正常阈值%d-%d' %
                                        (r, cl, ch),
                                        output={u"电容电路电压": r})
        return {u"电容电路电压": r}
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def T_07_esamTest_A(product):
    u"ESAM测试-测试ESAM工作是否正常"
    try:
        __stateAtSerial(product)
        esam = __getIVB().obuTest(product.productSlot).TestESAM()
        esamId = esam[22:30]
        #check esam district code

        if PARAM["esamType"] == '1': tdc = u"重庆"
        elif PARAM["esamType"] == '2': tdc = u"贵州"
        else: tdc = PARAM["esamType"]

        targetDistrictCode = tdc.decode().encode("gbk").encode("hex").upper()
        if targetDistrictCode not in esam:
            raise AbortTestException(message=u'ESAM类型不正确,应使用%s的ESAM' % tdc)
        return {"ESAM": esam, "ESAMID": esamId}
    except IntegratedVATBoard.DeviceNoResponseException, e:
        raise AbortTestException(message=u'工装板通信失败,无法继续测试')
def __allSlotToSerial():
    for slot in PARAM["productSlots"].split(","):
        __getIVB().peripheralCtrl(slot).channelSelect(0x02)