Exemplo n.º 1
0
async def test_set_mouth_lamp():
    # mode: 嘴巴灯模式,0:普通模式,1:呼吸模式
    # color: 嘴巴灯颜色,1:红色,2:绿色,3:蓝色
    # duration: 持续时间,单位为毫秒,-1表示常亮
    # breath_duration: 闪烁一次时长,单位为毫秒
    """测试设置嘴巴灯

    设置机器人嘴巴灯正常模式、绿色、常亮3s,并等待回复结果

    当mode=NORMAL时,duration参数起作用,表示常亮多久时间

    当mode=BREATH,breath_duration参数起作用,表示多久呼吸一次

    #SetMouthLampResponse.isSuccess : 是否成功

    #SetMouthLampResponse.resultCode : 返回码

    """

    block: SetMouthLamp = SetMouthLamp(color=MouthLampColor.GREEN,
                                       mode=MouthLampMode.NORMAL,
                                       duration=3000,
                                       breath_duration=1000)
    # response:SetMouthLampResponse
    (resultType, response) = await block.execute()

    print(f'test_set_mouth_lamp result: {response}')

    assert resultType == MiniApiResultType.Success, 'test_set_mouth_lamp timetout'
    assert response is not None and isinstance(
        response,
        SetMouthLampResponse), 'test_set_mouth_lamp result unavailable'
    assert response.isSuccess or response.resultCode == 504, 'set_mouth_lamp failed'
Exemplo n.º 2
0
async def test_set_mouth_lamp():
    # mode: 嘴巴灯模式,0:普通模式,1:呼吸模式
    # color: 嘴巴灯颜色,1:红色,2:绿色,3:蓝色
    # duration: 持续时间,单位为毫秒,-1表示常亮
    # breath_duration: 闪烁一次时长,单位为毫秒


    block: SetMouthLamp = SetMouthLamp(color=MouthLampColor.GREEN, mode=MouthLampMode.NORMAL,
                                       duration=3000, breath_duration=1000)
    # response:SetMouthLampResponse
    (resultType, response) = await block.execute()

    print(f'test_set_mouth_lamp result: {response}')

    assert resultType == MiniApiResultType.Success, 'test_set_mouth_lamp timetout'
    assert response is not None and isinstance(response, SetMouthLampResponse), 'test_set_mouth_lamp result unavailable'
    assert response.isSuccess or response.resultCode == 504, 'set_mouth_lamp failed'