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
|
/****************************************************************************
* *
* PrimeSense Sensor 5.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of PrimeSense Sensor. *
* *
* PrimeSense Sensor is free software: you can redistribute it and/or modify*
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* PrimeSense Sensor is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
* *
****************************************************************************/
#ifndef _XNV_DEVICE_H_
#define _XNV_DEVICE_H_
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnDevice.h>
#include "XnVStreamContainer.h"
#include "XnVDepthMap.h"
#include "XnVImageMap.h"
#include "XnVAudioBuffer.h"
#include "XnVStatus.h"
#include "XnVPropertySet.h"
#include "XnVEventHandlers.h"
#include <XnStringsHash.h>
#ifdef XN_USE_DEVICE_3_6
#include "XnVDeviceCallbackHandler.h"
#include "XnVInitStreamProperties.h"
#include "XnStream.h"
#include "XnIOParams.h"
#else
class XnVDeviceCallbackHandler;
class XnVInitStreamProperties;
#endif
//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#ifdef XN_USE_DEVICE_3_6
#define XNV_DEVICE_QVGA_XRES 320
#define XNV_DEVICE_QVGA_YRES 240
#define XNV_DEVICE_QVGA_YRES_V1 256
#define XNV_DEVICE_VGA_XRES 640
#define XNV_DEVICE_VGA_YRES 480
#define XNV_DEVICE_VGA_YRES_V1 512
#define XNV_DEVICE_SXGA_XRES 1280
#define XNV_DEVICE_SXGA_YRES 1024
#endif
#ifdef XN_USE_DEVICE_3_6
#define XN_IS_3_6 TRUE
#else
#define XN_IS_3_6 FALSE
#endif
#define XNV_SENSOR_CONSTANT 1280
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
class XnProperty; // forward declaration
// start v3.6 section - disable deprecated warnings
#pragma warning (push)
#pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
/**
* This is generally the first entry point to the Experience Engine.
* It represents a device of any kind, and once initialized supplies Read() or Write()
* capabilities, according to the open mode and the specific device capabilities.
* In order to get the current frame, GetDepthMap() and GetImageMap() can be called,
* which will return pointers to XnVDepthMap and XnVImageMap, respectively.
* These pointers can be used through frames - once Read() is called again,
* The internal buffer of the XnVDepthMap and XnVImageMap are overwritten.
*/
class XN_EE_CORE_API XnVDevice : public XnVStreamContainer, private XnVStreamCollectionChangedHandler
{
public:
/**
* Initialize Engine Core
*
* @param [in] strINIFile File name, from which to take Core:Security and IO:WorkingDirectory
*/
static XnStatus EngineInit(const XnChar* strINIFile);
static XnStatus EngineInit(const XnChar* strSecurityString, const XnChar* strWorkingDirectory);
static XnStatus EngineShutdown();
/**
* A device is initially unusable, until it is opened.
*/
XnVDevice(XnBool bUse36 = XN_IS_3_6)
{
Ctor(bUse36);
}
virtual ~XnVDevice();
/**
* Enumerates available devices.
*
* @param aConnectionStrings [in/out] An array to be filled with connection strings.
* @param pnCount [in/out] In: the size of the array. Out: the number of elements filled in the array.
*
* @returns XN_STATUS_OUTPUT_BUFFER_OVERFLOW The size of the array is too small. In this case, pnCount will hold needed size.
*/
XnStatus Enumerate(XnConnectionString* aConnectionStrings, XnUInt32* pnCount);
/**
* Creates a device using definitions from an INI file.
*
* @param [in] strIniFileName INI file to use for initialization.
* @param [in] strSectionName section name in INI file that describes the device.
* @param [in] pInitialValues [Optional] When provided, contains values to be overridden in created device.
*/
XnStatus CreateFromINI(const XnChar* strIniFileName, const XnChar* strSectionName, XnVPropertySet* pInitialValues = NULL);
/**
* Creates a device using a connection string.
*
* @param [in] strConnectionString Connection string.
* @param [in] Mode The mode in which device should be opened.
* @param [in] pInitialValues [Optional] When provided, contains values to be overridden in created device.
* @param [in] Sharing [Optional] Can change the sharing mode of the device.
*/
XnStatus CreateByConnectionString(XnConnectionString strConnectionString, XnDeviceMode Mode, XnVPropertySet* pInitialValues = NULL, XnDeviceSharingMode Sharing = XN_DEVICE_EXCLUSIVE);
/**
* Creates a sensor device.
*
* @param [in] strSensorID ID of the sensor to connect to.
* @param [in] pInitialValues [Optional] When provided, contains values to be overridden in created device.
* @param [in] Sharing [Optional] Can change the sharing mode of the sensor.
*/
XnStatus CreateSensor(const XnChar* strSensorID, XnVPropertySet* pInitialValues = NULL, XnDeviceSharingMode Sharing = XN_DEVICE_EXCLUSIVE);
/**
* Creates a file device.
*
* @param [in] strFileName Path of the file to open.
* @param [in] Mode The mode in which device should be opened.
* @param [in] pInitialValues [Optional] When provided, contains values to be overridden in created device.
*/
XnStatus CreateFileDevice(const XnChar* strFileName, XnDeviceMode Mode, XnVPropertySet* pInitialValues = NULL);
/**
* Configures a device from an INI file.
*
* @param [in] strIniFileName INI file to use for initialization.
* @param [in] strSectionName section name in INI file that describes the device.
*/
XnStatus ConfigureFromINI(const XnChar* strIniFileName, const XnChar* strSectionName);
/**
* Creates and configures a device using an INI file, and opens it for reading.
*
* @param [in] strIniFileName INI file to use for initialization.
* @param [in] strSectionName section name in INI file that describes the device.
* @param [in] pInitialValues [Optional] When provided, contains values to be overridden in created device.
*/
XnStatus OpenDeviceFromINI(const XnChar* strIniFileName, const XnChar* strSectionName, XnVPropertySet* pInitialValues = NULL);
/**
* Creates and configures a sensor using a configuration set.
*
* @param [in] strSensorID ID of the sensor to connect to.
* @param [in] Initializer A configuration set to use.
* @param [in] Sharing [Optional] Can change the sharing mode of the sensor.
*/
XnStatus OpenSensor(const XnChar* strSensorID, XnVPropertySet& InitialValues, XnDeviceSharingMode Sharing = XN_DEVICE_EXCLUSIVE);
/**
* Creates a read file device, and opens all streams for reading.
*
* @param [in] strFileName Path of the file to open.
*/
XnStatus OpenFileForReading(const XnChar* strFileName);
/**
* Creates a write file device, and configures it using a configuration set.
*
* @param [in] strFileName Path of the file to open.
* @param [in] Initializer A configuration set to use.
*/
XnStatus OpenFileForWriting(const XnChar* strFileName, XnVPropertySet& InitialValues);
/**
* Close the device.
*/
XnStatus Close();
/**
* Gets a list of stream types this device supports.
*/
XnStatus GetSupportedStreams(const XnChar** aStreamTypes, XnUInt32* pnStreamTypesCount) const;
/**
* Creates a new stream in the device.
*
* @param [in] strType The type of the stream to create
* @param [in] strName The name to give the new stream. If NULL then type will also be used as the name.
* @param [in] pInitialValues [Optional]. When provided, values in the set will replace default values in the newly created stream.
*/
XnStatus AddStream(const XnChar* strType, const XnChar* strName = NULL, const XnVPropertySet* pInitialValues = NULL);
/**
* Removes a stream from the device.
*
* @param [in] strName The name of the stream to remove.
*/
XnStatus RemoveStream(const XnChar* strName);
/**
* Opens a stream for reading/writing.
*
* @param [in] strName The name of the stream to open.
*/
XnStatus OpenStream(const XnChar* strName);
/**
* Closes an open stream.
*
* @param [in] strName The name of the stream to close.
*/
XnStatus CloseStream(const XnChar* strName);
/**
* Opens all streams of the device.
*/
XnStatus OpenAllStreams();
/**
* Closes all streams of the device.
*/
XnStatus CloseAllStreams();
/**
* Gets the device current timestamp.
*/
XnStatus TellTime(XnUInt64* pnTimestamp);
/**
* Seeks the device to the specified timestamp.
*/
XnStatus SeekTime(XnUInt64 nTimestamp);
/**
* Get the ID of the current frame.
*
* @param [out] pnFrameID The ID of the current frame.
*/
XnStatus TellFrame(XnUInt32* pnFrameID);
/**
* Move to a specific frame
*
* @param [in] nFrameID The ID of the target frame.
*/
XnStatus SeekFrame(XnUInt32 nFrameID);
/**
* Check if a module (or stream) is available on the device.
*
* @param [in] strModule Name of the Module or Stream
*/
XnStatus DoesModuleExist(const XnChar* strModule, XnBool* pbDoesExist) const;
/**
* Check if a specific property exists on the module.
* Possible Property names are available in XnStreamParams.h
*
* @param [in] strModule Name of the Module or Stream
* @param [in] strProperty Name of the property
*/
XnStatus DoesPropertyExist(const XnChar* strModule, const XnChar* strProperty, XnBool* pbDoesExist) const;
XnStatus GetAllProperties(XnVPropertySet& PropertySet, const XnChar* strModule) const;
virtual XnStatus GetAllProperties(XnVPropertySet& PropertySet, XnBool bNoStreams = FALSE, const XnChar* strModule = NULL) const;
XnStatus GetStreamNames(const XnChar** pstrStreamNames, XnUInt32* pnArraySize);
XnStatus FindStreamOfType(const XnChar* strType, XnVStream& stream);
XnStatus RegisterForPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnVModulePropertyChangedHandler* pHandler, XnCallbackHandle* phCallback);
XnStatus RegisterForNewDataFromStreamEvent(XnVNewDataFromStreamHandler* pHandler, XnCallbackHandle* phCallback);
XnStatus RegisterForStreamCollectionChangedEvent(XnVStreamCollectionChangedHandler* pHandler, XnCallbackHandle* phCallback);
XnStatus UnregisterFromPropertyChangedEvent(const XnChar* strModule, const XnChar* strProperty, XnCallbackHandle hCallback);
XnStatus UnregisterFromNewDataFromStreamEvent(XnCallbackHandle hCallback);
XnStatus UnregisterFromStreamCollectionChangedEvent(XnCallbackHandle hCallback);
XnStatus IsStreamSupported(const XnChar* strStream, XnBool* pbSupported) const;
/**
* Gets the stream data object related to the requested stream.
*
* @param [in] strStream Name of the stream.
* @param [out] pStreamData The stream data object of this stream.
*/
XnStatus GetStreamData(const XnChar* strStream, XnVStreamData*& pStreamData) const;
/**
* Read the next frame from the device into the data buffers.
*/
XnStatus Read();
/**
* Read the next frame from the device into the data buffers. Waits till specific stream is received.
*/
XnStatus Read(const XnChar* strStreamName);
/**
* Read the next frame from the device into the data buffers. Waits till specific stream is received.
*/
XnStatus Read(const XnVStream& Stream);
/**
* Copies data into a stream.
*/
XnStatus CopyFrom(XnVDevice& sourceDevice);
/**
* Write only a specific stream to the device. The device must be opened for writing.
*
* @param [in] Stream The stream from which to take the buffer to write to the device.
*/
XnStatus Write(XnVStream& Stream);
XnStatus Write(const XnChar* strStreamName);
/**
* Writes data to the underlying device. The device must be opened for writing.
*/
XnStatus Write();
inline XnVDepthMap* GetDepthMap()
{
return m_pdmDepthMap;
}
inline XnVImageMap* GetImageMap()
{
return m_pimImageMap;
}
inline XnVAudioBuffer* GetAudioBuffer()
{
return m_pabAudioBuffer;
}
/**
* Gets the IR map. If the device does not have a IR stream, NULL is returned.
*/
inline XnVImageMap* GetIRMap()
{
return m_pimIRMap;
}
inline const XnVDepthMap* GetDepthMap() const
{
return m_pdmDepthMap;
}
inline const XnVImageMap* GetImageMap() const
{
return m_pimImageMap;
}
inline const XnVAudioBuffer* GetAudioBuffer() const
{
return m_pabAudioBuffer;
}
inline const XnVImageMap* GetIRMap() const
{
return m_pimIRMap;
}
/**
* Get a specific type of stream, if available.
* Possible Stream names are available in XnStreamParams.h
*
* @param [in] strName Name of the Stream
* @param [out] Stream The Stream
*/
XnStatus GetStream(const XnChar* strName, XnVStream& Stream);
/**
* Get a specific type of module, if available.
* Possible Module names are available in XnStreamParams.h
*
* @param [in] strName Name of the Module
* @param [out] Module The Module
*/
XnStatus GetModule(const XnChar* strName, XnVModule& Module);
/**
* Get value of a property from some module.
*
* @param [in] strModule Name of the Module or Stream
* @param [in] strProperty Name of the Property
* @param [out] nValue The value of the Property
*/
XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt64& nValue) const;
XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, XnDouble& fValue) const;
XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, XnChar* pcsValue) const;
XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, const XnGeneralBuffer& gbValue) const;
XnStatus GetPropertyType(const XnChar* strModule, const XnChar* strProperty, XnPropertyType& nType);
/**
* Set value of a property in some module.
*
* @param [in] strModule Name of the Module or Stream
* @param [in] strProperty Name of the Property
* @param [in] nValue New value of the Property
*/
XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt64 nValue);
XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, XnDouble fValue);
XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, const XnChar* csValue);
XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, const XnGeneralBuffer& gbValue);
XnStatus BatchConfig(XnVPropertySet& ChangeSet);
protected:
void Ctor(XnBool b36);
private:
XnStatus Init();
XnStatus CloseImpl();
XnStatus CreateFromINIImpl(const XnChar* strIniFileName, const XnChar* strSectionName, XnVPropertySet* pInitialValues);
XnStatus CreateByConnectionStringImpl(XnConnectionString strConnectionString, XnDeviceMode Mode, XnVPropertySet* pInitialValues, XnDeviceSharingMode Sharing);
XnStatus CreateSensorImpl(const XnChar* strSensorID, XnVPropertySet* pInitialValues, XnDeviceSharingMode Sharing);
XnStatus CreateFileImpl(const XnChar* strFileName, XnDeviceMode Mode, XnVPropertySet* pInitialValues);
XnStatus UpdateAllStreams();
XnStatus GetProperty40(const XnChar* strModule, const XnChar* strProperty, XnDouble& fValue) const;
virtual XnStatus AddStreamToDevice(const XnChar* strName);
virtual XnStatus RemoveStreamFromDevice(const XnChar* strName);
virtual void OnStreamAdded(const XnChar* strName);
virtual void OnStreamRemoved(const XnChar* strName);
static XnBool IsXnVDeviceStreamProp(const XnChar* strProperty);
static void XN_CALLBACK_TYPE OnStreamsChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, XnStreamsChangeEventType EventType, void* pCookie);
static void XN_CALLBACK_TYPE OnPropertyChangedCallback(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
static void XN_CALLBACK_TYPE OnNewStreamDataCallback(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
static XnStatus XN_CALLBACK_TYPE OnXnVDevicePropertyChanged(const XnProperty* pSender, void* pCookie);
XnDeviceHandle m_DeviceHandle;
XnVDepthMap* m_pdmDepthMap;
XnVImageMap* m_pimImageMap;
XnVImageMap* m_pimIRMap;
XnVAudioBuffer* m_pabAudioBuffer;
XnBool m_bValid;
XnBool m_bWritable;
XnBool m_bIs36;
XnStreamDataSet* m_pStreamOutputSet;
XnStringsHash m_StreamsHash;
// for 3.6 BC
mutable XnStatus m_LastStatus;
XnVDeviceCallbackHandler* m_pCallbackHandler;
XnChar m_strPrimary[XN_DEVICE_MAX_STRING_LENGTH];
mutable XnGeneralBuffer m_D2STable;
mutable XnGeneralBuffer m_S2DTable;
protected:
XnStatus OpenFileRead(const XnChar* strFileName, XnVStreamContainer* pInitializer = NULL, XnVInitStreamProperties* pStreams = NULL);
XnStatus OpenFileWrite(const XnChar* strFileName, XnVStreamContainer* pInitializer = NULL, XnVInitStreamProperties* pStreams = NULL);
XnStatus GeneralOpenSensor(const XnChar* strType, const XnChar* strSensorID, XnVStreamContainer* pInitializer = NULL, XnVInitStreamProperties* pStreams = NULL);
public:
typedef XN_3_6_API enum
{
XNV_RES_DEFAULT,
XNV_RES_QVGA = XN_RESOLUTION_QVGA,
XNV_RES_VGA = XN_RESOLUTION_VGA,
XNV_RES_SXVGA = XN_RESOLUTION_SXGA,
} XnVResolution;
/**
* Initialize a device from an INI file. Calls EngineInit itself.
*
* @param [in] strIniFileName INI file to use for initialization.
* @param [in] strSectionName section name in INI file that describes the device.
* @param [in] pInitializer StreamContainer (XnVDevice) to use for the stream. NULL implies use of default.
*/
XN_3_6_API XnStatus OpenFromINI(const XnChar* strIniFileName, const XnChar* strSectionName, XnVStreamContainer* pInitializer = NULL);
/**
* Initialize a device from any sensor found connected to the host.
*
* @param [in] strSensorID connection string for the sensor
* @param [in] pInitializer StreamContainer (XnVDevice) to use for the stream. NULL implies use of default.
* @param [in] pStreams parameters for sensor initialization. NULL implies use of default.
*/
XN_3_6_API XnStatus OpenSensor(const XnChar* strSensorID, XnVStreamContainer* pInitializer = NULL, XnVInitStreamProperties* pStreams = NULL);
/**
* Initialize a device from a file.
*
* @param [in] strFileName .xns File to open as device
* @param [in] Mode mode in which to open the device: XN_DEVICE_MODE_READ or XN_DEVICE_MODE_WRITE
* @param [in] pInitializer StreamContainer (XnVDevice) to use for the stream. NULL implies use of default.
* @param [in] pStreams parameters to change in the initializer (or the default). NULL implies use of default.
*/
XN_3_6_API XnStatus OpenFile(const XnChar* strFileName, XnDeviceMode Mode, XnVStreamContainer* pInitializer = NULL, XnVInitStreamProperties* pStreams = NULL);
/**
* Check if a module (or stream) is available on the device.
*
* @param [in] strModule Name of the Module or Stream
*/
XN_3_6_API XnBool IsModuleExist(const XnChar* strModule);
/**
* Check if a specific property exists on the module.
* Possible Property names are available in XnStreamParams.h
*
* @param [in] strModule Name of the Module or Stream
* @param [in] strProperty Name of the property
*/
XN_3_6_API XnBool IsPropertyExist(const XnChar* strModule, const XnChar* strProperty);
/**
* This function sets the user callback handler for the device.
*
* @param pCallbackHandler [in] A pointer to a user-defined class which inherits from XnVDeviceCallbackHandler.
*/
XN_3_6_API XnStatus SetCallbackHandler(XnVDeviceCallbackHandler* pCallbackHandler);
/**
* Write data to the device. The device must be opened for writing.
*
* @param [in] strModule The stream under which to add the buffer.
* @param [in] pBuffer The buffer to add.
* @param [in] nSize The size of the buffer.
* @param [in] nTimeStamp The Timestamp of the written depth map.
*/
XN_3_6_API XnStatus Write(const XnChar* strModule, const XnChar* pBuffer, XnUInt32 nSize, XnUInt64 nTimeStamp = 0);
/**
* Write data to the device. The device must be opened for writing.
*
* @param [in] dmMap The Depth map to add as the Depth Stream.
* @param [in] nTimeStamp The Timestamp of the written depth map.
*/
XN_3_6_API XnStatus Write(XnVDepthMap& dmMap, XnUInt64 nTimeStamp = 0);
/**
* Write data to the device. The device must be opened for writing.
*
* @param [in] imMap The Image map to add as the Image Stream.
* @param [in] nTimeStamp The Timestamp of the written image map.
*/
XN_3_6_API XnStatus Write(XnVImageMap& imMap, XnUInt64 nTimeStamp = 0);
/**
* Write data to the device. The device must be opened for writing.
*
* @param [in] abBuffer The audio buffer to add as the Audio Stream.
* @param [in] nTimeStamp The Timestamp of the written audio buffer.
*/
XN_3_6_API XnStatus Write(XnVAudioBuffer& abBuffer, XnUInt64 nTimeStamp = 0);
/**
* Will be removed in a future version.
* For now, calling Write() just copies the buffers, but doesn't actually write to the device.
* This function actually writes to the device.
* It writes one buffer of each stream.
*/
XN_3_6_API XnStatus CommitWrite();
/**
* Get the last low level SDK's status.
*/
XN_3_6_API inline XnStatus GetLastStatus()
{
return m_LastStatus;
}
XN_3_6_API XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetProperty(const XnChar* strModule, const XnChar* strProperty, void*& pValue) const;
XN_3_6_API XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt16 nValue);
XN_3_6_API XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetProperty(const XnChar* strModule, const XnChar* strProperty, void* pValue);
// For possible parameters, take a look at XnIOParams.h
XN_3_6_API XnStatus SetIOParam(const XnChar* strParam, XnInt32 nValue);
XN_3_6_API XnStatus SetIOParam(const XnUInt32 nParam, XnInt32 nValue);
XN_3_6_API XnStatus SetIOParam(const XnUInt32 nParam, const void* pValue);
XN_3_6_API XnStatus GetIOParam(const XnChar* strParam, XnInt32& nValue) const;
XN_3_6_API XnStatus GetIOParam(const XnUInt32 nParam, XnInt32& nValue) const;
XN_3_6_API XnStatus GetIOParam(const XnUInt32 nParam, void* pValue) const;
XN_3_6_API XnStatus HandleDeviceCallback(XnUInt32 CallbackEvent, void* pCallbackData);
XN_3_6_API XnStatus EnableFlag(XnInt32 nFlag);
XN_3_6_API XnStatus DisableFlag(XnInt32 nFlag);
XN_3_6_API XnStatus FlipFlag(XnInt32 nFlag);
XN_3_6_API XnStatus GetFlag(XnInt32 nFlag, XnUInt32& nValue);
XN_3_6_API XnStatus StartCaptureMode(XnBool bNewFramesOnly);
XN_3_6_API XnStatus StopCaptureMode();
XN_3_6_API XnStatus AddStream(const XnChar* strName);
XN_3_6_API XnStatus AddStream(const XnChar* strName, const XnVStream& Stream);
private:
XN_3_6_API XnStatus Write36(XnVStream& Stream);
XN_3_6_API XnStatus GetDepthProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetDepthProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetDepthProperty(const XnChar* strProperty, XnUInt64& nValue) const;
XN_3_6_API XnStatus GetDepthProperty(const XnChar* strProperty, void*& pValue) const;
XN_3_6_API XnStatus GetImageProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetImageProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetImageProperty(const XnChar* strProperty, XnUInt64& nValue) const;
XN_3_6_API XnStatus GetIRProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetIRProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetIRProperty(const XnChar* strProperty, XnUInt64& nValue) const;
XN_3_6_API XnStatus GetAudioProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetAudioProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetAudioProperty(const XnChar* strProperty, XnUInt64& nValue) const;
XN_3_6_API XnStatus GetShiftsProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetShiftsProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetShiftsProperty(const XnChar* strProperty, void*& pValue) const;
XN_3_6_API XnStatus GetFixedParamsProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetFixedParamsProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetFixedParamsProperty(const XnChar* strProperty, XnDouble& fValue) const;
XN_3_6_API XnStatus GetDeviceProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus GetDeviceProperty(const XnChar* strProperty, void*& pValue) const;
XN_3_6_API XnStatus GetRegistrationProperty(const XnChar* strProperty, XnUInt16& nValue) const;
XN_3_6_API XnStatus GetRegistrationProperty(const XnChar* strProperty, XnUInt32& nValue) const;
XN_3_6_API XnStatus SetDepthProperty(const XnChar *strProperty, XnUInt16 nValue);
XN_3_6_API XnStatus SetDepthProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetDepthProperty(const XnChar* strProperty, XnUInt64 nValue);
XN_3_6_API XnStatus SetDepthProperty(const XnChar* strProperty, void* pValue);
XN_3_6_API XnStatus SetImageProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetImageProperty(const XnChar* strProperty, XnUInt64 nValue);
XN_3_6_API XnStatus SetIRProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetIRProperty(const XnChar* strProperty, void* pValue);
XN_3_6_API XnStatus SetAudioProperty(const XnChar* strProperty, XnUInt16 nValue);
XN_3_6_API XnStatus SetAudioProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetAudioProperty(const XnChar* strProperty, XnUInt64 nValue);
XN_3_6_API XnStatus SetRegistrationProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetDeviceProperty(const XnChar* strProperty, XnUInt32 nValue);
XN_3_6_API XnStatus SetDeviceProperty(const XnChar* strProperty, void* pValue);
XN_3_6_API XnStatus ConfigureFrom36Device(XnVDevice& otherDevice);
XN_3_6_API XnStatus ConfigureFileFrom36Device(XnVDevice& otherDevice);
XN_3_6_API XnStatus ConfigureDefault();
XN_3_6_API XnStatus ConfigureDevice36FromINI(const XnChar* strIniFileName, const XnChar* strSectionName, XnVStreamContainer* pInitializer);
XN_3_6_API XnStatus ConfigureFromOldINIFileAndOpen(const XnChar* cpINIFileName, const XnChar* cpINISectionName);
XN_3_6_API XnStatus ConfigureAGCDepthBinFromOldINIFile(const XnChar* cpINIFileName, const XnChar* cpINISectionName, XnUInt32 nBin, XnBool bMax);
XN_3_6_API XnStatus GetModuleIntProperty36(const XnChar* Module, const XnChar* Property, XnInt32* pnValue, XnBool bAllowModuleDontExist = FALSE, XnInt32 nValueIfOff = 0) const;
XN_3_6_API XnStatus CheckAudioStreamProperties36() const;
XN_3_6_API XnStatus InitS2DTables36() const;
XN_3_6_API XnStatus GetProperty36(const XnChar* strModule, const XnChar* strProperty, XnDouble& fValue) const;
static void XN_CALLBACK_TYPE OnS2DTableChanged36(XnDeviceHandle pDeviceHandle, const XnChar* ModuleName, const XnChar* PropertyName, void* pCookie);
static void XN_CALLBACK_TYPE OnNewStreamDataCallback36(XnDeviceHandle pDeviceHandle, const XnChar* StreamName, void* pCookie);
};
#pragma warning (pop)
#endif //_XNV_DEVICE_H_
|