未验证 提交 5ca1ca31 编写于 作者: Z Zhangzi 提交者: Gitee

update zh-cn/device-dev/driver/driver-peripherals-camera-des.md.

接口函数优化
Signed-off-by: NZhangzi <zhangjiaxiang7@huawei.com>
上级 3e87c151
......@@ -47,76 +47,76 @@ Camera模块主要用以相机预览、拍照、视频流等场景下对相机
### 接口说明<a name="6"></a>
注:以下接口名称列的内容为C++接口原型(camera设备操作API的路径为:/drivers/peripheral/camera/hal/hdi_impl/src/)
注:以下接口列举的为IDL接口描述生成的对应C++语言函数接口,接口声明见idl文件。
- drivers/interface/camera/v1_0/ICameraDevice.idl
| 功能描述 | 接口名称 |
| ---------------------------- | ------------------------------------------------------------ |
| 获取流控制器 | CamRetCode GetStreamOperator(<br>const OHOS::sptr<IStreamOperatorCallback> &callback,<br>OHOS::sptr<IStreamOperator> &streamOperator) |
| 更新设备控制参数 | CamRetCode UpdateSettings(const std::shared_ptr<CameraSetting> &settings) |
| 设置Result回调模式和回调函数 | CamRetCode SetResultMode(const ResultCallbackMode &mode) |
| 获取使能的ResultMeta | CamRetCode GetEnabledResults(std::vector<MetaType> &results) |
| 使能具体的ResultMeta | CamRetCode EnableResult(const std::vector<MetaType> &results) |
| 禁止具体的ResultMeta | CamRetCode DisableResult(const std::vector<MetaType> &results) |
| 关闭Camera设备 | void Close() |
| 获取流控制器 | int32_t GetStreamOperator(const sptr<IStreamOperatorCallback>& callbackObj,<br>sptr<IStreamOperator>& streamOperator) |
| 更新设备控制参数 | int32_t UpdateSettings(const std::vector<uint8_t>& settings) |
| 设置Result回调模式和回调函数 | int32_t SetResultMode(ResultCallbackMode mode) |
| 获取使能的ResultMeta | int32_t GetEnabledResults(std::vector<int32_t>& results) |
| 使能具体的ResultMeta | int32_t EnableResult(const std::vector<int32_t>& results) |
| 禁止具体的ResultMeta | int32_t DisableResult(const std::vector<int32_t>& results) |
| 关闭Camera设备 | int32_t Close() |
- drivers/interface/camera/v1_0/ICameraDeviceCallback.idl
| 功能描述 | 接口名称 |
| ---------------------------------------------------------- | ------------------------------------------------------------ |
| 设备发生错误时调用,由调用者实现,用于返回错误信息给调用者 | void OnError(ErrorType type, int32_t errorCode) |
| 上报camera设备相关的metadata的回调 | void OnResult(uint64_t timestamp, const std::shared_ptr<CameraMetadata> &result) |
| 设备发生错误时调用,由调用者实现,用于返回错误信息给调用者 | int32_t OnError(ErrorType type, int32_t errorCode) |
| 上报camera设备相关的metadata的回调 | int32_t OnResult(uint64_t timestamp, const std::vector<uint8_t>& result) |
- drivers/interface/camera/v1_0/ICameraHost.idl
| 功能描述 | 接口名称 |
| ------------------------------ | ------------------------------------------------------------ |
| 设置ICameraHost回调接口 | CamRetCode SetCallback(const OHOS::sptr<ICameraHostCallback> &callback) |
| 获取当前可用的Camera设备ID列表 | CamRetCode GetCameraIds(std::vector\<std::string\> &cameraIds) |
| 获取Camera设备能力集合 | CamRetCode GetCameraAbility(const std::string &cameraId, std::shared_ptr<CameraAbility> &ability) |
| 打开Camera设备 | CamRetCode OpenCamera(const std::string &cameraId,<br>const OHOS::sptr<ICameraDeviceCallback> &callback,<br>OHOS::sptr<ICameraDevice> &device) |
| 打开或关闭闪光灯 | CamRetCode SetFlashlight(const std::string &cameraId, bool &isEnable) |
| 设置ICameraHost回调接口 | int32_t SetCallback(const sptr<ICameraHostCallback>& callbackObj) |
| 获取当前可用的Camera设备ID列表 | int32_t GetCameraIds(std::vector<std::string> &cameraIds) |
| 获取Camera设备能力集合 | int32_t GetCameraAbility(const std::string &cameraId, std::vector<uint8_t>& cameraAbility) |
| 打开Camera设备 | int32_t OpenCamera(const std::string& cameraId,<br>const sptr<ICameraDeviceCallback>& callbackObj,<br>sptr<ICameraDevice>& device) |
| 打开或关闭闪光灯 | int32_t SetFlashlight(const std::string &cameraId, bool isEnable) |
- drivers/interface/camera/v1_0/ICameraHostCallback.idl
| 功能描述 | 接口名称 |
| ---------------------- | ------------------------------------------------------------ |
| Camera设备状态变化上报 | void OnCameraStatus(const std::string &cameraId, CameraStatus status) |
| 闪光灯状态变化回调 | void OnFlashlightStatus(const std::string &cameraId, FlashlightStatus status) |
| Camera设备状态变化上报 | int32_t OnCameraStatus(const std::string &cameraId, CameraStatus status) |
| 闪光灯状态变化回调 | int32_t OnFlashlightStatus(const std::string &cameraId, FlashlightStatus status) |
- drivers/interface/camera/v1_0/IOfflineStreamOperator.idl
| 功能描述 | 接口名称 |
| -------------- | ------------------------------------------------------------ |
| 取消捕获请求 | CamRetCode CancelCapture(int captureId) |
| 释放流 | CamRetCode ReleaseStreams(const std::vector<int> &streamIds) |
| 释放所有离线流 | CamRetCode Release() |
| 取消捕获请求 | int32_t CancelCapture(int32_t captureId) |
| 释放流 | int32_t ReleaseStreams(const std::vector<int32_t>& streamIds) |
| 释放所有离线流 | RetCode Release() |
- drivers/interface/camera/v1_0/IStreamOperator.idl
| 功能描述 | 接口名称 |
| -------------------------------- | ------------------------------------------------------------ |
| 查询是否支持添加参数对应的流 | CamRetCode IsStreamsSupported(<br>OperationMode mode,<br>const std::shared_ptr\<Camera::CameraMetadata\> &modeSetting,<br>const std::vector&ltstd::shared_ptr&ltStreamInfo&gt> &info,<br>StreamSupportType &type) |
| 创建流 | CamRetCode CreateStreams(const std::vector<std::shared_ptr<StreamInfo>> &streamInfos) |
| 释放流 | CamRetCode ReleaseStreams(const std::vector<int> &streamIds) |
| 配置流 | CamRetCode CommitStreams(OperationMode mode, const std::shared_ptr<CameraMetadata> &modeSetting) |
| 获取流的属性 | CamRetCode GetStreamAttributes(std::vector<std::shared_ptr<StreamAttribute>> &attributes) |
| 绑定生产者句柄和指定流 | CamRetCode AttachBufferQueue(int streamId, const OHOS::sptr\<OHOS::IBufferProducer\> &producer) |
| 解除生产者句柄和指定流的绑定关系 | CamRetCode DetachBufferQueue(int streamId) |
| 捕获图像 | CamRetCode Capture(int captureId, const std::shared_ptr<CaptureInfo> &info, bool isStreaming) |
| 取消捕获 | CamRetCode CancelCapture(int captureId) |
| 将指定流转换成离线流 | CamRetCode ChangeToOfflineStream(const std::vector<int> &streamIds,<br>OHOS::sptr<IStreamOperatorCallback> &callback,<br>OHOS::sptr<IOfflineStreamOperator> &offlineOperator) |
| 查询是否支持添加参数对应的流 | int32_t IsStreamsSupported(<br>OperationMode mode,<br>const std::vector<uint8_t>& modeSetting,<br>const std::vector<StreamInfo>& infos,<br>StreamSupportType& type) |
| 创建流 | int32_t CreateStreams(const std::vector<StreamInfo>& streamInfos) |
| 释放流 | int32_t ReleaseStreams(const std::vector<int32_t>& streamIds) |
| 配置流 | int32_t CommitStreams(OperationMode mode, const std::shared_ptr<CameraMetadata> &modeSetting) |
| 获取流的属性 | int32_t GetStreamAttributes(std::vector<StreamAttribute>& attributes) |
| 绑定生产者句柄和指定流 | int32_t AttachBufferQueue(int32_t streamId, const sptr<BufferProducerSequenceable>& bufferProducer) |
| 解除生产者句柄和指定流的绑定关系 | int32_t DetachBufferQueue(int32_t streamId) |
| 捕获图像 | int32_t Capture(int32_t captureId, const CaptureInfo& info, bool isStreaming) |
| 取消捕获 | int32_t CancelCapture(int32_t captureId) |
| 将指定流转换成离线流 | int32_t ChangeToOfflineStream(const std::vector<int32_t>& streamIds,<br>const sptr<IStreamOperatorCallback>& callbackObj,<br>sptr<IOfflineStreamOperator>& offlineOperator) |
- drivers/interface/camera/v1_0/IStreamOperatorCallback.idl
| 功能描述 | 接口名称 |
| ---------------------------------------- | ------------------------------------------------------------ |
| 捕获开始回调,在捕获开始时调用 | void OnCaptureStarted(int32_t captureId, const std::vector<int32_t> &streamIds) |
| 捕获结束回调,在捕获结束时调用 | void OnCaptureEnded(int32_t captureId, const std::vector<std::shared_ptr<CaptureEndedInfo>> &infos) |
| 捕获错误回调,在捕获过程中发生错误时调用 | void OnCaptureError(int32_t captureId, const std::vector<std::shared_ptr<CaptureErrorInfo>> &infos) |
| 帧捕获回调 | void OnFrameShutter(int32_t captureId,<br>const std::vector<int32_t> &streamIds, uint64_t timestamp) |
| 捕获开始回调,在捕获开始时调用 | void OnCaptureStarted(int32_t captureId, const std::vector<int32_t>& streamIds) |
| 捕获结束回调,在捕获结束时调用 | void OnCaptureEnded(int32_t captureId, const std::vector<CaptureEndedInfo>& infos) |
| 捕获错误回调,在捕获过程中发生错误时调用 | void OnCaptureError(int32_t captureId, const std::vector<CaptureErrorInfo>& infos) |
| 帧捕获回调 | void OnFrameShutter(int32_t captureId,<br>const std::vector<int32_t>& streamIds, uint64_t timestamp) |
### 开发步骤<a name="7"></a>
Camera驱动的开发过程主要包含以下步骤:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册