nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | List of all members
nxcip::CameraDiscoveryManager Class Referenceabstract

This interface is used to find cameras and create BaseCameraManager instance. More...

`#include <camera_plugin.h>`

Inheritance diagram for nxcip::CameraDiscoveryManager:

## Public Member Functions
virtual void | getVendorName (char *buf) const =0
| Returns utf-8 camera vendor name. More...
virtual int | findCameras (CameraInfo *cameras, const char *serverURL)=0
| Vendor-specific camera search method. Returns list of found cameras. More...
virtual int | checkHostAddress (CameraInfo *cameras, const char *address, const char *login, const char *password)=0
| Check host for camera presence. More...
virtual int | fromMDNSData (const char *discoveryAddress, const unsigned char *mdnsResponsePacket, int mdnsResponsePacketSize, CameraInfo *cameraInfo)=0
| MDNS camera search method. More...
virtual int | fromUpnpData (const char *upnpXMLData, int upnpXMLDataSize, CameraInfo *cameraInfo)=0
| UPNP camera search method. More...
virtual BaseCameraManager * | createCameraManager (const CameraInfo &info)=0
| Instantiates camera manager instance based on info. More...
virtual int | getReservedModelList (char **modelList, int *count)=0
| Get model names, reserved by the plugin. More...
Public Member Functions inherited from nxpl::PluginInterface
virtual void * | queryInterface (const nxpl::NX_GUID &interfaceID)=0
| Cast to type, specified by interfaceID. More...
virtual int | addRef () const =0
| Increment reference counter. More...
virtual int | releaseRef () const =0
| Decrement reference counter. More...

## Detailed Description

This interface is used to find cameras and create BaseCameraManager instance.

Mediaserver has built-in UPNP & MDNS support, plugin needs only implement nxcip::CameraDiscoveryManager::fromUpnpData or nxcip::CameraDiscoveryManager::fromMDNSData method. If camera do support neither UPNP nor MDNS, plugin can provide its own search method by implementing nxcip::CameraDiscoveryManager::findCameras

In case camera is supported by multiple plugins, plugin to use is selected under following rules:

- each received MDNS and UPNP response packet is first processed by plugins, then by built-in drivers. Plugins are iterated in vendor name (nxcip::CameraDiscoveryManager::getVendorName) ascending order
- it is undefined when CameraDiscoveryManager::findCameras is called (with regard to mdns and upnp search)
- plugin can reserve model name(s) by implementing nxcip::CameraDiscoveryManager::getReservedModelList so that built-in drivers do not process cameras with that name

Note
  Camera search methods MUST NOT take in account result of previously done searches

## Member Function Documentation

## ◆ checkHostAddress()

virtual int nxcip::CameraDiscoveryManager::checkHostAddress | ( | CameraInfo * | cameras,
|  | const char * | address,
|  | const char * | login,
|  | const char * | password
| ) |  |
| pure virtual

Check host for camera presence.

Plugin should investigate address for supported camera presence and fill cameras array with found camera(s) information This method is used to add camera with known ip (e.g., if multicast is disabled in network)

Parameters

  [out] | cameras | Array of size CAMERA_INFO_ARRAY_SIZE
  [in] | address | String "host:port", port is optional
  [in] | login | Login to access address. If NULL, default login should be used
  [in] | password | Password to access address. If NULL, default password should be used

Returns
  > 0 - number of found cameras, < 0 - on error. 0 - nothing found

Note
  This method MUST fill CameraInfo::url with value of address

Implemented in AxisCameraDiscoveryManager, rpi_cam::DiscoveryManager, and DiscoveryManager.

## ◆ createCameraManager()

virtual BaseCameraManager* nxcip::CameraDiscoveryManager::createCameraManager | ( | const CameraInfo & | info | ) |
| pure virtual

Instantiates camera manager instance based on info.

Note
  This method MUST be thread-safe (can be called by multiple threads using same interface pointer)

Implemented in AxisCameraDiscoveryManager, DiscoveryManager, and rpi_cam::DiscoveryManager.

## ◆ findCameras()

virtual int nxcip::CameraDiscoveryManager::findCameras | ( | CameraInfo * | cameras,
|  | const char * | serverURL
| ) |  |
| pure virtual

