Go to the documentation of this file.
21 #ifndef ONIDRIVERAPI_H
22 #define ONIDRIVERAPI_H
30 namespace oni {
namespace driver {
46 return OniStreamServices::getDefaultRequiredFrameSize(
streamServices);
147 va_start(
args, format);
157 void log(
int severity,
const char* file,
int line,
const char* mask,
const char* message)
211 #define ONI_EXPORT_DRIVER(DriverClass) \
213 oni::driver::DriverBase* g_pDriver = NULL; \
216 ONI_C_API_EXPORT void oniDriverCreate(OniDriverServices* driverServices) { \
217 g_pDriver = XN_NEW(DriverClass, driverServices); \
219 ONI_C_API_EXPORT void oniDriverDestroy() \
221 g_pDriver->shutdown(); \
222 XN_DELETE(g_pDriver); g_pDriver = NULL; \
224 ONI_C_API_EXPORT OniStatus oniDriverInitialize(oni::driver::DeviceConnectedCallback deviceConnectedCallback, \
225 oni::driver::DeviceDisconnectedCallback deviceDisconnectedCallback, \
226 oni::driver::DeviceStateChangedCallback deviceStateChangedCallback, \
229 return g_pDriver->initialize(deviceConnectedCallback, deviceDisconnectedCallback, deviceStateChangedCallback, pCookie); \
232 ONI_C_API_EXPORT OniStatus oniDriverTryDevice(const char* uri) \
234 return g_pDriver->tryDevice(uri); \
238 ONI_C_API_EXPORT oni::driver::DeviceBase* oniDriverDeviceOpen(const char* uri, const char* mode) \
240 return g_pDriver->deviceOpen(uri, mode); \
242 ONI_C_API_EXPORT void oniDriverDeviceClose(oni::driver::DeviceBase* pDevice) \
244 g_pDriver->deviceClose(pDevice); \
247 ONI_C_API_EXPORT OniStatus oniDriverDeviceGetSensorInfoList(oni::driver::DeviceBase* pDevice, OniSensorInfo** pSensorInfos, \
250 return pDevice->getSensorInfoList(pSensorInfos, numSensors); \
253 ONI_C_API_EXPORT oni::driver::StreamBase* oniDriverDeviceCreateStream(oni::driver::DeviceBase* pDevice, \
254 OniSensorType sensorType) \
256 return pDevice->createStream(sensorType); \
259 ONI_C_API_EXPORT void oniDriverDeviceDestroyStream(oni::driver::DeviceBase* pDevice, oni::driver::StreamBase* pStream) \
261 return pDevice->destroyStream(pStream); \
264 ONI_C_API_EXPORT OniStatus oniDriverDeviceSetProperty(oni::driver::DeviceBase* pDevice, int propertyId, \
265 const void* data, int dataSize) \
267 return pDevice->setProperty(propertyId, data, dataSize); \
269 ONI_C_API_EXPORT OniStatus oniDriverDeviceGetProperty(oni::driver::DeviceBase* pDevice, int propertyId, \
270 void* data, int* pDataSize) \
272 return pDevice->getProperty(propertyId, data, pDataSize); \
274 ONI_C_API_EXPORT OniBool oniDriverDeviceIsPropertySupported(oni::driver::DeviceBase* pDevice, int propertyId) \
276 return pDevice->isPropertySupported(propertyId); \
278 ONI_C_API_EXPORT void oniDriverDeviceSetPropertyChangedCallback(oni::driver::DeviceBase* pDevice, \
279 oni::driver::PropertyChangedCallback handler, void* pCookie) \
281 pDevice->setPropertyChangedCallback(handler, pCookie); \
283 ONI_C_API_EXPORT void oniDriverDeviceNotifyAllProperties(oni::driver::DeviceBase* pDevice) \
285 pDevice->notifyAllProperties(); \
287 ONI_C_API_EXPORT OniStatus oniDriverDeviceInvoke(oni::driver::DeviceBase* pDevice, int commandId, \
288 void* data, int dataSize) \
290 return pDevice->invoke(commandId, data, dataSize); \
292 ONI_C_API_EXPORT OniBool oniDriverDeviceIsCommandSupported(oni::driver::DeviceBase* pDevice, int commandId) \
294 return pDevice->isCommandSupported(commandId); \
296 ONI_C_API_EXPORT OniStatus oniDriverDeviceTryManualTrigger(oni::driver::DeviceBase* pDevice) \
298 return pDevice->tryManualTrigger(); \
300 ONI_C_API_EXPORT OniBool oniDriverDeviceIsImageRegistrationModeSupported(oni::driver::DeviceBase* pDevice, \
301 OniImageRegistrationMode mode) \
303 return pDevice->isImageRegistrationModeSupported(mode); \
307 ONI_C_API_EXPORT void oniDriverStreamSetServices(oni::driver::StreamBase* pStream, OniStreamServices* pServices) \
309 pStream->setServices((oni::driver::StreamServices*)pServices); \
312 ONI_C_API_EXPORT OniStatus oniDriverStreamSetProperty(oni::driver::StreamBase* pStream, int propertyId, \
313 const void* data, int dataSize) \
315 return pStream->setProperty(propertyId, data, dataSize); \
317 ONI_C_API_EXPORT OniStatus oniDriverStreamGetProperty(oni::driver::StreamBase* pStream, int propertyId, void* data, \
320 return pStream->getProperty(propertyId, data, pDataSize); \
322 ONI_C_API_EXPORT OniBool oniDriverStreamIsPropertySupported(oni::driver::StreamBase* pStream, int propertyId) \
324 return pStream->isPropertySupported(propertyId); \
326 ONI_C_API_EXPORT void oniDriverStreamSetPropertyChangedCallback(oni::driver::StreamBase* pStream, \
327 oni::driver::PropertyChangedCallback handler, void* pCookie) \
329 pStream->setPropertyChangedCallback(handler, pCookie); \
331 ONI_C_API_EXPORT void oniDriverStreamNotifyAllProperties(oni::driver::StreamBase* pStream) \
333 pStream->notifyAllProperties(); \
335 ONI_C_API_EXPORT OniStatus oniDriverStreamInvoke(oni::driver::StreamBase* pStream, int commandId, \
336 void* data, int dataSize) \
338 return pStream->invoke(commandId, data, dataSize); \
340 ONI_C_API_EXPORT OniBool oniDriverStreamIsCommandSupported(oni::driver::StreamBase* pStream, int commandId) \
342 return pStream->isCommandSupported(commandId); \
345 ONI_C_API_EXPORT OniStatus oniDriverStreamStart(oni::driver::StreamBase* pStream) \
347 return pStream->start(); \
349 ONI_C_API_EXPORT void oniDriverStreamStop(oni::driver::StreamBase* pStream) \
354 ONI_C_API_EXPORT int oniDriverStreamGetRequiredFrameSize(oni::driver::StreamBase* pStream) \
356 return pStream->getRequiredFrameSize(); \
359 ONI_C_API_EXPORT void oniDriverStreamSetNewFrameCallback(oni::driver::StreamBase* pStream, \
360 oni::driver::NewFrameCallback handler, void* pCookie) \
362 pStream->setNewFrameCallback(handler, pCookie); \
365 ONI_C_API_EXPORT OniStatus oniDriverStreamConvertDepthToColorCoordinates(oni::driver::StreamBase* pDepthStream, \
366 oni::driver::StreamBase* pColorStream, int depthX, int depthY, OniDepthPixel depthZ, int* pColorX, int* pColorY) \
368 return pDepthStream->convertDepthToColorCoordinates(pColorStream, depthX, depthY, depthZ, pColorX, pColorY); \
371 ONI_C_API_EXPORT OniStatus oniDriverStreamConvertC2DCoordinates(oni::driver::StreamBase* pDepthStream, \
372 int colorX, int colorY, OniDepthPixel depthZ, int* pDepthX, int* pDepthY) \
374 return pDepthStream->convertC2DCoordinates(colorX, colorY, depthZ, pDepthX, pDepthY); \
377 ONI_C_API_EXPORT OniStatus oniDriverStreamConvertD2CCoordinates(oni::driver::StreamBase* pDepthStream, \
378 int colorX, int colorY, OniDepthPixel depthZ, int* pDepthX, int* pDepthY) \
380 return pDepthStream->convertD2CCoordinates(colorX, colorY, depthZ, pDepthX, pDepthY); \
383 ONI_C_API_EXPORT void* oniDriverEnableFrameSync(oni::driver::StreamBase** pStreams, int streamCount) \
385 return g_pDriver->enableFrameSync(pStreams, streamCount); \
388 ONI_C_API_EXPORT void oniDriverDisableFrameSync(void* frameSyncGroup) \
390 return g_pDriver->disableFrameSync(frameSyncGroup); \
393 #endif // ONIDRIVERAPI_H
void errorLoggerAppend(const char *format,...)
DeviceConnectedCallback m_deviceConnectedEvent
void(ONI_CALLBACK_TYPE * DeviceStateChangedCallback)(const OniDeviceInfo *deviceId, int errorState, void *pCookie)
void raisePropertyChanged(int propertyId, const void *data, int dataSize)
virtual OniStatus getProperty(int, void *, int *)
void(ONI_CALLBACK_TYPE * DeviceDisconnectedCallback)(const OniDeviceInfo *, void *pCookie)
DeviceDisconnectedCallback m_deviceDisconnectedEvent
virtual OniStatus setProperty(int, const void *, int)
DriverServices & getServices()
virtual void * enableFrameSync(StreamBase **, int)
OniDriverServices * m_pDriverServices
virtual OniStatus tryManualTrigger()
void addFrameRef(OniFrame *pFrame)
virtual OniStatus getSensorInfoList(OniSensorInfo **pSensorInfos, int *numSensors)=0
PropertyChangedCallback m_propertyChangedCallback
virtual void setPropertyChangedCallback(PropertyChangedCallback handler, void *pCookie)
virtual OniStatus start()=0
virtual void notifyAllProperties()
int getDefaultRequiredFrameSize()
void log(int severity, const char *file, int line, const char *mask, const char *message)
virtual OniBool isImageRegistrationModeSupported(OniImageRegistrationMode mode)
OniFrame * acquireFrame()
virtual OniBool isPropertySupported(int)
void raiseNewFrame(OniFrame *pFrame)
virtual void setServices(StreamServices *pStreamServices)
void * m_newFrameCallbackCookie
virtual OniBool isPropertySupported(int)
DriverBase(OniDriverServices *pDriverServices)
virtual OniStatus convertD2CCoordinates(int, int, OniDepthPixel, int *, int *)
PropertyChangedCallback m_propertyChangedCallback
void(ONI_CALLBACK_TYPE * PropertyChangedCallback)(void *sender, int propertyId, const void *data, int dataSize, void *pCookie)
@ ONI_IMAGE_REGISTRATION_OFF
void deviceStateChanged(const OniDeviceInfo *pInfo, int errorState)
virtual void notifyAllProperties()
void raisePropertyChanged(int propertyId, const void *data, int dataSize)
OniFrame *ONI_CALLBACK_TYPE * acquireFrame(void *streamServices)
virtual OniStatus convertDepthToColorCoordinates(StreamBase *, int, int, OniDepthPixel, int *, int *)
virtual void destroyStream(StreamBase *pStream)=0
void * m_propertyChangedCookie
DeviceStateChangedCallback m_deviceStateChangedEvent
virtual StreamBase * createStream(OniSensorType)=0
virtual OniStatus invoke(int, void *, int)
DriverServices m_services
virtual OniStatus initialize(DeviceConnectedCallback connectedCallback, DeviceDisconnectedCallback disconnectedCallback, DeviceStateChangedCallback deviceStateChangedCallback, void *pCookie)
virtual OniStatus invoke(int, void *, int)
virtual OniStatus tryDevice(const char *)
DriverServices(OniDriverServices *pDriverServices)
void(ONI_CALLBACK_TYPE * NewFrameCallback)(StreamBase *streamId, OniFrame *, void *pCookie)
NewFrameCallback m_newFrameCallback
virtual int getRequiredFrameSize()
virtual void setPropertyChangedCallback(PropertyChangedCallback handler, void *pCookie)
@ ONI_STATUS_NOT_IMPLEMENTED
void deviceDisconnected(const OniDeviceInfo *pInfo)
virtual DeviceBase * deviceOpen(const char *uri, const char *mode)=0
virtual OniBool isCommandSupported(int)
virtual OniStatus getProperty(int, void *, int *)
StreamServices * m_pServices
void deviceConnected(const OniDeviceInfo *pInfo)
virtual OniStatus setProperty(int, const void *, int)
StreamServices & getServices()
typedef void(ONI_CALLBACK_TYPE *DeviceConnectedCallback)(const OniDeviceInfo *
virtual void shutdown()=0
virtual OniStatus convertC2DCoordinates(int, int, OniDepthPixel, int *, int *)
void * m_propertyChangedCookie
virtual void deviceClose(DeviceBase *pDevice)=0
void releaseFrame(OniFrame *pFrame)
@ ONI_STATUS_NOT_SUPPORTED
virtual void disableFrameSync(void *)
virtual void setNewFrameCallback(NewFrameCallback handler, void *pCookie)
virtual OniBool isCommandSupported(int)