blob: 3ded4c46c20eae450840e59987e1118e1ac720d5 [file] [log] [blame]
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -07001/*
2 * Copyright (C) 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#ifndef V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
18#define V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
19
20#include "../common.h"
Ari Hausman-Cohene55f0c72016-08-05 15:49:22 -070021#include "metadata_common.h"
Ari Hausman-Cohenfd0ecb72016-08-12 15:45:25 -070022#include "partial_metadata_interface.h"
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -070023
24namespace v4l2_camera_hal {
25
26// A Property is a PartialMetadata that only has a single static tag.
27template <typename T>
Ari Hausman-Cohenfd0ecb72016-08-12 15:45:25 -070028class Property : public PartialMetadataInterface {
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -070029 public:
Ari Hausman-Cohenffdc6282016-08-19 12:54:22 -070030 Property(int32_t tag, T value) : tag_(tag), value_(std::move(value)){};
Ari Hausman-Cohenfd0ecb72016-08-12 15:45:25 -070031
32 virtual std::vector<int32_t> StaticTags() const override { return {tag_}; };
33
34 virtual std::vector<int32_t> ControlTags() const override { return {}; };
35
36 virtual std::vector<int32_t> DynamicTags() const override { return {}; };
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -070037
38 virtual int PopulateStaticFields(
39 android::CameraMetadata* metadata) const override {
40 HAL_LOG_ENTER();
Ari Hausman-Cohenfd0ecb72016-08-12 15:45:25 -070041 return UpdateMetadata(metadata, tag_, value_);
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -070042 };
43
44 virtual int PopulateDynamicFields(
45 android::CameraMetadata* metadata) const override {
46 HAL_LOG_ENTER();
47 return 0;
48 };
49
50 virtual bool SupportsRequestValues(
51 const android::CameraMetadata& metadata) const override {
52 HAL_LOG_ENTER();
53 return true;
54 };
55
56 virtual int SetRequestValues(
57 const android::CameraMetadata& metadata) override {
58 HAL_LOG_ENTER();
59 return 0;
60 };
61
Ari Hausman-Cohenfd0ecb72016-08-12 15:45:25 -070062 private:
63 int32_t tag_;
64 T value_;
Ari Hausman-Cohen407cca92016-08-02 11:03:15 -070065};
66
67} // namespace v4l2_camera_hal
68
69#endif // V4L2_CAMERA_HAL_METADATA_PROPERTY_H_