forked from OpenNI/OpenNI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
XnModuleInterface.h
1362 lines (1176 loc) · 62.2 KB
/
XnModuleInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************
* *
* OpenNI 1.x Alpha *
* Copyright (C) 2012 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*****************************************************************************/
#ifndef __XN_MODULE_INTERFACE_H__
#define __XN_MODULE_INTERFACE_H__
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnTypes.h>
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define XN_MODULE_LOAD xnModuleLoad
#define XN_MODULE_UNLOAD xnModuleUnload
#define XN_MODULE_GET_EXPORTED_NODES_COUNT xnModuleGetExportedNodesCount
#define XN_MODULE_GET_EXPORTED_NODES_ENTRY_POINTS xnModuleGetExportedNodesEntryPoints
#define XN_MODULE_GET_OPEN_NI_VERSION xnModuleGetOpenNIVersion
//---------------------------------------------------------------------------
// Forward Declarations
//---------------------------------------------------------------------------
struct XnModuleProductionNodeInterface;
struct XnModuleDeviceInterface;
struct XnModuleDepthGeneratorInterface;
struct XnModuleImageGeneratorInterface;
struct XnModuleIRGeneratorInterface;
struct XnModuleGestureGeneratorInterface;
struct XnModuleUserGeneratorInterface;
struct XnModuleHandsGeneratorInterface;
struct XnModuleSceneAnalyzerInterface;
struct XnModuleAudioGeneratorInterface;
struct XnModuleRecorderInterface;
struct XnModulePlayerInterface;
struct XnModuleGeneratorInterface;
struct XnModuleCodecInterface;
struct XnModuleScriptNodeInterface;
struct XnModuleMapGeneratorInterface;
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
typedef void (XN_CALLBACK_TYPE* XnModuleGetExportedInterfacePtr)(XnModuleExportedProductionNodeInterface* pInterface);
typedef XnStatus (XN_C_DECL* XnModuleLoadPtr)();
typedef void (XN_C_DECL* XnModuleUnloadPtr)();
typedef XnUInt32 (XN_C_DECL* XnModuleGetExportedNodesCountPtr)();
typedef XnStatus (XN_C_DECL* XnModuleGetExportedNodesEntryPointsPtr)(XnModuleGetExportedInterfacePtr* aEntryPoints, XnUInt32 nCount);
typedef void (XN_C_DECL* XnModuleGetOpenNIVersionPtr)(XnVersion* pVersion);
typedef struct XnOpenNIModuleInterface
{
XnModuleLoadPtr pLoadFunc;
XnModuleUnloadPtr pUnloadFunc;
XnModuleGetExportedNodesCountPtr pGetCountFunc;
XnModuleGetExportedNodesEntryPointsPtr pGetEntryPointsFunc;
XnModuleGetOpenNIVersionPtr pGetVersionFunc;
} XnOpenNIModuleInterface;
/** Prototype for state change callback function. **/
typedef void (XN_CALLBACK_TYPE* XnModuleStateChangedHandler)(void* pCookie);
// User
typedef void (XN_CALLBACK_TYPE* XnModuleUserHandler)(XnUserID user, void* pCookie);
// Hand touching FOV edge
typedef void (XN_CALLBACK_TYPE* XnModuleHandTouchingFOVEdge)(XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie);
// UI
typedef void (XN_CALLBACK_TYPE* XnModuleHandCreate)(XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleHandUpdate)(XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleHandDestroy)(XnUserID user, XnFloat fTime, void* pCookie);
// Gesture Module
typedef void (XN_CALLBACK_TYPE* XnModuleGestureRecognized)(const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleGestureProgress)(const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleGestureIntermediateStageCompleted)(const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleGestureReadyForNextIntermediateStage)(const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
// Skeleton
typedef void (XN_CALLBACK_TYPE* XnModuleCalibrationStart)(XnUserID user, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleCalibrationEnd)(XnUserID user, XnBool bSuccess, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleCalibrationInProgress)(XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModuleCalibrationComplete)(XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
// Pose Detection
typedef void (XN_CALLBACK_TYPE* XnModulePoseDetectionCallback)(const XnChar* strPose, XnUserID user, void* pCookie);
typedef void (XN_CALLBACK_TYPE* XnModulePoseDetectionInProgressCallback)(const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseError, void* pCookie);
typedef struct XnModuleExportedProductionNodeInterface
{
/**
* Gets a description of this generator.
*
* @param pDescription [in/out] A struct to be filled with the description.
*/
void (XN_CALLBACK_TYPE* GetDescription)
(XnProductionNodeDescription* pDescription);
/**
* Find all tree possibilities for this production node.
*
* @param pContext [in] Current OpenNI context
* @param pNodesList [in] A list to be filled with production trees.
* @param pErrors [in] Optional. An enumeration errors object to be passed to enumeration functions.
*/
XnStatus (XN_CALLBACK_TYPE* EnumerateProductionTrees)
(XnContext* pContext,
XnNodeInfoList* pNodesList,
XnEnumerationErrors* pErrors);
/**
* Creates an instance of this generator.
*
* @param pContext [in] Current OpenNI context
* @param strInstanceName [in] The name of this new instance.
* @param strCreationInfo [in] Optional creation info (returned from enumeration).
* @param pNeededNodes [in] A list of inputs for this generator.
* @param strConfigurationDir [in] The module configuration dir, or NULL if it doesn't have one.
* @param phInstance [out] A handle to the created instance.
*/
XnStatus (XN_CALLBACK_TYPE* Create)
(XnContext* pContext,
const XnChar* strInstanceName,
const XnChar* strCreationInfo,
XnNodeInfoList* pNeededNodes,
const XnChar* strConfigurationDir,
XnModuleNodeHandle* phInstance);
/**
* Destroys an instance previously created using Create().
*
* @param hGenerator [in] A handle to the instance to be destroyed.
*/
void (XN_CALLBACK_TYPE* Destroy)
(XnModuleNodeHandle hInstance);
/**
* Fills a struct with the entire interface exported. The type of the struct passed
* to this function is determined according to the type this production node declares itself.
* For example, a depth generator will be passed a pointer to a XnModuleDepthGeneratorInterface struct.
*
* @param pInterface [in/out] A pointer to a struct to be filled.
*/
union
{
void (XN_CALLBACK_TYPE* ProductionNode)(struct XnModuleProductionNodeInterface* pInterface);
void (XN_CALLBACK_TYPE* Device)(struct XnModuleDeviceInterface* pInterface);
void (XN_CALLBACK_TYPE* Generator)(struct XnModuleGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* MapGenerator)(struct XnModuleMapGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* Depth)(struct XnModuleDepthGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* Image)(struct XnModuleImageGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* IR)(struct XnModuleIRGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* User)(struct XnModuleUserGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* Hands)(struct XnModuleHandsGeneratorInterface* pInterace);
void (XN_CALLBACK_TYPE* Gesture)(struct XnModuleGestureGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* Scene)(struct XnModuleSceneAnalyzerInterface* pInterface);
void (XN_CALLBACK_TYPE* Audio)(struct XnModuleAudioGeneratorInterface* pInterface);
void (XN_CALLBACK_TYPE* Recorder)(struct XnModuleRecorderInterface* pInterface);
void (XN_CALLBACK_TYPE* Player)(struct XnModulePlayerInterface* pInterface);
void (XN_CALLBACK_TYPE* Codec)(struct XnModuleCodecInterface* pInterface);
void (XN_CALLBACK_TYPE* Script)(struct XnModuleScriptNodeInterface* pInterface);
void (XN_CALLBACK_TYPE* General)(void* pInterface);
} GetInterface;
} XnModuleExportedProductionNodeInterface;
typedef struct XnModuleExtendedSerializationInterface
{
XnStatus (XN_CALLBACK_TYPE* InitNotifications)(XnModuleNodeHandle hInstance, XnNodeNotifications* pNotifications, void* pCookie);
void (XN_CALLBACK_TYPE* StopNotifications)(XnModuleNodeHandle hInstance);
} XnModuleExtendedSerializationInterface;
typedef struct XnModuleLockAwareInterface
{
/**
* Notifies the node its lock state was changed.
*
* @param hInstance [in] A handle to the instance.
* @param bLocked [in] Current lock state.
*/
XnStatus (XN_CALLBACK_TYPE* SetLockState)(XnModuleNodeHandle hInstance, XnBool bLocked);
/**
* Gets current lock state.
*
* @param hInstance [in] A handle to the instance.
*/
XnBool (XN_CALLBACK_TYPE* GetLockState)(XnModuleNodeHandle hInstance);
/**
* Registers a callback function to lock changes.
*
* @param hInstance [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when lock changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromLockChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToLockChange)
(XnModuleNodeHandle hInstance, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToLockChange().
*
* @param hInstance [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToLockChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromLockChange)
(XnModuleNodeHandle hInstance, XnCallbackHandle hCallback);
} XnModuleLockAwareInterface;
typedef struct XnModuleErrorStateInterface
{
/**
* Gets current error state of this node.
*
* @param hInstance [in] A handle to the instance.
*/
XnStatus (XN_CALLBACK_TYPE* GetErrorState)(XnModuleNodeHandle hInstance);
/**
* Registers a callback function to error state changes.
*
* @param hInstance [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when lock changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromErrorStateChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToErrorStateChange)
(XnModuleNodeHandle hInstance, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToErrorStateChange().
*
* @param hInstance [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToErrorStateChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromErrorStateChange)
(XnModuleNodeHandle hInstance, XnCallbackHandle hCallback);
} XnModuleErrorStateInterface;
typedef struct XnModuleGeneralIntInterface
{
/**
* Gets the range of this capability values
*
* @param hGenerator [in] A handle to the instance
* @param strCap [in] Name of the capability
* @param pnMin [out] Minimum value
* @param pnMax [out] Maximum value
* @param pnStep [out] Step size
* @param pnDefault [out] Default value
* @param pbIsAutoSupported [out] TRUE if auto adjustment is supported, FALSE otherwise
*/
XnStatus (XN_CALLBACK_TYPE* GetRange)(XnModuleNodeHandle hGenerator, const XnChar* strCap, XnInt32* pnMin, XnInt32* pnMax, XnInt32* pnStep, XnInt32* pnDefault, XnBool* pbIsAutoSupported);
/**
* Gets the current value of this capability
*
* @param hGenerator [in] A handle to the instance
* @param strCap [in] Name of the capability
* @param pnValue [out] Current value
*/
XnStatus (XN_CALLBACK_TYPE* Get)(XnModuleNodeHandle hGenerator, const XnChar* strCap, XnInt32* pnValue);
/**
* Sets the current value of this capability
*
* @param hGenerator [in] A handle to the instance
* @param strCap [in] Name of the capability
* @param nValue [in] Value to set
*/
XnStatus (XN_CALLBACK_TYPE* Set)(XnModuleNodeHandle hGenerator, const XnChar* strCap, XnInt32 nValue);
/**
* Registers a callback function to values changes.
*
* @param hGenerator [in] A handle to the instance.
* @param strCap [in] Name of the capability
* @param handler [in] A pointer to a function that will be called when value changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromValueChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToValueChange)
(XnModuleNodeHandle hGenerator, const XnChar* strCap, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToValueChange().
*
* @param hGenerator [in] A handle to the instance.
* @param strCap [in] Name of the capability
* @param hCallback [in] The handle to the callback returned from @ref RegisterToValueChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromValueChange)
(XnModuleNodeHandle hGenerator, const XnChar* strCap, XnCallbackHandle hCallback);
} XnModuleGeneralIntInterface;
typedef struct XnModuleProductionNodeInterface
{
/**
* Checks if the specified capability is supported.
*
* @param hInstance [in] A handle to the instance to be queried.
* @param strCapabilityName [in] The name of the capability to check.
*/
XnBool (XN_CALLBACK_TYPE* IsCapabilitySupported)(
XnModuleNodeHandle hInstance,
const XnChar* strCapabilityName
);
/**
* [Optional] Sets a property.
*
* @param hInstance [in] A handle to the instance.
* @param strName [in] Property name
* @param nValue [in] New value
*/
XnStatus (XN_CALLBACK_TYPE* SetIntProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnUInt64 nValue);
XnStatus (XN_CALLBACK_TYPE* SetRealProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnDouble dValue);
XnStatus (XN_CALLBACK_TYPE* SetStringProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, const XnChar* strValue);
XnStatus (XN_CALLBACK_TYPE* SetGeneralProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnUInt32 nBufferSize, const void* pBuffer);
/**
* [Optional] Gets a property.
*
* @param hInstance [in] A handle to the instance.
* @param strName [in] Property name
* @param pnValue [out] Current value
*/
XnStatus (XN_CALLBACK_TYPE* GetIntProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnUInt64* pnValue);
XnStatus (XN_CALLBACK_TYPE* GetRealProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnDouble* pdValue);
XnStatus (XN_CALLBACK_TYPE* GetStringProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnChar* csValue, XnUInt32 nBufSize);
XnStatus (XN_CALLBACK_TYPE* GetGeneralProperty)(XnModuleNodeHandle hInstance, const XnChar* strName, XnUInt32 nBufferSize, void* pBuffer);
XnModuleExtendedSerializationInterface* pExtendedSerializationInterface;
XnModuleLockAwareInterface* pLockAwareInterface;
XnModuleErrorStateInterface* pErrorStateInterface;
XnModuleGeneralIntInterface* pGeneralIntInterface;
} XnModuleProductionNodeInterface;
typedef struct XnModuleDeviceIdentificationInterface
{
/**
* Gets the device name.
*
* @param hInstance [in] A handle to the instance.
* @param strBuffer [in] A buffer to accept the device name.
* @param pnBufferSize [in/out] Size of the buffer.
*
* @returns XN_STATUS_OK if succeeded, or XN_STATUS_OUTPUT_BUFFER_OVERFLOW if buffer is not sufficient.
* in such a case, the device name should be truncated to fit in the buffer, and pnBufferSize should be
* updated to the required size.
*/
XnStatus (XN_CALLBACK_TYPE* GetDeviceName)(XnModuleNodeHandle hInstance, XnChar* strBuffer, XnUInt32* pnBufferSize);
/**
* Gets a vendor-specific string.
*
* @param hInstance [in] A handle to the instance.
* @param strBuffer [in] A buffer to accept the string.
* @param pnBufferSize [in/out] Size of the buffer.
*
* @returns XN_STATUS_OK if succeeded, or XN_STATUS_OUTPUT_BUFFER_OVERFLOW if buffer is not sufficient.
* in such a case, the string should be truncated to fit in the buffer, and pnBufferSize should be
* updated to the required size.
*/
XnStatus (XN_CALLBACK_TYPE* GetVendorSpecificData)(XnModuleNodeHandle hInstance, XnChar* strBuffer, XnUInt32* pnBufferSize);
/**
* Gets the serial number of the device.
*
* @param hInstance [in] A handle to the instance.
* @param strBuffer [in] A buffer to accept the string.
* @param pnBufferSize [in/out] Size of the buffer.
*
* @returns XN_STATUS_OK if succeeded, or XN_STATUS_OUTPUT_BUFFER_OVERFLOW if buffer is not sufficient.
* in such a case, the string should be truncated to fit in the buffer, and pnBufferSize should be
* updated to the required size.
*/
XnStatus (XN_CALLBACK_TYPE* GetSerialNumber)(XnModuleNodeHandle hInstance, XnChar* strBuffer, XnUInt32* pnBufferSize);
} XnModuleDeviceIdentificationInterface;
typedef struct XnModuleDeviceInterface
{
XnModuleProductionNodeInterface* pProductionNode;
XnModuleDeviceIdentificationInterface* pDeviceIdentificationInterface;
} XnModuleDeviceInterface;
typedef struct XnModuleMirrorInterface
{
/**
* Sets current mirror configuration.
*
* @param hGenerator [in] A handle to the instance.
* @param bMirror [in] TRUE for mirroring output, FALSE otherwise.
*/
XnStatus (XN_CALLBACK_TYPE* SetMirror)(XnModuleNodeHandle hInstance, XnBool bMirror);
/**
* Gets current mirroring configuration.
*
* @param hGenerator [in] A handle to the instance.
*/
XnBool (XN_CALLBACK_TYPE* IsMirrored)(XnModuleNodeHandle hInstance);
/**
* Registers a callback function to mirror changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when mirror changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromMirrorChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToMirrorChange)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToMirrorChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToMirrorChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromMirrorChange)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
} XnModuleMirrorInterface;
typedef struct XnModuleAlternativeViewPointInterface
{
/**
* Checks if this generator can change its output to look like as if it was taken from
* a different location, represented by another generator.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The view point to be checked.
*
* @return TRUE if view point is supported, FALSE otherwise.
*/
XnBool (XN_CALLBACK_TYPE* IsViewPointSupported)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Sets the view point of this generator to look like as if placed at another generator location.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The view point to be set.
*/
XnStatus (XN_CALLBACK_TYPE* SetViewPoint)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Checks if current view point is as if coming from the other node view point.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The view point to be checked.
*/
XnBool (XN_CALLBACK_TYPE* IsViewPointAs)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Sets the view point of this generator to its normal one.
*
* @param hGenerator [in] A handle to the instance.
*/
XnStatus (XN_CALLBACK_TYPE* ResetViewPoint)(XnModuleNodeHandle hGenerator);
/**
* Registers a callback function to view point changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when view point changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromViewPointChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToViewPointChange)(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToViewPointChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToViewPointChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromViewPointChange)(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
/**
* Gets a single pixel coordinates in an alternative view point. This method uses current frame data.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The view point to translate to.
* @param x [in] X-coordinate of the pixel to be translated
* @param y [in] Y-coordinate of the pixel to be translated
* @param pAltX [out] X-coordinate of the pixel in the alternative view point
* @param pAltY [out] Y-coordinate of the pixel in the alternative view point
*/
XnStatus (XN_CALLBACK_TYPE* GetPixelCoordinatesInViewPoint)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther, XnUInt32 x, XnUInt32 y, XnUInt32* pAltX, XnUInt32* pAltY);
} XnModuleAlternativeViewPointInterface;
typedef struct XnModuleFrameSyncInterface
{
/**
* Checks if this generator can frame sync with another generator.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The node to be checked.
*
* @returns TRUE if frame sync is supported, FALSE otherwise.
*/
XnBool (XN_CALLBACK_TYPE* CanFrameSyncWith)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Activates frame sync with another node
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The node to sync with.
*/
XnStatus (XN_CALLBACK_TYPE* FrameSyncWith)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Stops frame sync with another node.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The node to stop sync with.
*/
XnStatus (XN_CALLBACK_TYPE* StopFrameSyncWith)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Checks if frame synced with other node.
*
* @param hGenerator [in] A handle to the instance.
* @param hOther [in] The node to be checked.
*/
XnBool (XN_CALLBACK_TYPE* IsFrameSyncedWith)(XnModuleNodeHandle hGenerator, XnNodeHandle hOther);
/**
* Registers a callback function to frame sync changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when frame sync changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromFrameSyncChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToFrameSyncChange)(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToFrameSyncChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToFrameSyncChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromFrameSyncChange)(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
} XnModuleFrameSyncInterface;
/** The interface of a generator. */
typedef struct XnModuleGeneratorInterface
{
/**
* Contains production node interface.
*/
XnModuleProductionNodeInterface* pProductionNodeInterface;
/**
* Starts generation of the output.
*
* @param hGenerator [in] A handle to the instance to start generating.
*/
XnStatus (XN_CALLBACK_TYPE* StartGenerating)
(XnModuleNodeHandle hGenerator);
/**
* Checks if the generator is currently generating.
*
* @param hGenerator [in] A handle to the instance.
*/
XnBool (XN_CALLBACK_TYPE* IsGenerating)
(XnModuleNodeHandle hGenerator);
/**
* Stops generation of the output.
*
* @param hGenerator [in] A handle to the instance to stop generating.
*/
void (XN_CALLBACK_TYPE* StopGenerating)
(XnModuleNodeHandle hGenerator);
/**
* Registers a callback function to be called when generation starts or stops.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when generation starts/stops.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromGenerationRunningChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToGenerationRunningChange)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToGenerationRunningChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToGenerationRunningChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromGenerationRunningChange)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
/**
* Registers a callback function to be called when new data is available.
*
* @param handler [in] A pointer to a function that will be called when new data is available.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromNewDataAvailable().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToNewDataAvailable)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToNewDataAvailable().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToNewDataAvailable().
*/
void (XN_CALLBACK_TYPE* UnregisterFromNewDataAvailable)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
/**
* Checks whether this node has new data (and so a call to @ref xn::Generator::WaitAndUpdateData() will not block).
*
* @param hGenerator [in] A handle to the instance to be updated.
* @param pnTimestamp [out] If new data is available, the timestamp of that data.
*/
XnBool (XN_CALLBACK_TYPE* IsNewDataAvailable)
(XnModuleNodeHandle hGenerator, XnUInt64* pnTimestamp);
/**
* Updates the data to the latest available one. This function will only be called AFTER the node
* notified OpenNI it has new data available.
*
* @param hGenerator [in] A handle to the instance to be updated.
*/
XnStatus (XN_CALLBACK_TYPE* UpdateData)
(XnModuleNodeHandle hGenerator);
/**
* Gets the size of current data, in bytes.
*
* @param hGenerator [in] A handle to the instance.
*/
XnUInt32 (XN_CALLBACK_TYPE* GetDataSize)(XnModuleNodeHandle hGenerator);
/**
* Gets the timestamp of current data, in microseconds.
*
* @param hGenerator [in] A handle to the instance.
*/
XnUInt64 (XN_CALLBACK_TYPE* GetTimestamp)(XnModuleNodeHandle hGenerator);
/**
* Gets the frame ID of current data.
*
* @param hGenerator [in] A handle to the instance.
*/
XnUInt32 (XN_CALLBACK_TYPE* GetFrameID)(XnModuleNodeHandle hGenerator);
XnModuleMirrorInterface* pMirrorInterface;
XnModuleAlternativeViewPointInterface* pAlternativeViewPointInterface;
void* pObsolete1; // used to be pSeekingInterface (removed in 1.0.0.28)
XnModuleFrameSyncInterface* pFrameSyncInterface;
//Note: The GetData() function was added in version 1.0.0.28
/**
* Gets pointer to current data.
*
* @param hGenerator [in] A handle to the instance.
*/
const void* (XN_CALLBACK_TYPE* GetData)(XnModuleNodeHandle hGenerator);
} XnModuleGeneratorInterface;
typedef struct XnModuleRecorderInterface
{
/*
* Sets the output stream for the recorder module.
*
* @param hInstance [in] A handle to the instance.
* @param pStreamToken [in] A token that the recorder module must save for passing to later stream calls.
* @param pStream [in] The stream interface the recorder module must save for later stream calls.
*/
XnStatus (XN_CALLBACK_TYPE* SetOutputStream)
(XnModuleNodeHandle hInstance, void *pStreamToken, XnRecorderOutputStreamInterface *pStream);
XnModuleProductionNodeInterface* pProductionNode;
XnNodeNotifications* pNodeNotifications;
} XnModuleRecorderInterface;
typedef struct XnModulePlayerInterface
{
/*
* Sets the input stream for the player module
*
* @param hInstance [in] A handle to the instance.
* @param pStreamCookie [in] A cookie that the player module must save for passing to later stream calls.
* @param pStream [in] The stream interface the player module must save for later stream calls.
*/
XnStatus (XN_CALLBACK_TYPE* SetInputStream)
(XnModuleNodeHandle hInstance, void *pStreamCookie, XnPlayerInputStreamInterface *pStream);
/**
* Reads next data from the input stream.
*
* @param hInstance [in] A handle to the instance.
*/
XnStatus (XN_CALLBACK_TYPE* ReadNext)(XnModuleNodeHandle hInstance);
/*
* Sets the node notifications object to be used by the player. The player will use this object to
* notify about events it encounters in the stream that was set with @ref SetInputStream().
*
* @param hInstance [in] A handle to the instance.
* @param pNodeNotificationsCookie [in] A cookie that the player module must save for passing to node notification calls.
* @param pNodeNotifications [in] The node notifications interface that the player module will use to raise node notifications it finds in the stream.
*/
XnStatus (XN_CALLBACK_TYPE* SetNodeNotifications)
(XnModuleNodeHandle hInstance, void *pNodeNotificationsCookie, XnNodeNotifications *pNodeNotifications);
XnStatus (XN_CALLBACK_TYPE* SetRawNodeNotifications)
(XnModuleNodeHandle hInstance, void *pRawNodeNotificationsCookie, XnNodeNotifications *pRawNodeNotifications);
/*
* Determines whether the player repeats the played stream or not.
*
* @param bRepeat [in] If TRUE, repeat is set to be ON. If FALSE, repeat is set to be OFF.
*/
XnStatus (XN_CALLBACK_TYPE* SetRepeat)
(XnModuleNodeHandle hInstance, XnBool bRepeat);
XnStatus (XN_CALLBACK_TYPE* SeekToTimeStamp)
(XnModuleNodeHandle hInstance, XnInt64 nTimeOffset, XnPlayerSeekOrigin origin);
XnStatus (XN_CALLBACK_TYPE* SeekToFrame)
(XnModuleNodeHandle hInstance, const XnChar* strNodeName, XnInt32 nFrameOffset, XnPlayerSeekOrigin origin);
XnStatus (XN_CALLBACK_TYPE* TellTimestamp)
(XnModuleNodeHandle hInstance, XnUInt64* pnTimestamp);
XnStatus (XN_CALLBACK_TYPE* TellFrame)
(XnModuleNodeHandle hInstance, const XnChar* strNodeName, XnUInt32* pnFrame);
XnStatus (XN_CALLBACK_TYPE* GetNumFrames)
(XnModuleNodeHandle hInstance, const XnChar* strNodeName, XnUInt32* pnFrames);
const XnChar* (XN_CALLBACK_TYPE* GetSupportedFormat)
(XnModuleNodeHandle hInstance);
XnBool (XN_CALLBACK_TYPE* IsEOF)
(XnModuleNodeHandle hInstance);
/**
* Registers a callback function to be called when end-of-file was reached.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function to be called.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to UnregisterFromEndOfFileReached().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToEndOfFileReached)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using RegisterToEndOfFileReached().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from RegisterToEndOfFileReached().
*/
void (XN_CALLBACK_TYPE* UnregisterFromEndOfFileReached)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
XnModuleProductionNodeInterface* pProductionNode;
void* pObsolete1; // used to be pSeekingInterface (removed in 1.0.0.28)
} XnModulePlayerInterface;
typedef struct XnModuleCroppingInterface
{
/**
* Sets the cropping.
*
* @param hGenerator [in] A handle to the instance.
* @param pCropping [in] The cropping configuration to be set.
*/
XnStatus (XN_CALLBACK_TYPE* SetCropping)(XnModuleNodeHandle hGenerator, const XnCropping* pCropping);
/**
* Gets current cropping configuration.
*
* @param hGenerator [in] A handle to the instance.
* @param pCropping [out] Current cropping configuration.
*/
XnStatus (XN_CALLBACK_TYPE* GetCropping)(XnModuleNodeHandle hGenerator, XnCropping* pCropping);
/**
* Registers a callback function to cropping changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when cropping changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to UnregisterFromCroppingChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToCroppingChange)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using RegisterToCroppingChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from RegisterToCroppingChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromCroppingChange)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
} XnModuleCroppingInterface;
typedef struct XnModuleAntiFlickerInterface
{
/**
* Sets the power line frequency: 50 Hz, 60 Hz, or 0 to turn off anti-flicker.
*
* @param hGenerator [in] A handle to the instance.
* @param nFrequency [in] The frequency to be used.
*/
XnStatus (XN_CALLBACK_TYPE* SetPowerLineFrequency)(XnModuleNodeHandle hGenerator, XnPowerLineFrequency nFrequency);
/**
* Gets the power line frequency.
*
* @param hGenerator [in] A handle to the instance.
*/
XnPowerLineFrequency (XN_CALLBACK_TYPE* GetPowerLineFrequency)(XnModuleNodeHandle hGenerator);
/**
* Registers a callback function to power line frequency changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when power line frequency changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref UnregisterFromPowerLineFrequencyChange().
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToPowerLineFrequencyChange)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using @ref RegisterToPowerLineFrequencyChange().
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from @ref RegisterToPowerLineFrequencyChange().
*/
void (XN_CALLBACK_TYPE* UnregisterFromPowerLineFrequencyChange)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
} XnModuleAntiFlickerInterface;
typedef struct XnModuleMapGeneratorInterface
{
/**
* Contains the generator interface.
*/
XnModuleGeneratorInterface* pGeneratorInterface;
/**
* Gets the number of supported modes. This is useful for allocating an array that will be passed to
* @ref GetSupportedMapOutputModes().
*
* @param hInstance [in] A handle to the instance.
*/
XnUInt32 (XN_CALLBACK_TYPE* GetSupportedMapOutputModesCount)
(XnModuleNodeHandle hGenerator);
/**
* Gets a list of all supported modes. The size of the array that should be passed can be obtained by calling
* @ref GetSupportedMapOutputModesCount().
*
* @param hInstance [in] A handle to the instance.
* @param aModes [in/out] An array to be filled with supported modes.
* @param pnCount [in/out] In: number of elements allocated in the array. Out: number of elements
* actually written to the array.
*/
XnStatus (XN_CALLBACK_TYPE* GetSupportedMapOutputModes)
(XnModuleNodeHandle hGenerator,
XnMapOutputMode* aModes, XnUInt32* pnCount);
/**
* Sets the output mode.
*
* @param hGenerator [in] A handle to the instance.
* @param pOutputMode [in] The output mode to be set.
*/
XnStatus (XN_CALLBACK_TYPE* SetMapOutputMode)
(XnModuleNodeHandle hGenerator, const XnMapOutputMode* pOutputMode);
/**
* Gets the current output mode.
*
* @param hGenerator [in] A handle to the instance.
* @param pOutputMode [out] Current output mode.
*/
XnStatus (XN_CALLBACK_TYPE* GetMapOutputMode)
(XnModuleNodeHandle hGenerator, XnMapOutputMode* pOutputMode);
/**
* Registers a callback function to mode changes.
*
* @param hGenerator [in] A handle to the instance.
* @param handler [in] A pointer to a function that will be called when mode changes.
* @param pCookie [in] A user cookie that will be passed to the callback function.
* @param phCallback [out] Optional. Will be filled with a handle to be passed to UnregisterFromMapOutputModeChange.
*/
XnStatus (XN_CALLBACK_TYPE* RegisterToMapOutputModeChange)
(XnModuleNodeHandle hGenerator, XnModuleStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
/**
* Unregisters a callback function which was registered using RegisterToMapOutputModeChange.
*
* @param hGenerator [in] A handle to the instance.
* @param hCallback [in] The handle to the callback returned from RegisterToMapOutputModeChange.
*/
void (XN_CALLBACK_TYPE* UnregisterFromMapOutputModeChange)
(XnModuleNodeHandle hGenerator, XnCallbackHandle hCallback);
XnModuleCroppingInterface* pCroppingInterface;
// NOTE: GetBytesPerPixel() was added in OpenNI 1.0.0.30
/**
* Gets the number of bytes per pixel
*
* @param hGenerator [in] A handle to the instance.
*/
XnUInt32 (XN_CALLBACK_TYPE* GetBytesPerPixel)
(XnModuleNodeHandle hGenerator);
XnModuleAntiFlickerInterface* pAntiFlickerInterface;
} XnModuleMapGeneratorInterface;
/**
* A set of functions supported by depth generators who supports the User Position capability.
*/
typedef struct XnModuleUserPositionCapabilityInterface
{
/**
* Gets the number of user positions supported by this generator.
*
* @param hGenerator [in] A handle to the instance.
*/
XnUInt32 (XN_CALLBACK_TYPE* GetSupportedUserPositionsCount)
(XnModuleNodeHandle hGenerator);
/**
* Sets the current user position.
*
* @param hGenerator [in] A handle to the instance.
* @param nIndex [in] The user position to set.
* @param pPosition [in] The user position in the frame.
*/
XnStatus (XN_CALLBACK_TYPE* SetUserPosition)(
XnModuleNodeHandle hGenerator,