Exemplo n.º 1
0
def test_equal_temperature():
    from zivid.camera_state import CameraState

    temperature1 = CameraState.Temperature(dmd=33)
    temperature2 = CameraState.Temperature(dmd=33)

    assert temperature1 == temperature2
Exemplo n.º 2
0
def test_not_equal_state():
    from zivid.camera_state import CameraState

    state1 = CameraState(available=True)
    state2 = CameraState(available=False)

    assert state1 != state2
def to_camera_state(internal_camera_state):
    """Convert camera state to internal camera state.

    Args:
        internal_camera_state: a internal camera state object

    Returns:
        a camera state object

    """

    def to_temperature(internal_temperature):
        return CameraState.Temperature(
            dmd=internal_temperature.dmd.value,
            general=internal_temperature.general.value,
            led=internal_temperature.led.value,
            lens=internal_temperature.lens.value,
            pcb=internal_temperature.pcb.value,
        )

    return CameraState(
        available=internal_camera_state.available.value,
        connected=internal_camera_state.connected.value,
        live=internal_camera_state.live.value,
        temperature=to_temperature(internal_camera_state.temperature),
    )
 def to_temperature(internal_temperature):
     return CameraState.Temperature(
         dmd=internal_temperature.dmd.value,
         general=internal_temperature.general.value,
         led=internal_temperature.led.value,
         lens=internal_temperature.lens.value,
         pcb=internal_temperature.pcb.value,
     )