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 OHOS_CAMERA_SERVICE_H
16 #define OHOS_CAMERA_SERVICE_H
17 
18 #include "camera_device.h"
19 #include "camera_service_callback.h"
20 #include "camera_ability.h"
21 #include "camera_info_impl.h"
22 
23 namespace OHOS {
24 namespace Media {
25 class CameraService {
26 public:
27     ~CameraService();
28     static CameraService *GetInstance();
29 
30     void Initialize();
31     CameraAbility *GetCameraAbility(std::string &cameraId);
32     CameraInfo *GetCameraInfo(std::string &cameraId);
33     CameraDevice *GetCameraDevice(std::string &cameraId);
34     int32_t CreateCamera(std::string cameraId);
35     int32_t CloseCamera(string cameraId);
36     list<string> GetCameraIdList();
37     uint8_t GetCameraModeNum();
38     int32_t SetCameraMode(uint8_t modeIndex);
39 private:
40     CameraService();
41     int32_t InitCameraDevices();
42     std::map<string, CameraDevice*> deviceMap_;
43     std::map<string, CameraAbility*> deviceAbilityMap_;
44     std::map<string, CameraInfo*> deviceInfoMap_;
45     CameraServiceCallback *cameraServiceCb_ = nullptr;
46 };
47 } // namespace Media
48 } // namespace OHOS
49 
50 #endif // OHOS_CAMERA_SERVICE_H