40 #ifndef OPENNI_OPENNI_H_
41 #define OPENNI_OPENNI_H_
47 #include <boost/shared_ptr.hpp>
48 #include <boost/weak_ptr.hpp>
49 #include <XnCppWrapper.h>
53 namespace openni_wrapper
71 ~OpenNIDriver () throw ();
78 inline static OpenNIDriver& getInstance ();
85 unsigned updateDeviceList ();
91 inline
unsigned getNumberDevices () const throw ();
101 boost::shared_ptr<OpenNIDevice> createVirtualDevice (const std::
string& path,
bool repeat,
bool stream) const;
109 boost::shared_ptr<OpenNIDevice> getDeviceByIndex (
unsigned index) const;
117 boost::shared_ptr<OpenNIDevice> getDeviceBySerialNumber (const std::
string& serial_number) const;
127 boost::shared_ptr<OpenNIDevice> getDeviceByAddress (
unsigned char bus,
unsigned char address)
const;
136 const char* getSerialNumber (
unsigned index)
const throw ();
144 const char* getConnectionString (
unsigned index)
const throw ();
152 const char* getVendorName (
unsigned index)
const throw ();
160 const char* getProductName (
unsigned index)
const throw ();
168 unsigned short getVendorID (
unsigned index)
const throw ();
176 unsigned short getProductID (
unsigned index)
const throw ();
184 unsigned char getBus (
unsigned index)
const throw ();
192 unsigned char getAddress (
unsigned index)
const throw ();
208 getDeviceType (
const std::string& connection_string,
unsigned short& vendorId,
unsigned short& productId);
213 DeviceContext (
const xn::NodeInfo& device_node, xn::NodeInfo* image_node, xn::NodeInfo* depth_node, xn::NodeInfo * ir_node);
214 DeviceContext (
const xn::NodeInfo & device_node);
215 DeviceContext (
const DeviceContext&);
216 xn::NodeInfo device_node;
217 boost::shared_ptr<xn::NodeInfo> image_node;
218 boost::shared_ptr<xn::NodeInfo> depth_node;
219 boost::shared_ptr<xn::NodeInfo> ir_node;
220 boost::weak_ptr<OpenNIDevice> device;
224 boost::shared_ptr<OpenNIDevice> getDevice (
unsigned index)
const;
228 void getDeviceInfos () throw ();
231 mutable std::vector<DeviceContext> device_context_;
232 mutable xn::Context context_;
234 std::map< unsigned char, std::map<unsigned char, unsigned > > bus_map_;
235 std::map< std::string, unsigned > serial_map_;
236 std::map< std::string, unsigned > connection_string_map_;
240 OpenNIDriver::getInstance ()
242 static OpenNIDriver driver;
247 OpenNIDriver::getNumberDevices ()
const throw ()
249 return static_cast<unsigned> (device_context_.size ());