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