Vendor-specific camera search method. Returns list of found cameras.

It is recommended that this method works in asynchronous mode (only returning list of already found cameras). This method is called periodically.

Parameters

  [out] | cameras | Array of size CAMERA_INFO_ARRAY_SIZE. Implementation fills this array with found camera(s) information
  [in] | serverURL | Server URL. If camera do not have own URL it should use this one

Returns
  > 0 - number of found cameras, < 0 - on error. 0 - nothing found

Implemented in AxisCameraDiscoveryManager, rpi_cam::DiscoveryManager, and DiscoveryManager.

## ◆ fromMDNSData()

virtual int nxcip::CameraDiscoveryManager::fromMDNSData | ( | const char * | discoveryAddress,
|  | const unsigned char * | mdnsResponsePacket,
|  | int | mdnsResponsePacketSize,
|  | CameraInfo * | cameraInfo
| ) |  |
| pure virtual

MDNS camera search method.

Mediaserver calls this method when it has found unknown MDNS host.

If non-zero value is returned, cameraInfo MUST be filled by this method (it will be used later in call to nxcip::CameraDiscoveryManager::createCameraManager).

Parameters

  [in] | discoveryAddress | Source address of mdnsResponsePacket (for ipv4 it is ip-address)
  [in] | mdnsResponsePacket | Received MDNS packet
  [in] | mdnsResponsePacketSize | Size of mdnsResponsePacket in bytes
  [out] | cameraInfo | If MDNS host is recognized, this structure is filled with camera parameters

Returns
  non zero, if MDNS data is recognized, 0 otherwise

Implemented in AxisCameraDiscoveryManager, DiscoveryManager, and rpi_cam::DiscoveryManager.

## ◆ fromUpnpData()

virtual int nxcip::CameraDiscoveryManager::fromUpnpData | ( | const char * | upnpXMLData,
|  | int | upnpXMLDataSize,
|  | CameraInfo * | cameraInfo
| ) |  |
| pure virtual

UPNP camera search method.

Mediaserver calls this method when it has found unknown UPNP device.

If non-zero value is returned, cameraInfo MUST be filled by this method (it will be used later in call to nxcip::CameraDiscoveryManager::createCameraManager).

Parameters

  [in] | upnpXMLData | Contains upnp data as specified in [UPnP Device Architecture 1.1, section 2.3]
  [in] | upnpXMLDataSize | Size of upnpXMLData in bytes
  [out] | cameraInfo | If upnp host is recognized, this structure is filled with camera data

Returns
  non zero, if upnp data is recognized and cameraInfo is filled with data, 0 otherwise

Implemented in AxisCameraDiscoveryManager, DiscoveryManager, and rpi_cam::DiscoveryManager.

## ◆ getReservedModelList()

virtual int nxcip::CameraDiscoveryManager::getReservedModelList | ( | char ** | modelList,
|  | int * | count
| ) |  |
| pure virtual

Get model names, reserved by the plugin.

For example, let camera support ONVIF, and plugin uses native API. In this case, plugin MUST implement this function and reserve model name, provided by onvif implementation. Also, CameraDiscoveryManager::getVendorName MUST be same as ONVIF vendor name

Parameters

  [out] | modelList | Array of char* buffers of size MAX_MODEL_NAME_SIZE where camera model names will be written. May be NULL.
  [in,out] | count | A pointer to a variable that specifies the size of array pointed to by the modelList parameter. When the function returns, this variable contains the number of model names copied to modelList. If the buffer specified by modelList parameter is not large enough to hold the data, the function returns NX_MORE_DATA and stores the required buffer size in the variable pointed to by count. In this case, the contents of the modelList array are undefined.

Returns
  NX_MORE_DATA if input buffer size is not sufficient

Implemented in DiscoveryManager, AxisCameraDiscoveryManager, and rpi_cam::DiscoveryManager.

## ◆ getVendorName()

virtual void nxcip::CameraDiscoveryManager::getVendorName | ( | char * | buf | ) | const
| pure virtual

Returns utf-8 camera vendor name.

Parameters

  [out] | buf | Buffer of MAX_TEXT_LEN size

Implemented in AxisCameraDiscoveryManager, rpi_cam::DiscoveryManager, and DiscoveryManager.

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

- src/camera/camera_plugin.h