AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
CNTV2DeviceScanner Class Reference

This class is used to enumerate AJA devices that are attached and known to the local host computer. More...

#include <ntv2devicescanner.h>

Public Member Functions

 CNTV2DeviceScanner (const bool inScanNow=true)
 Constructs me. More...
 
 CNTV2DeviceScanner (bool inScanNow, UWord inDeviceMask)
 
 CNTV2DeviceScanner (const CNTV2DeviceScanner &inDeviceScanner)
 Constructs me from an existing CNTV2DeviceScanner instance. More...
 
virtual CNTV2DeviceScanneroperator= (const CNTV2DeviceScanner &inDeviceScanner)
 Assigns an existing CNTV2DeviceScanner instance to me. More...
 
virtual void ScanHardware (void)
 Re-scans the local host for connected AJA devices. More...
 
virtual void ScanHardware (UWord inDeviceMask)
 
virtual size_t GetNumDevices (void) const
 Returns the number of AJA devices found on the local host. More...
 
virtual bool DeviceIDPresent (const NTV2DeviceID inDeviceID, const bool inRescan=false)
 Returns true if one or more AJA devices having the specified device identifier are attached and known to the host. More...
 
virtual bool GetDeviceInfo (const ULWord inDeviceIndexNumber, NTV2DeviceInfo &outDeviceInfo, const bool inRescan=false)
 Returns detailed information about the AJA device having the given zero-based index number. More...
 
virtual NTV2DeviceInfoListGetDeviceInfoList (void)
 Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques. More...
 
virtual const NTV2DeviceInfoListGetDeviceInfoList (void) const
 Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques. More...
 
virtual void SortDeviceInfoList (void)
 Sorts my device list by ascending PCI slot number. More...
 
virtual ~CNTV2DeviceScanner ()
 

Static Public Member Functions

