1 /*
2  * Copyright (c) 2020 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 #ifndef CAMERA_SERVER_H
16 #define CAMERA_SERVER_H
17 
18 #include "camera_service.h"
19 #include "ipc_skeleton.h"
20 #include "camera_ability.h"
21 
22 namespace OHOS {
23 namespace Media {
24 class CameraServer {
25 public:
26     static CameraServer *GetInstance();
~CameraServer()27     ~CameraServer() {}
28 
29     static void CameraServerRequestHandle(int funcId, void *origin, IpcIo *req, IpcIo *reply);
30     void InitCameraServer();
31     void GetCameraAbility(IpcIo *req, IpcIo *reply);
32     void GetCameraInfo(IpcIo *req, IpcIo *reply);
33     void GetCameraIdList(IpcIo *req, IpcIo *reply);
34     void CreateCamera(IpcIo *req, IpcIo *reply);
35     void CloseCamera(IpcIo *req, IpcIo *reply);
36     void SetCameraConfig(IpcIo *req, IpcIo *reply);
37     void SetFrameConfig(IpcIo *req, IpcIo *reply);
38     void TriggerLoopingCapture(IpcIo *req, IpcIo *reply);
39     void StopLoopingCapture(IpcIo *req, IpcIo *reply);
40     void TriggerSingleCapture(IpcIo *req, IpcIo *reply);
41     void SetCameraCallback(IpcIo *req, IpcIo *reply);
42     void OnTriggerSingleCaptureFinished(int32_t ret);
43     void OnTriggerLoopingCaptureFinished(int32_t ret, int32_t streamId);
44     void OnCameraStatusChange(int32_t ret, SvcIdentity *sid);
45     void OnCameraConfigured(int32_t ret);
46     void GetCameraModeNum(IpcIo *req, IpcIo *reply);
47     void SetCameraMode(IpcIo *req, IpcIo *reply);
48 private:
CameraServer()49     CameraServer()
50     {
51         sid_.cookie = 0;
52     }
53     SvcIdentity sid_;
54 };
55 } // namespace Media
56 } // namespace OHOS
57 #endif // CAMERA_SERVER_H
58