def test_disconnect(verbose):
    """test_disconnect.

    DGILibHousekeeping.disconnect
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert dgilib.disconnect() is None
def test_connect(verbose):
    """test_connect.

    DGILibHousekeeping.connect
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert isinstance(dgilib.dgi_hndl, c_uint)
    # Test bigger than 0? Bigger than 4096
    dgilib.disconnect()
def test_connection_status(verbose):
    """test_connection_status.

    DGILibHousekeeping.connection_status
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    assert dgilib.connection_status() == 2
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert dgilib.connection_status() == 0
    dgilib.disconnect()
    assert dgilib.connection_status() == 2
def test_start_polling(verbose):
    """test_start_polling.

    DGILibHousekeeping.start_polling
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert dgilib.start_polling() is None
    # assert dgilib.start_polling() is None
    # dgilib.stop_polling()  # All tests seems to pass without this as well
    dgilib.disconnect()
def test_stop_polling(verbose):
    """test_stop_polling.

    DGILibHousekeeping.stop_polling
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert dgilib.stop_polling() is None
    assert dgilib.stop_polling() is None
    dgilib.start_polling()
    assert dgilib.stop_polling() is None
    dgilib.disconnect()
def test_get_fw_version(verbose):
    """test_get_fw_version.

    DGILibHousekeeping.get_fw_version
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    fw_version = dgilib.get_fw_version()
    assert isinstance(fw_version, tuple)
    assert len(fw_version) == 2
    assert isinstance(fw_version[0], int)
    assert isinstance(fw_version[1], int)
    dgilib.disconnect()
def test_target_reset(verbose):
    """test_target_reset.

    DGILibHousekeeping.target_reset
    """
    dgilib = DGILib(verbose=verbose)
    dgilib.discover()
    device_sn = dgilib.get_device_serial()
    dgilib.dgi_hndl = dgilib.connect(device_sn)
    assert dgilib.target_reset(False) is None
    assert dgilib.target_reset(False) is None
    assert dgilib.target_reset(True) is None
    assert dgilib.target_reset(True) is None
    assert dgilib.target_reset(False) is None
    dgilib.disconnect()