ManifestHal.h revision c54d32cb0b20308a0ecea7864016a2a5dc512f71
1/*
2 * Copyright (C) 2017 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
18#ifndef ANDROID_VINTF_MANIFEST_HAL_H
19#define ANDROID_VINTF_MANIFEST_HAL_H
20
21#include <string>
22#include <vector>
23#include <map>
24
25#include "HalFormat.h"
26#include "ImplLevel.h"
27#include "ManifestHalInterface.h"
28#include "TransportArch.h"
29#include "Version.h"
30
31namespace android {
32namespace vintf {
33
34struct HalImplementation {
35    ImplLevel implLevel = ImplLevel::EMPTY;
36    std::string impl;
37};
38
39// A component of HalManifest.
40struct ManifestHal {
41
42    bool operator==(const ManifestHal &other) const;
43
44    HalFormat format = HalFormat::HIDL;
45    std::string name;
46    std::vector<Version> versions;
47    HalImplementation impl;
48    TransportArch transportArch;
49    std::map<std::string, ManifestHalInterface> interfaces;
50
51private:
52    friend struct LibVintfTest;
53    friend struct ManifestHalConverter;
54    friend struct HalManifest;
55    friend bool parse(const std::string &s, ManifestHal *hal);
56
57    // Whether this hal is a valid one. Note that an empty ManifestHal
58    // (constructed via ManifestHal()) is valid.
59    bool isValid() const;
60};
61
62} // namespace vintf
63} // namespace android
64
65#endif // ANDROID_VINTF_MANIFEST_HAL_H
66