1 /*
2 * Copyright (C) 2015 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 #include <stdint.h>
18 #include <sys/types.h>
19
20 #include "TestProperties.h"
21
22 static vehicle_prop_config_t TEST_PROPERTIES[] = {
23 {
24 .prop = TEST_PROPERTY_STRING,
25 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
26 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
27 .value_type = VEHICLE_VALUE_TYPE_STRING,
28 .config_flags = 0x1234, // just random
29 .min_sample_rate = 0,
30 .max_sample_rate = 0,
31 .hal_data = NULL,
32 },
33 {
34 .prop = TEST_PROPERTY_BYTES,
35 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
36 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
37 .value_type = VEHICLE_VALUE_TYPE_BYTES,
38 .config_flags = 0x12345, // just random
39 .min_sample_rate = 0,
40 .max_sample_rate = 0,
41 .hal_data = NULL,
42 },
43 {
44 .prop = TEST_PROPERTY_BOOLEAN,
45 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
46 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
47 .value_type = VEHICLE_VALUE_TYPE_BOOLEAN,
48 .config_flags = 0x123456, // just random
49 .min_sample_rate = 0,
50 .max_sample_rate = 0,
51 .hal_data = NULL,
52 },
53 {
54 .prop = TEST_PROPERTY_ZONED_INT32,
55 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
56 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
57 .value_type = VEHICLE_VALUE_TYPE_ZONED_INT32,
58 .config_flags = 0x1234567, // just random
59 .min_sample_rate = 0,
60 .max_sample_rate = 0,
61 .hal_data = NULL,
62 },
63 {
64 .prop = TEST_PROPERTY_ZONED_FLOAT,
65 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
66 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
67 .value_type = VEHICLE_VALUE_TYPE_ZONED_FLOAT,
68 .config_flags = 0x12345678, // just random
69 .min_sample_rate = 0,
70 .max_sample_rate = 0,
71 .hal_data = NULL,
72 },
73 {
74 .prop = TEST_PROPERTY_ZONED_BOOLEAN,
75 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
76 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
77 .value_type = VEHICLE_VALUE_TYPE_ZONED_BOOLEAN,
78 .config_flags = 0x10, // just random
79 .min_sample_rate = 0,
80 .max_sample_rate = 0,
81 .hal_data = NULL,
82 },
83 {
84 .prop = TEST_PROPERTY_INT64,
85 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
86 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
87 .value_type = VEHICLE_VALUE_TYPE_INT64,
88 .config_flags = 0x11, // just random
89 .min_sample_rate = 0,
90 .max_sample_rate = 0,
91 .hal_data = NULL,
92 },
93 {
94 .prop = TEST_PROPERTY_FLOAT,
95 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
96 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
97 .value_type = VEHICLE_VALUE_TYPE_FLOAT,
98 .config_flags = 0x12, // just random
99 .float_min_value = 0.1f,
100 .float_max_value = 10.0f,
101 .min_sample_rate = 0,
102 .max_sample_rate = 0,
103 .hal_data = NULL,
104 },
105 {
106 .prop = TEST_PROPERTY_FLOAT_VEC2,
107 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
108 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
109 .value_type = VEHICLE_VALUE_TYPE_FLOAT_VEC2,
110 .config_flags = 0x13, // just random
111 .min_sample_rate = 0,
112 .max_sample_rate = 0,
113 .hal_data = NULL,
114 },
115 {
116 .prop = TEST_PROPERTY_FLOAT_VEC3,
117 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
118 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
119 .value_type = VEHICLE_VALUE_TYPE_FLOAT_VEC3,
120 .config_flags = 0x14, // just random
121 .min_sample_rate = 0,
122 .max_sample_rate = 0,
123 .hal_data = NULL,
124 },
125 {
126 .prop = TEST_PROPERTY_FLOAT_VEC4,
127 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
128 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
129 .value_type = VEHICLE_VALUE_TYPE_FLOAT_VEC4,
130 .config_flags = 0x15, // just random
131 .min_sample_rate = 0,
132 .max_sample_rate = 0,
133 .hal_data = NULL,
134 },
135 {
136 .prop = TEST_PROPERTY_INT32,
137 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
138 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
139 .value_type = VEHICLE_VALUE_TYPE_INT32,
140 .config_flags = 0x16, // just random
141 .int32_min_value = 10,
142 .int32_max_value = 100,
143 .min_sample_rate = 0,
144 .max_sample_rate = 0,
145 .hal_data = NULL,
146 },
147 {
148 .prop = TEST_PROPERTY_INT32_VEC2,
149 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
150 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
151 .value_type = VEHICLE_VALUE_TYPE_INT32_VEC2,
152 .config_flags = 0x17, // just random
153 .min_sample_rate = 0,
154 .max_sample_rate = 0,
155 .hal_data = NULL,
156 },
157 {
158 .prop = TEST_PROPERTY_INT32_VEC3,
159 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
160 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
161 .value_type = VEHICLE_VALUE_TYPE_INT32_VEC3,
162 .config_flags = 0x18, // just random
163 .min_sample_rate = 0,
164 .max_sample_rate = 0,
165 .hal_data = NULL,
166 },
167 {
168 .prop = TEST_PROPERTY_INT32_VEC4,
169 .access = VEHICLE_PROP_ACCESS_READ_WRITE,
170 .change_mode = VEHICLE_PROP_CHANGE_MODE_ON_CHANGE,
171 .value_type = VEHICLE_VALUE_TYPE_INT32_VEC4,
172 .config_flags = 0x0, // just random
173 .min_sample_rate = 0,
174 .max_sample_rate = 0,
175 .hal_data = NULL,
176 },
177 };
178
getTestProperties()179 vehicle_prop_config_t const * getTestProperties() {
180 return TEST_PROPERTIES;
181 }
182
getNumTestProperties()183 int getNumTestProperties() {
184 return sizeof(TEST_PROPERTIES) / sizeof(vehicle_prop_config_t);
185 }
186
187