Support Capabilities

If you want your new node implementation to support any capabilities, it should both declare that and implement their interfaces.

Declaring the node implementation supported capabilities is done by implementing the IsCapabilitySupported() method. This method only declares if a certain capability is supported or not.

The actual implementation of the capability is done by implementing this capability interface. This implementation can be done in a different class, or in your node implementation class. In any case, your node implementation must implement the proper 'get' mechanism for this interface.

The following table summarizes all capabilities:

Capability | Capability Name | Capability Interface | Get Interface Method
--- | --- | --- | ---
Extended Serialization | XN_CAPABILITY_EXTENDED_SERIALIZATION | xn::ModuleExtendedSerializationInterface | xn::ModuleProductionNode::GetExtendedSerializationInterface
Lock Aware | XN_CAPABILITY_LOCK_AWARE | xn::ModuleLockAwareInterface | xn::ModuleProductionNode::GetLockAwareInterface
Error State | XN_CAPABILITY_ERROR_STATE | xn::ModuleErrorStateInterface | xn::ModuleProductionNode::GetErrorStateInterface
Brightness | XN_CAPABILITY_BRIGHTNESS | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Contrast | XN_CAPABILITY_CONTRAST | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Hue | XN_CAPABILITY_HUE | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Saturation | XN_CAPABILITY_SATURATION | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Sharpness | XN_CAPABILITY_SHARPNESS | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Gamma | XN_CAPABILITY_GAMMA | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Color Temperature | XN_CAPABILITY_COLOR_TEMPERATURE | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Backlight Compensation | XN_CAPABILITY_BACKLIGHT_COMPENSATION | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Gain | XN_CAPABILITY_GAIN | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Pan | XN_CAPABILITY_PAN | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Tilt | XN_CAPABILITY_TILT | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Roll | XN_CAPABILITY_ROLL | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Zoom | XN_CAPABILITY_ZOOM | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Exposure | XN_CAPABILITY_EXPOSURE | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Iris | XN_CAPABILITY_IRIS | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Focus | XN_CAPABILITY_FOCUS | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Lowlight Compensation | XN_CAPABILITY_LOW_LIGHT_COMPENSATION | xn::ModuleGeneralIntInterface | xn::ModuleProductionNode::GetGeneralIntInterface
Device Identification | XN_CAPABILITY_DEVICE_IDENTIFICATION | xn::ModuleDeviceIdentificationInterface | xn::ModuleDevice::GetIdentificationInterface
Alternative Viewpoint | XN_CAPABILITY_ALTERNATIVE_VIEW_POINT | xn::ModuleAlternativeViewPointInterface | xn::ModuleGenerator::GetAlternativeViewPointInterface
Frame Sync | XN_CAPABILITY_FRAME_SYNC | xn::ModuleFrameSyncInterface | xn::ModuleGenerator::GetFrameSyncInterface
Mirror | XN_CAPABILITY_MIRROR | xn::ModuleMirrorInterface | xn::ModuleGenerator::GetMirrorInterface
Cropping | XN_CAPABILITY_CROPPING | xn::ModuleCroppingInterface | xn::ModuleMapGenerator::GetCroppingInterface
Anti Flicker | XN_CAPABILITY_ANTI_FLICKER | xn::ModuleAntiFlickerInterface | xn::ModuleMapGenerator::GetAntiFlickerInterface
User Position | XN_CAPABILITY_USER_POSITION | xn::ModuleUserPositionInterface | xn::ModuleDepthGenerator::GetUserPositionInterface
Hand Touching Field-of-View | XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE | xn::ModuleHandTouchingFOVEdgeInterface | xn::ModuleHandsGenerator::GetHandTouchingFOVEdgeInterface
Skeleton | XN_CAPABILITY_SKELETON | xn::ModuleSkeletonInterface | xn::ModuleUserGenerator::GetSkeletonInterface
Pose Detection | XN_CAPABILITY_POSE_DETECTION | xn::ModulePoseDetectionInteface | xn::ModuleUserGenerator::GetPoseDetectionInteface

For example, let's say your hands generator supports the mirror capability as well as the error state capability. The HandsGenerator can implement the error state capability in the same class and the mirror capability in a different class.

Thus, in the class implementation below, the `GetErrorStateInterface()` method returns `this`, since the 'Error State Interface' is also implemented by this class. On the other hand, the `GetMirrorInterface()` method has to return a reference to `m_mirrorCap`, which is an instance of the helper class, `MyHandsGeneratorMirror`.

class MyHandsGeneratorMirror : public virtual xn::ModuleMirrorInterface
{
...
};
class MyHandGenerator:
public virtual xn::ModuleHandsGenerator,
public virtual xn::ModuleErrorStateInterface
{
public:
...
virtual XnBool IsCapabilitySupported(const XnChar* strCapabilityName)
{
return (
strcmp(strCapabilityName, XN_CAPABILITY_MIRROR) == 0 ||
strcmp(strCapabilityName, XN_CAPABILITY_ERROR_STATE) == 0
);
}
...
virtual ModuleErrorStateInterface* GetErrorStateInterface() { return this; }
...
virtual ModuleMirrorInterface* GetMirrorInterface() { return &m_mirrorCap; }
private:
MyHandsGeneratorMirror m_mirrorCap;
};
XN_CAPABILITY_ERROR_STATE
#define XN_CAPABILITY_ERROR_STATE
Definition XnTypes.h:321
XN_CAPABILITY_MIRROR
#define XN_CAPABILITY_MIRROR
Definition XnTypes.h:314
xn::ModuleErrorStateInterface
Definition XnModuleCppInterface.h:133
xn::ModuleGenerator::GetMirrorInterface
virtual ModuleMirrorInterface * GetMirrorInterface()
Definition XnModuleCppInterface.h:254
xn::ModuleHandsGenerator
Definition XnModuleCppInterface.h:452
xn::ModuleMirrorInterface
Definition XnModuleCppInterface.h:202
xn::ModuleProductionNode::GetErrorStateInterface
virtual ModuleErrorStateInterface * GetErrorStateInterface()
Definition XnModuleCppInterface.h:173
xn::ModuleProductionNode::IsCapabilitySupported
virtual XnBool IsCapabilitySupported(const XnChar *)
Definition XnModuleCppInterface.h:162