Multi-Sensor Developing Guide
In some cases your project may require more than one sensor scanning at once. To accomplish this use case we have upgraded Structure Core firmware 1.0+ and Structure SDK (Cross-Platform) 0.8.0+, we’ve added support for multiple, simultaneous captureSession objects. A new deviceManager is introduced to create and manage all the captureSession objects. When deviceManager is initialized, it will start listening to all connected devices and create a captureSession object for each. A user-defined delegate class will define how to process sensor events and streaming data.
Multi-Sensor implementation example snippet
First of all, create and initialize a ST::DeviceManager structure to listen to sensor activity. You will need to define and hook your own delegate class to the device manager object. The implementation of delegate class will be addressed later.
As long as the initialize function is called, the device manager starts listening and will report the sensor status through the delegated class.
Delegate Member Function Fill-in
In the delegate class. The ST::CaptureSession* parameter is used to identify which sensor is working. We will need to store it for accessing sensor information or some later usage. Just capture the ST::CaptureSessionEventId::Detected and store the captureSession allocated by device manager.
Another event you need to handle is ST::CaptureSessionEventId::Connected. It notifies the application that the sensor is ready to stream. You can call startStreaming() here to kick off the streaming.
Here is an example to process streaming data in delegate class:
As soon as the captureSession can be accessed, follow the normal sequence to set up and start monitoring for each captureSession object before starting streaming. NOTE: This needs to be done to receive ST::CaptureSessionEventId::Connected event.