1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CAMERA_DEVICE_CLIENT_H 17 #define CAMERA_DEVICE_CLIENT_H 18 19 #include "camera_config.h" 20 #include "camera_client.h" 21 #include "iproxy_client.h" 22 #include "media_log.h" 23 #include "ipc_skeleton.h" 24 #include "camera_type.h" 25 26 #include <cstdint> 27 28 namespace OHOS { 29 namespace Media { 30 class CameraImpl; 31 class CameraDeviceClient { 32 public: 33 static CameraDeviceClient *GetInstance(); 34 static int Callback(void* owner, int code, IpcIo *reply); 35 36 ~CameraDeviceClient(); 37 38 int32_t SetCameraConfig(CameraConfig &cc); 39 int32_t TriggerLoopingCapture(FrameConfig &fc); 40 void StopLoopingCapture(int32_t type); 41 int32_t TriggerSingleCapture(FrameConfig &fc); 42 void Release(); 43 44 void SetCameraId(std::string &cameraId); 45 void SetCameraImpl(CameraImpl *cameraImpl); 46 void SetCameraCallback(); 47 static int32_t SurfaceRequestHandler(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option); 48 static int32_t DeviceClientCallback(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option); 49 private: 50 CameraDeviceClient(); 51 CameraClient *cameraClient_ = nullptr; 52 IClientProxy *proxy_ = nullptr; 53 std::string cameraId_; 54 CameraImpl *cameraImpl_ = nullptr; 55 CallBackPara *para_ = nullptr; 56 SvcIdentity sid_; 57 int32_t ret_ = 0; 58 }; 59 } // namespace Media 60 } // namespace OHOS 61 #endif // CAMERA_DEVICE_CLIENT_H