nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | Static Public Member Functions | List of all members
rpi_cam::DiscoveryManager Class Reference
Inheritance diagram for rpi_cam::DiscoveryManager:

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

## Static Public Member Functions
static nxpt::CommonRefManager * | refManager ()

## Additional Inherited Members
Protected Member Functions inherited from rpi_cam::DefaultRefCounter< nxcip::CameraDiscoveryManager >
| DefaultRefCounter (nxpt::CommonRefManager *refManager)
Protected Attributes inherited from rpi_cam::DefaultRefCounter< nxcip::CameraDiscoveryManager >
nxpt::CommonRefManager | m_refManager

## Member Function Documentation

## ◆ checkHostAddress()

int DiscoveryManager::checkHostAddress | ( | nxcip::CameraInfo * | cameras,
|  | const char * | address,
|  | const char * | login,
|  | const char * | password
| ) |  |
| override 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

Implements nxcip::CameraDiscoveryManager.

## ◆ createCameraManager()

nxcip::BaseCameraManager * DiscoveryManager::createCameraManager | ( | const nxcip::CameraInfo & | info | ) |
| override 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)

Implements nxcip::CameraDiscoveryManager.

## ◆ findCameras()

int DiscoveryManager::findCameras | ( | nxcip::CameraInfo * | cameras,
|  | const char * | serverURL
| ) |  |
| override 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

Implements nxcip::CameraDiscoveryManager.

## ◆ fromMDNSData()

int DiscoveryManager::fromMDNSData | ( | const char * | discoveryAddress,
|  | const unsigned char * | mdnsResponsePacket,
|  | int | mdnsResponsePacketSize,
|  | nxcip::CameraInfo * | cameraInfo
| ) |  |
| override 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

Implements nxcip::CameraDiscoveryManager.

## ◆ fromUpnpData()

int DiscoveryManager::fromUpnpData | ( | const char * | upnpXMLData,
|  | int | upnpXMLDataSize,
|  | nxcip::CameraInfo * | cameraInfo
| ) |  |
| override 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

Implements nxcip::CameraDiscoveryManager.

## ◆ getReservedModelList()

int DiscoveryManager::getReservedModelList | ( | char ** | modelList,
|  | int * | count
| ) |  |
| override 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

Implements nxcip::CameraDiscoveryManager.

## ◆ getVendorName()

void DiscoveryManager::getVendorName | ( | char * | buf | ) | const
| override virtual

Returns utf-8 camera vendor name.

Parameters

  [out] | buf | Buffer of MAX_TEXT_LEN size

Implements nxcip::CameraDiscoveryManager.

## ◆ queryInterface()

void * DiscoveryManager::queryInterface | ( | const nxpl::NX_GUID & | interfaceID | ) |
| override virtual

Cast to type, specified by interfaceID.

If pointer cannot be cast, NULL MUST be returned

Returns
  If not NULL, returned pointer can be safely cast to type, defined by interfaceID

Note
  This method increments reference counter

Implements nxpl::PluginInterface.

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

- samples/device/rpi_camera_plugin/src/discovery_manager.h
- samples/device/rpi_camera_plugin/src/discovery_manager.cpp