1 /*
2  * Copyright (c) 2022, 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 CPP_VHAL_CLIENT_INCLUDE_HIDLHALPROPVALUE_H_
18 #define CPP_VHAL_CLIENT_INCLUDE_HIDLHALPROPVALUE_H_
19 
20 #include "IHalPropValue.h"
21 
22 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
23 
24 namespace android {
25 namespace frameworks {
26 namespace automotive {
27 namespace vhal {
28 
29 class HidlHalPropValue : public IHalPropValue {
30 public:
31     explicit HidlHalPropValue(int32_t propId);
32     explicit HidlHalPropValue(
33             ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue&& value);
34     HidlHalPropValue(int32_t propId, int32_t areaId);
35 
36     int32_t getPropId() const override;
37 
38     int32_t getAreaId() const override;
39 
40     int64_t getTimestamp() const override;
41 
42     aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus getStatus() const override;
43 
44     void setInt32Values(const std::vector<int32_t>& values) override;
45 
46     std::vector<int32_t> getInt32Values() const override;
47 
48     void setInt64Values(const std::vector<int64_t>& values) override;
49 
50     std::vector<int64_t> getInt64Values() const override;
51 
52     void setFloatValues(const std::vector<float>& values) override;
53 
54     std::vector<float> getFloatValues() const override;
55 
56     void setByteValues(const std::vector<uint8_t>& values) override;
57 
58     std::vector<uint8_t> getByteValues() const override;
59 
60     void setStringValue(const std::string& value) override;
61 
62     std::string getStringValue() const override;
63 
64     const void* toVehiclePropValue() const override;
65 
66     std::unique_ptr<IHalPropValue> clone() const override;
67 
68 private:
69     ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue mPropValue;
70 };
71 
72 }  // namespace vhal
73 }  // namespace automotive
74 }  // namespace frameworks
75 }  // namespace android
76 
77 #endif  // CPP_VHAL_CLIENT_INCLUDE_HIDLHALPROPVALUE_H_
78