OpenNI 1.5.2
Support Capabilities

If our new node implementation supports any capabilities, it should both declare that and implement their interfaces.

Declaring the node implementation supported capabilities is done by implementing the xn::ModuleProductionNode::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 our node implementation class. In any case, our node implementation must implement the propert get method 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 our hands generator supports the mirror capability as well as the error state capability. It implements error state in the same class and mirror in another one.

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;
};