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_IHALPROPVALUE_H_
18 #define CPP_VHAL_CLIENT_INCLUDE_IHALPROPVALUE_H_
19 
20 #include <aidl/android/hardware/automotive/vehicle/VehiclePropValue.h>
21 #include <aidl/android/hardware/automotive/vehicle/VehiclePropertyStatus.h>
22 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
23 
24 #include <cstdint>
25 #include <vector>
26 
27 namespace android {
28 namespace frameworks {
29 namespace automotive {
30 namespace vhal {
31 
32 class IHalPropValue {
33 public:
34     virtual int32_t getPropId() const = 0;
35 
36     virtual int32_t getAreaId() const = 0;
37 
38     virtual int64_t getTimestamp() const = 0;
39 
40     virtual aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus getStatus()
41             const = 0;
42 
43     virtual void setInt32Values(const std::vector<int32_t>& values) = 0;
44 
45     virtual std::vector<int32_t> getInt32Values() const = 0;
46 
47     virtual void setInt64Values(const std::vector<int64_t>& values) = 0;
48 
49     virtual std::vector<int64_t> getInt64Values() const = 0;
50 
51     virtual void setFloatValues(const std::vector<float>& values) = 0;
52 
53     virtual std::vector<float> getFloatValues() const = 0;
54 
55     virtual void setByteValues(const std::vector<uint8_t>& values) = 0;
56 
57     virtual std::vector<uint8_t> getByteValues() const = 0;
58 
59     virtual void setStringValue(const std::string& value) = 0;
60 
61     virtual std::string getStringValue() const = 0;
62 
63     virtual const void* toVehiclePropValue() const = 0;
64 
65     virtual ~IHalPropValue() = default;
66 
67     IHalPropValue() = default;
68 
69     // Delete copy constructor.
70     IHalPropValue(const IHalPropValue& other) = delete;
71 
72     // Clone the object. Need to return a unique_ptr since IHalPropValue is an abstract class.
73     virtual std::unique_ptr<IHalPropValue> clone() const = 0;
74 };
75 
76 }  // namespace vhal
77 }  // namespace automotive
78 }  // namespace frameworks
79 }  // namespace android
80 
81 #endif  // CPP_VHAL_CLIENT_INCLUDE_IHALPROPVALUE_H_
82