Add stream requests
This commit is contained in:
		
							parent
							
								
									3e56de0a45
								
							
						
					
					
						commit
						f1b480e4c3
					
				@ -113,6 +113,14 @@ void Device::SetMotionCallback(motion_callback_t callback) {
 | 
				
			|||||||
  motion_callback_ = callback;
 | 
					  motion_callback_ = callback;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					StreamRequest Device::GetStreamRequest(const Capabilities &capability) const {
 | 
				
			||||||
 | 
					  if (!Supports(capability)) {
 | 
				
			||||||
 | 
					    LOG(FATAL) << "Unsupported capability: " << to_string(capability);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  auto &&requests = stream_requests_map.at(Model::STANDARD);
 | 
				
			||||||
 | 
					  return requests.at(capability);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Device::ReadDeviceInfo() {
 | 
					void Device::ReadDeviceInfo() {
 | 
				
			||||||
  // TODO(JohnZhao): Read device info
 | 
					  // TODO(JohnZhao): Read device info
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -63,6 +63,8 @@ class Device {
 | 
				
			|||||||
    return device_info_;
 | 
					    return device_info_;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  StreamRequest GetStreamRequest(const Capabilities &capability) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 private:
 | 
					 private:
 | 
				
			||||||
  Model model_;
 | 
					  Model model_;
 | 
				
			||||||
  std::shared_ptr<uvc::device> device_;
 | 
					  std::shared_ptr<uvc::device> device_;
 | 
				
			||||||
 | 
				
			|||||||
@ -15,4 +15,7 @@ const std::map<Model, OptionSupports> option_supports_map = {
 | 
				
			|||||||
      Option::MAX_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
 | 
					      Option::MAX_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
 | 
				
			||||||
      Option::HDR_MODE, Option::ZERO_DRIFT_CALIBRATION, Option::ERASE_CHIP}}};
 | 
					      Option::HDR_MODE, Option::ZERO_DRIFT_CALIBRATION, Option::ERASE_CHIP}}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const std::map<Model, StreamRequests> stream_requests_map = {
 | 
				
			||||||
 | 
					    {Model::STANDARD, {{Capabilities::STEREO, {752, 480, Format::YUYV, 25}}}}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MYNTEYE_END_NAMESPACE
 | 
					MYNTEYE_END_NAMESPACE
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <map>
 | 
					#include <map>
 | 
				
			||||||
#include <set>
 | 
					#include <set>
 | 
				
			||||||
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "mynteye/mynteye.h"
 | 
					#include "mynteye/mynteye.h"
 | 
				
			||||||
#include "mynteye/types.h"
 | 
					#include "mynteye/types.h"
 | 
				
			||||||
@ -18,6 +19,10 @@ extern const std::map<Model, StreamSupports> stream_supports_map;
 | 
				
			|||||||
extern const std::map<Model, CapabilitiesSupports> capabilities_supports_map;
 | 
					extern const std::map<Model, CapabilitiesSupports> capabilities_supports_map;
 | 
				
			||||||
extern const std::map<Model, OptionSupports> option_supports_map;
 | 
					extern const std::map<Model, OptionSupports> option_supports_map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using StreamRequests = std::map<Capabilities, StreamRequest>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern const std::map<Model, StreamRequests> stream_requests_map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MYNTEYE_END_NAMESPACE
 | 
					MYNTEYE_END_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // MYNTEYE_INTERNAL_CONFIG_H_ NOLINT
 | 
					#endif  // MYNTEYE_INTERNAL_CONFIG_H_ NOLINT
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user