blob: 55d84c930a77a465b349a59448db2a11a10a1fc6 [file] [log] [blame]
Ari Hausman-Cohen73442152016-06-08 15:50:49 -07001/*
2 * Copyright 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// Modified from hardware/libhardware/modules/camera/CameraHAL.h
18
19#ifndef V4L2_CAMERA_HAL_H
20#define V4L2_CAMERA_HAL_H
21
22#include <vector>
23
24#include <hardware/camera_common.h>
25#include <hardware/hardware.h>
26
27#include "Camera.h"
28#include "Common.h"
29
30namespace v4l2_camera_hal {
31/*
32 * V4L2CameraHAL contains all module state that isn't specific to an
33 * individual camera device. This class is based off of the sample
34 * default CameraHAL from /hardware/libhardware/modules/camera.
35 */
36class V4L2CameraHAL {
37public:
38 V4L2CameraHAL();
39 ~V4L2CameraHAL();
40
41 // Camera Module Interface (see <hardware/camera_common.h>).
42 int getNumberOfCameras();
43 int getCameraInfo(int camera_id, camera_info_t* info);
44 int setCallbacks(const camera_module_callbacks_t* callbacks);
45 void getVendorTagOps(vendor_tag_ops_t* ops);
46 int openLegacy(const hw_module_t* module, const char* id,
47 uint32_t halVersion, hw_device_t** device);
48 int setTorchMode(const char* camera_id, bool enabled);
49
50 // Hardware Module Interface (see <hardware/hardware.h>).
Ari Hausman-Cohen63f69822016-06-10 11:40:35 -070051 int openDevice(const hw_module_t* mod, const char* name, hw_device_t** dev);
Ari Hausman-Cohen73442152016-06-08 15:50:49 -070052
53private:
54 // Vector of cameras.
55 std::vector<std::unique_ptr<default_camera_hal::Camera>> mCameras;
56 // Callback handle.
57 const camera_module_callbacks_t *mCallbacks;
58
59 DISALLOW_COPY_AND_ASSIGN(V4L2CameraHAL);
60};
61
62} // namespace v4l2_camera_hal
63
64extern camera_module_t HAL_MODULE_INFO_SYM;
65
66#endif // V4L2_CAMERA_HAL_H