OpenNI 1.5.7
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:

CapabilityCapability NameCapability InterfaceGet Interface Method
Extended SerializationXN_CAPABILITY_EXTENDED_SERIALIZATIONxn::ModuleExtendedSerializationInterfacexn::ModuleProductionNode::GetExtendedSerializationInterface
Lock AwareXN_CAPABILITY_LOCK_AWARExn::ModuleLockAwareInterfacexn::ModuleProductionNode::GetLockAwareInterface
Error StateXN_CAPABILITY_ERROR_STATExn::ModuleErrorStateInterfacexn::ModuleProductionNode::GetErrorStateInterface
BrightnessXN_CAPABILITY_BRIGHTNESSxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
ContrastXN_CAPABILITY_CONTRASTxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
HueXN_CAPABILITY_HUExn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
SaturationXN_CAPABILITY_SATURATIONxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
SharpnessXN_CAPABILITY_SHARPNESSxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
GammaXN_CAPABILITY_GAMMAxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
Color TemperatureXN_CAPABILITY_COLOR_TEMPERATURExn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
Backlight CompensationXN_CAPABILITY_BACKLIGHT_COMPENSATIONxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
GainXN_CAPABILITY_GAINxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
PanXN_CAPABILITY_PANxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
TiltXN_CAPABILITY_TILTxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
RollXN_CAPABILITY_ROLLxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
ZoomXN_CAPABILITY_ZOOMxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
ExposureXN_CAPABILITY_EXPOSURExn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
IrisXN_CAPABILITY_IRISxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
FocusXN_CAPABILITY_FOCUSxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
Lowlight CompensationXN_CAPABILITY_LOW_LIGHT_COMPENSATIONxn::ModuleGeneralIntInterfacexn::ModuleProductionNode::GetGeneralIntInterface
Device IdentificationXN_CAPABILITY_DEVICE_IDENTIFICATIONxn::ModuleDeviceIdentificationInterfacexn::ModuleDevice::GetIdentificationInterface
Alternative ViewpointXN_CAPABILITY_ALTERNATIVE_VIEW_POINTxn::ModuleAlternativeViewPointInterfacexn::ModuleGenerator::GetAlternativeViewPointInterface
Frame SyncXN_CAPABILITY_FRAME_SYNCxn::ModuleFrameSyncInterfacexn::ModuleGenerator::GetFrameSyncInterface
MirrorXN_CAPABILITY_MIRRORxn::ModuleMirrorInterfacexn::ModuleGenerator::GetMirrorInterface
CroppingXN_CAPABILITY_CROPPINGxn::ModuleCroppingInterfacexn::ModuleMapGenerator::GetCroppingInterface
Anti FlickerXN_CAPABILITY_ANTI_FLICKERxn::ModuleAntiFlickerInterfacexn::ModuleMapGenerator::GetAntiFlickerInterface
User PositionXN_CAPABILITY_USER_POSITIONxn::ModuleUserPositionInterfacexn::ModuleDepthGenerator::GetUserPositionInterface
Hand Touching Field-of-ViewXN_CAPABILITY_HAND_TOUCHING_FOV_EDGExn::ModuleHandTouchingFOVEdgeInterfacexn::ModuleHandsGenerator::GetHandTouchingFOVEdgeInterface
SkeletonXN_CAPABILITY_SKELETONxn::ModuleSkeletonInterfacexn::ModuleUserGenerator::GetSkeletonInterface
Pose DetectionXN_CAPABILITY_POSE_DETECTIONxn::ModulePoseDetectionIntefacexn::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 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;
};
#define XN_CAPABILITY_ERROR_STATE
Definition XnTypes.h:323
#define XN_CAPABILITY_MIRROR
Definition XnTypes.h:316
Definition XnModuleCppInterface.h:132
virtual ModuleMirrorInterface * GetMirrorInterface()
Definition XnModuleCppInterface.h:254
Definition XnModuleCppInterface.h:452
Definition XnModuleCppInterface.h:201
virtual ModuleErrorStateInterface * GetErrorStateInterface()
Definition XnModuleCppInterface.h:172
virtual XnBool IsCapabilitySupported(const XnChar *)
Definition XnModuleCppInterface.h:161