Merge "Add placeholder properties for emulator"

This commit is contained in:
Kai Wang 2021-08-12 16:50:42 +00:00 committed by Android (Google) Code Review
commit 34c5b9ae41
3 changed files with 50 additions and 1 deletions

View file

@ -1061,6 +1061,42 @@ const ConfigDeclaration kVehicleProperties[]{
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
},
{
.config =
{
.prop = PLACEHOLDER_PROPERTY_INT,
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0}},
},
{
.config =
{
.prop = PLACEHOLDER_PROPERTY_FLOAT,
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.floatValues = {0.0f}},
},
{
.config =
{
.prop = PLACEHOLDER_PROPERTY_BOOLEAN,
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.int32Values = {0 /* false */}},
},
{
.config =
{
.prop = PLACEHOLDER_PROPERTY_STRING,
.access = VehiclePropertyAccess::READ_WRITE,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
},
.initialValue = {.stringValue = {"Test"}},
},
#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
// Vendor propetry for E2E ClusterHomeService testing.
{

View file

@ -100,6 +100,19 @@ constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE =
toVendor(VehicleProperty::CLUSTER_NAVIGATION_STATE);
#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
/**
* These properties are placeholder properties for developers to test new features without
* implementing a real property.
*/
constexpr int32_t PLACEHOLDER_PROPERTY_INT =
0x2a11 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::INT32;
constexpr int32_t PLACEHOLDER_PROPERTY_FLOAT =
0x2a11 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::FLOAT;
constexpr int32_t PLACEHOLDER_PROPERTY_BOOLEAN =
0x2a11 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::BOOLEAN;
constexpr int32_t PLACEHOLDER_PROPERTY_STRING =
0x2a11 | VehiclePropertyGroup::VENDOR | VehicleArea::GLOBAL | VehiclePropertyType::STRING;
const int32_t kHvacPowerProperties[] = {
toInt(VehicleProperty::HVAC_FAN_SPEED),
toInt(VehicleProperty::HVAC_FAN_DIRECTION),

View file

@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test {
TEST_F(DefaultVhalImplTest, testListProperties) {
std::vector<VehiclePropConfig> configs = mHal->listProperties();
EXPECT_EQ((size_t)117, configs.size());
EXPECT_EQ((size_t)121, configs.size());
}
TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) {