static bool GetDeviceAtIndex (const ULWord inDeviceIndexNumber, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the AJA device having the given zero-based index number. More...
 
static bool GetFirstDeviceWithID (const NTV2DeviceID inDeviceID, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the first AJA device found on the host that has the given NTV2DeviceID. More...
 
static bool GetFirstDeviceWithName (const std::string &inNameSubString, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose device identifier name contains the given substring. More...
 
static bool GetFirstDeviceWithSerial (const std::string &inSerialStr, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose serial number contains the given value. More...
 
static bool GetDeviceWithSerial (const uint64_t inSerialNumber, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose serial number matches the given value. More...
 
static bool GetFirstDeviceFromArgument (const std::string &inArgument, CNTV2Card &outDevice)
 Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command line argument according to the following evaluation sequence: More...
 
static bool CompareDeviceInfoLists (const NTV2DeviceInfoList &inOldList, const NTV2DeviceInfoList &inNewList, NTV2DeviceInfoList &outDevicesAdded, NTV2DeviceInfoList &outDevicesRemoved)
 Compares two NTV2DeviceInfoLists and returns a list of additions and a list of removals. More...
 
static std::string GetDeviceRefName (CNTV2Card &inDevice)
 
static bool IsLegalDecimalNumber (const std::string &inStr, const size_t inMaxLength=2)
 
static uint64_t IsLegalHexSerialNumber (const std::string &inStr)
 
static bool IsHexDigit (const char inChr)
 
static bool IsDecimalDigit (const char inChr)
 
static bool IsAlphaNumeric (const char inStr)
 
static bool IsAlphaNumeric (const std::string &inStr)
 
static bool IsLegalSerialNumber (const std::string &inStr)
 

Detailed Description

This class is used to enumerate AJA devices that are attached and known to the local host computer.

Definition at line 208 of file ntv2devicescanner.h.

Constructor & Destructor Documentation

◆ CNTV2DeviceScanner() [1/3]

CNTV2DeviceScanner::CNTV2DeviceScanner ( const bool  inScanNow = true)
explicit

Constructs me.

Parameters
[in]inScanNowSpecifies if a scan should be made right away. Defaults to true. If false is specified, the client must explicitly call ScanHardware to enumerate NTV2 devices.

Definition at line 90 of file ntv2devicescanner.cpp.

◆ CNTV2DeviceScanner() [2/3]

CNTV2DeviceScanner::CNTV2DeviceScanner ( bool  inScanNow,
UWord  inDeviceMask 
)
explicit

Definition at line 95 of file ntv2devicescanner.cpp.

◆ CNTV2DeviceScanner() [3/3]

CNTV2DeviceScanner::CNTV2DeviceScanner ( const CNTV2DeviceScanner inDeviceScanner)
explicit

Constructs me from an existing CNTV2DeviceScanner instance.

Parameters
[in]inDeviceScannerSpecifies the CNTV2DeviceScanner instance to be copied.

Definition at line 114 of file ntv2devicescanner.cpp.

◆ ~CNTV2DeviceScanner()

virtual CNTV2DeviceScanner::~CNTV2DeviceScanner ( )
inlinevirtual

Definition at line 384 of file ntv2devicescanner.h.

Member Function Documentation

◆ CompareDeviceInfoLists()

bool CNTV2DeviceScanner::CompareDeviceInfoLists ( const NTV2DeviceInfoList inOldList,
const NTV2DeviceInfoList inNewList,
NTV2DeviceInfoList outDevicesAdded,
NTV2DeviceInfoList outDevicesRemoved 
)
static

Compares two NTV2DeviceInfoLists and returns a list of additions and a list of removals.

Parameters
[in]inOldListSpecifies the "old" list to be compared with a "newer" list.
[in]inNewListSpecifies the "new" list to be compared with the "older" list.
[out]outDevicesAddedReceives a list of devices that exist in the "new" list that don't exist in the "old" list.
[out]outDevicesRemovedReceives a list of devices that exist in the "old" list that don't exist in the "new" list.
Returns
True if the two lists differ in any way; otherwise false if they match.

Definition at line 394 of file ntv2devicescanner.cpp.

◆ DeviceIDPresent()

bool CNTV2DeviceScanner::DeviceIDPresent ( const NTV2DeviceID  inDeviceID,
const bool  inRescan = false 
)
virtual

Returns true if one or more AJA devices having the specified device identifier are attached and known to the host.

Returns
True if at least one AJA device having the specified device identifier is present on the host system; otherwise false.
Parameters
[in]inDeviceIDSpecifies the device identifier of interest.
[in]inRescanSpecifies if the host should be rescanned or not. Defaults to false.

Definition at line 207 of file ntv2devicescanner.cpp.

◆ GetDeviceAtIndex()

bool CNTV2DeviceScanner::GetDeviceAtIndex ( const ULWord  inDeviceIndexNumber,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the AJA device having the given zero-based index number.

Returns
True if successful; otherwise false.
Parameters
[in]inDeviceIndexNumberSpecifies the AJA device using a zero-based index number.
[out]outDeviceReceives the open, ready-to-use CNTV2Card instance.

Definition at line 237 of file ntv2devicescanner.cpp.

◆ GetDeviceInfo()

bool CNTV2DeviceScanner::GetDeviceInfo ( const ULWord  inDeviceIndexNumber,
NTV2DeviceInfo outDeviceInfo,
const bool  inRescan = false 
)
virtual

Returns detailed information about the AJA device having the given zero-based index number.

Returns
True if successful; otherwise false.
Parameters
[in]inDeviceIndexNumberSpecifies the AJA device to retrieve information about using a zero-based index number.
[out]outDeviceInfoSpecifies the NTV2DeviceInfo structure that will receive the device information.
[in]inRescanSpecifies if the host should be rescanned or not.

Definition at line 221 of file ntv2devicescanner.cpp.

◆ GetDeviceInfoList() [1/2]

virtual NTV2DeviceInfoList& CNTV2DeviceScanner::GetDeviceInfoList ( void  )
inlinevirtual

Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques.

Returns
A non-constant reference to my NTV2DeviceInfoList.

Definition at line 369 of file ntv2devicescanner.h.

◆ GetDeviceInfoList() [2/2]

virtual const NTV2DeviceInfoList& CNTV2DeviceScanner::GetDeviceInfoList ( void  ) const
inlinevirtual

Returns an NTV2DeviceInfoList that can be "walked" using standard C++ vector iteration techniques.

Returns
A constant reference to my NTV2DeviceInfoList.

Definition at line 375 of file ntv2devicescanner.h.

◆ GetDeviceRefName()

string CNTV2DeviceScanner::GetDeviceRefName ( CNTV2Card inDevice)
static
Parameters
[in]inDeviceThe CNTV2Card instance that's open for the device of interest.
Returns
A string containing the device name that will find the same given device using CNTV2DeviceScanner::GetFirstDeviceFromArgument.

Definition at line 455 of file ntv2devicescanner.cpp.

◆ GetDeviceWithSerial()

bool CNTV2DeviceScanner::GetDeviceWithSerial ( const uint64_t  inSerialNumber,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose serial number matches the given value.

Returns
True if successful; otherwise false.
Parameters
[in]inSerialNumberSpecifies the device serial value to search for.
[out]outDeviceReceives the open, ready-to-use CNTV2Card instance.

Definition at line 315 of file ntv2devicescanner.cpp.

◆ GetFirstDeviceFromArgument()

bool CNTV2DeviceScanner::GetFirstDeviceFromArgument ( const std::string &  inArgument,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the AJA device that matches a command line argument according to the following evaluation sequence:

  1. 1 or 2 digit unsigned decimal integer: a zero-based device index number;
    1. 8 or 9 character alphanumeric string: device with a matching serial number string (case-insensitive comparison);
    2. 3-16 character hexadecimal integer, optionally preceded by '0x': device having a matching 64-bit serial number;
    3. All other cases: first device (lowest index number) whose name contains the argument string (compared case-insensitively).
      Returns
      True if successful; otherwise false.
      Parameters
      [in]inArgumentThe argument string. If 'list' or '?', the std::cout stream is sent some "help text" showing a list of all available devices.
      [out]outDeviceReceives the open, ready-to-use CNTV2Card instance.

Definition at line 327 of file ntv2devicescanner.cpp.

◆ GetFirstDeviceWithID()

bool CNTV2DeviceScanner::GetFirstDeviceWithID ( const NTV2DeviceID  inDeviceID,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the first AJA device found on the host that has the given NTV2DeviceID.

Returns
True if successful; otherwise false.
Parameters
[in]inDeviceIDSpecifies the device identifier of interest.
[out]outDeviceReceives the open, ready-to-use CNTV2Card instance.

Definition at line 246 of file ntv2devicescanner.cpp.

◆ GetFirstDeviceWithName()

bool CNTV2DeviceScanner::GetFirstDeviceWithName ( const std::string &  inNameSubString,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose device identifier name contains the given substring.

Note
The name is compared case-insensitively (e.g., "iO4K" == "Io4k").
Returns
True if successful; otherwise false.
Parameters
[in]inNameSubStringSpecifies a portion of the device name to search for.
[out]outDeviceReceives the open, ready-to-use CNTV2Card instance.

Definition at line 259 of file ntv2devicescanner.cpp.

◆ GetFirstDeviceWithSerial()

bool CNTV2DeviceScanner::GetFirstDeviceWithSerial ( const std::string &  inSerialStr,
CNTV2Card outDevice 
)
static

Rescans the host, and returns an open CNTV2Card instance for the first AJA device whose serial number contains the given value.

Note
The serial value is compared case-sensitively.
Returns
True if successful; otherwise false.
Parameters
[in]inSerialStrSpecifies the device serial value to search for.
[out]outDeviceReceives the open, ready-to-use CNTV2Card instance of the first matching device.

Definition at line 294 of file ntv2devicescanner.cpp.

◆ GetNumDevices()

virtual size_t CNTV2DeviceScanner::GetNumDevices ( void  ) const
inlinevirtual

Returns the number of AJA devices found on the local host.

Returns
Number of AJA devices found on the local host.

Definition at line 346 of file ntv2devicescanner.h.

◆ IsAlphaNumeric() [1/2]

bool CNTV2DeviceScanner::IsAlphaNumeric ( const char  inStr)
static

Definition at line 39 of file ntv2devicescanner.cpp.

◆ IsAlphaNumeric() [2/2]

static bool CNTV2DeviceScanner::IsAlphaNumeric ( const std::string &  inStr)
static
Returns
True if the string contains letters and/or decimal digits.
Parameters
[in]inStrThe string to be tested.

◆ IsDecimalDigit()

bool CNTV2DeviceScanner::IsDecimalDigit ( const char  inChr)
static

Definition at line 34 of file ntv2devicescanner.cpp.

◆ IsHexDigit()

bool CNTV2DeviceScanner::IsHexDigit ( const char  inChr)
static

Definition at line 29 of file ntv2devicescanner.cpp.

◆ IsLegalDecimalNumber()

bool CNTV2DeviceScanner::IsLegalDecimalNumber ( const std::string &  inStr,
const size_t  inMaxLength = 2 
)
static
Returns
True if the string contains a legal decimal number.
Parameters
[in]inStrThe string to be tested.

Definition at line 44 of file ntv2devicescanner.cpp.

◆ IsLegalHexSerialNumber()

uint64_t CNTV2DeviceScanner::IsLegalHexSerialNumber ( const std::string &  inStr)
static

Definition at line 54 of file ntv2devicescanner.cpp.

◆ IsLegalSerialNumber()

bool CNTV2DeviceScanner::IsLegalSerialNumber ( const std::string &  inStr)
static
Returns
True if the string contains a legal serial number.
Parameters
[in]inStrThe string to be tested.

Definition at line 82 of file ntv2devicescanner.cpp.

◆ operator=()

CNTV2DeviceScanner & CNTV2DeviceScanner::operator= ( const CNTV2DeviceScanner inDeviceScanner)
virtual

Assigns an existing CNTV2DeviceScanner instance to me.

Parameters
[in]inDeviceScannerSpecifies the CNTV2DeviceScanner instance to be copied.

Definition at line 103 of file ntv2devicescanner.cpp.

◆ ScanHardware() [1/2]

void CNTV2DeviceScanner::ScanHardware ( UWord  inDeviceMask)
virtual

Definition at line 164 of file ntv2devicescanner.cpp.

◆ ScanHardware() [2/2]

void CNTV2DeviceScanner::ScanHardware ( void  )
virtual

Re-scans the local host for connected AJA devices.

Definition at line 168 of file ntv2devicescanner.cpp.

◆ SortDeviceInfoList()

void CNTV2DeviceScanner::SortDeviceInfoList ( void  )
virtual

Sorts my device list by ascending PCI slot number.

Definition at line 733 of file ntv2devicescanner.cpp.


The documentation for this class was generated from the following files: