<blockquote id="76sxc"></blockquote>
<cite id="76sxc"><track id="76sxc"></track></cite>
<legend id="76sxc"></legend>

  • <blockquote id="76sxc"><p id="76sxc"></p></blockquote>
    <sub id="76sxc"><p id="76sxc"></p></sub>

          C++ 多機同步示例代碼-Multi Device Sync

          # 多設(shè)備同步示例-MultiDeviceSync

          功能描述:演示多設(shè)備同步操作。

           

          >本示例基于C++ low Level API進(jìn)行演示

           

          配置程序模式

          std::cout << "Please select options: " << std::endl;
          std::cout << " 0 --> config devices" << std::endl;
          std::cout << " 1 --> start stream" << std::endl;
          std::cout << "input: ";
          int index = -1;
          std::cin >> index;

           

          配置多設(shè)備同步

          exitValue = configMultiDeviceSync();

           

          區(qū)分主從設(shè)備

          streamDevList.clear();
          // Query the list of connected devices
          auto devList = context.queryDeviceList();

          // Get the number of connected devices
          int devCount = devList->deviceCount();
          for(int i = 0; i < devCount; i++) {
              streamDevList.push_back(devList->getDevice(i));
          }

          if(streamDevList.empty()) {
              std::cerr << "Device list is empty. please check device connection state" << std::endl;
              return -1;
          }

          // traverse the device list and create the device
          std::vector<std::shared_ptr<ob::Device>> primary_devices;
          std::vector<std::shared_ptr<ob::Device>> secondary_devices;
          for(auto dev: streamDevList) {
              auto config = dev->getMultiDeviceSyncConfig();
              if(config.syncMode == OB_MULTI_DEVICE_SYNC_MODE_PRIMARY) {
                  primary_devices.push_back(dev);
              }
              else {
                  secondary_devices.push_back(dev);
              }
          }

           

          開啟從設(shè)備

          std::cout << "Secondary devices start..." << std::endl;
          int deviceIndex = 0;  // Sencondary device display first
          for(auto itr = secondary_devices.begin(); itr != secondary_devices.end(); itr++) {
              auto depthHolder = createPipelineHolder(*itr, OB_SENSOR_DEPTH, deviceIndex);
              pipelineHolderList.push_back(depthHolder);
              startStream(depthHolder);

              auto colorHolder = createPipelineHolder(*itr, OB_SENSOR_COLOR, deviceIndex);
              pipelineHolderList.push_back(colorHolder);
              startStream(colorHolder);

              deviceIndex++;
          }

           

          開啟主設(shè)備

          std::cout << "Primary device start..." << std::endl;
          deviceIndex = secondary_devices.size();  // Primary device display after primary devices.
          for(auto itr = primary_devices.begin(); itr != primary_devices.end(); itr++) {
              auto depthHolder = createPipelineHolder(*itr, OB_SENSOR_DEPTH, deviceIndex);
              startStream(depthHolder);
              pipelineHolderList.push_back(depthHolder);

              auto colorHolder = createPipelineHolder(*itr, OB_SENSOR_COLOR, deviceIndex);
              startStream(colorHolder);
              pipelineHolderList.push_back(colorHolder);

              deviceIndex++;
          }

           

          設(shè)置多設(shè)備同步間隔時間

          // Start the multi-device time synchronization function
          context.enableDeviceClockSync(3600000);  // update and sync every hour

           

          進(jìn)行多設(shè)備測試

          testMultiDeviceSync();

           

          關(guān)閉數(shù)據(jù)流

          // close data stream
          for(auto itr = pipelineHolderList.begin(); itr != pipelineHolderList.end(); itr++) {
              stopStream(*itr);
          }


          <blockquote id="76sxc"></blockquote>
          <cite id="76sxc"><track id="76sxc"></track></cite>
          <legend id="76sxc"></legend>

        1. <blockquote id="76sxc"><p id="76sxc"></p></blockquote>
          <sub id="76sxc"><p id="76sxc"></p></sub>

                午夜精品一区二区三区在线视频 | 色婷婷6月亚洲色婷婷 | 日本精品视频在线播放 | 亚洲欧美在线精品 | 天堂91视频 | 亚洲精品爆乳毛片 | 国产精品 在线播放 | 黄视频在线观看国产 | 艳女十八式淫 | 婷婷五月狠狠 |