DLAPI 4.5.1.0
An API for controlling Aluma branded cameras
dl::V3::ICamera Class Referenceabstract

dl::V3::ICamera More...

#include <dlapi.h>

Public Member Functions

virtual IEndpointPtr getEndpoint ()=0
 getEndpoint()
 

Detailed Description

dl::V3::ICamera

Added support for direct querying of unique Endpoint descriptors.

Member Function Documentation

◆ getEndpoint()

virtual IEndpointPtr dl::V3::ICamera::getEndpoint ( )
pure virtual

getEndpoint()

Returns
a pointer to an IEndpoint interface for querying the camera's endpoint descriptors.

This function returns a pointer to an IEndpoint interface that you can use to query unique endpoint identifiers if you want to connect directly to a camera without querying. This is particularly useful for network cameras, where the endpoint identifier contains the IP address of the camera, and can be used to connect directly to the camera without broadcasting on an open network.

To use this function, call it on an initialized camera instance to retrieve a pointer to the camera's endpoint manager. Then cast the pointer to the appropriate implementation interface (USB or Network), and use that to collect information:

void getCameraNetEndpoints(dl::ICameraPtr pCamera, std::string& camIP, std::string& nicIP)
{
// Cast your existing ICamera instance to the new V3 Camera interface
auto pCameraV3 = dynamic_cast<dl::V3::ICamera*>(pCamera);
// Ensure your driver version supports this interface
if (!pCameraV3) throw std::runtime_error("Your version of DLAPI does not support the V3 Camera interface");
// Check and see whether the endpoint type matches our expectation:
auto pEndpoint = pCameraV3->getEndpoint();
if (!pEndpoint) throw std::runtime_error("Failed to retrieve camera endpoint");
if (pEndpoint->getType() != EEndpointType::Net) throw std::runtime_error("Your camera is not a Network camera");
// Cast the endpoint to the appropriate type (in this case, we expect a network camera, so we cast to INetEndpointPtr)
auto pNetEndpoint = dynamic_cast<INetEndpointPtr>(pEndpoint);
if (!pNetEndpoint) throw std::runtime_error("Your camera is not a Network camera");
// Return the camera's IP address
camIP = pNetEndpoint->getIp();
// Return the host's IP address (whichever NIC the camera is connected through--required for binding if you have two NICs on the same subnet)
nicIP = pNetEndpoint->getNICIP();
}
Camera interface class.
Definition dlapi.h:1958
Abstract interface for a UDP/IP camera connection endpoint.
Definition dlapi.h:421
dl::V3::ICamera
Definition dlapi.h:2417
@ Net
A UDP over Ethernet/WiFi endpoint.
Definition dlapi.h:180

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