OrbbecSDK  1.0.0
Device.hpp
浏览该文件的文档.
1 
6 #pragma once
7 #include "Types.hpp"
8 
9 #include <memory>
10 #include <string>
11 
12 struct DeviceImpl;
13 struct DeviceInfoImpl;
14 struct DeviceListImpl;
15 
16 namespace ob {
17 class SensorList;
18 class Context;
19 class DeviceInfo;
20 class Sensor;
21 
22 class OB_EXTENSION_API Device {
23 private:
24  std::unique_ptr< DeviceImpl > impl_;
25 
26 public:
30  Device( std::unique_ptr< DeviceImpl > impl );
31  virtual ~Device();
37  std::shared_ptr< DeviceInfo > getDeviceInfo();
38 
44  std::shared_ptr< SensorList > getSensorList();
45 
52  std::shared_ptr< Sensor > getSensor( OBSensorType type );
59  void setIntProperty( OBGlobalUnifiedProperty propertyId, int32_t property );
60 
67  void setFloatProperty( OBGlobalUnifiedProperty propertyId, float property );
68 
75  void setBoolProperty( OBGlobalUnifiedProperty propertyId, bool property );
76 
83  int32_t getIntProperty( OBGlobalUnifiedProperty propertyId );
84 
91  float getFloatProperty( OBGlobalUnifiedProperty propertyId );
92 
99  bool getBoolProperty( OBGlobalUnifiedProperty propertyId );
100 
107  OBIntPropertyRange getIntPropertyRange( OBGlobalUnifiedProperty propertyId );
108 
115  OBFloatPropertyRange getFloatPropertyRange( OBGlobalUnifiedProperty propertyId );
116 
123  OBBoolPropertyRange getBoolPropertyRange( OBGlobalUnifiedProperty propertyId );
124 
132  void writeAHB( uint32_t reg, uint32_t mask, uint32_t value );
133 
141  void readAHB( uint32_t reg, uint32_t mask, uint32_t* value );
142 
151  void writeI2C( uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t value );
152 
161  void readI2C( uint32_t moduleId, uint32_t reg, uint32_t mask, uint32_t* value );
162 
173  bool writeFlash( uint32_t offset, const void* data, uint32_t dataSize, SetDataCallback callback, bool async = false );
174 
185  bool readFlash( uint32_t offset, uint32_t dataSize, GetDataCallback callback, bool async = false );
186 
197  bool setRawData( OBGlobalUnifiedProperty propertyId, const void* data, uint32_t dataSize, SetDataCallback callback, bool async = false );
198 
209  bool getRawData( OBGlobalUnifiedProperty propertyId, GetDataCallback callback, bool async = false );
210 
218  void setStructuredData( OBGlobalUnifiedProperty propertyId, const void* data, uint32_t dataSize );
219 
227  void getStructuredData( OBGlobalUnifiedProperty propertyId, void* data, uint32_t* dataSize );
228 
236  bool isPropertySupported( OBGlobalUnifiedProperty propertyId );
237 
243  uint64_t syncDeviceTime();
244 
253  bool deviceUpgrade( const char* filePath, DeviceUpgradeCallback callback, bool async = true );
254 
264  bool sendFile( const char* filePath, const char* dstPath, SendFileCallback callback, bool async = true );
265 
270  OBDeviceState getDeviceState();
271 
277  void setDeviceStateChangedCallback( DeviceStateChangedCallback callback );
278 
284  bool activateAuthorization( const char* authCode );
285 
290  void writeAuthorizationCode( const char* authCodeStr );
291 
298  OBCameraIntrinsic getCameraIntrinsic( OBSensorType sensorType );
299 
306  OBCameraDistortion getCameraDistortion( OBSensorType sensorType );
307 
313  OBD2CTransform getD2CTransform();
314 
315  friend class Pipeline;
316 };
317 
323 class OB_EXTENSION_API DeviceInfo {
324 private:
325  std::unique_ptr< DeviceInfoImpl > impl_;
326 
327 public:
328  DeviceInfo( std::unique_ptr< DeviceInfoImpl > impl );
329  virtual ~DeviceInfo();
335  const char* name();
341  int pid();
347  int vid();
353  const char* uid();
359  const char* serialNumber();
365  const char* firmwareVersion();
366 
372  const char* usbType();
373 
374  friend class Context;
375  friend class DeviceList;
376 };
377 
378 class OB_EXTENSION_API DeviceList {
379 private:
380  std::unique_ptr< DeviceListImpl > impl_;
381 
382 public:
383  DeviceList( std::unique_ptr< DeviceListImpl > impl );
384  virtual ~DeviceList();
385 
391  uint32_t deviceCount();
392 
399  const char* name( uint32_t index );
406  int pid( uint32_t index );
413  int vid( uint32_t index );
420  const char* uid( uint32_t index );
421 
428  std::shared_ptr< Device > getDevice( uint32_t index );
429 };
430 } // namespace ob
std::function< void(OBDataTranState state, uint8_t percent) > SetDataCallback
设置raw data属性数据时进度回调
Definition: Types.hpp:38
OBGlobalUnifiedProperty
描述设备所有的属性的枚举值
Definition: ObTypes.h:69
std::function< void(OBDataTranState state, OBDataChunk *dataChunk) > GetDataCallback
获取raw data属性数据时数据及进度回调
Definition: Types.hpp:30
Definition: Context.hpp:15
提供SDK的结构体、枚举常量定义(依赖libobsensor/h/ObTypes.h)
描述设备信息的类,代表一个RGBD相机的名称,id,序列号等其他设备自身基本信息。
Definition: Device.hpp:323