Skip to content

Device Manager Demo

This demo serves as a Hello World example for the SDK due to its simplicity.
The following code demonstrates how to check the available video devices on the board by calling printVideoDeviceList(), if any are present. Otherwise, "No device" will be displayed.

Code Example

#include "AvtCore.h"
#include "DeviceHelper.h"
#include <iostream>
using namespace AVTSDK;
using namespace AVTSDK::Log;

using namespace std;

int main()
{
    AvtCore::init(AvtLogLevel::LOG_LEVEL_WARNING, AvtLogType::LOG_TYPE_DELAYED);

    DeviceHelper deviceHelper;

    if (deviceHelper.getVideoDeviceCount() > 0) {
        deviceHelper.printVideoDeviceList();
    } else {
        cout << "No Device" << endl;
    }

    AvtCore::uninit();
    return 0;
}

Explanation

Helper Classes

DeviceHelper is a helper class written for the demos and is not part of the library. For details about how to handle devices, please check the source code in DeviceHelper.cpp.

  1. Initialization

    The program begins by initializing the AVT core with a warning-level log configuration.

  2. Device Listing

    A DeviceHelper instance is created to access device-related utilities.
    The program checks whether any video devices are available using getVideoDeviceCount().

    • If devices are found, printVideoDeviceList() is called to display them.
    • If no devices are available, a message "No Device" is printed to standard output.
  3. Termination

    The AVT core is uninitialized using AvtCore::uninit() before the program exits.