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