Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38b29894 authored by Nick Desaulniers's avatar Nick Desaulniers
Browse files

[hardware][interfaces][automotive] fix -Wreorder-init-list



C++20 will require members in a designated initializer to be in order
unlike C99.

Bug: 139945549
Test: mm
Change-Id: I17d1d262d71eefa0aa5b89da7acc659bc2f97bbd
Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
parent c325670c
Loading
Loading
Loading
Loading
+48 −37
Original line number Diff line number Diff line
@@ -370,11 +370,11 @@ const ConfigDeclaration kVehicleProperties[]{
                 },
         .initialValue = {.floatValues = {100.0f}}},  // units in meters

        {.config = {.prop = toInt(VehicleProperty::TIRE_PRESSURE),
        {.config =
                 {
                         .prop = toInt(VehicleProperty::TIRE_PRESSURE),
                         .access = VehiclePropertyAccess::READ,
                         .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                    .minSampleRate = 1.0f,
                    .maxSampleRate = 2.0f,
                         .areaConfigs = {VehicleAreaConfig{
                                                 .areaId = WHEEL_FRONT_LEFT,
                                                 .minFloatValue = 100.0f,
@@ -394,7 +394,10 @@ const ConfigDeclaration kVehicleProperties[]{
                                                 .areaId = WHEEL_REAR_RIGHT,
                                                 .minFloatValue = 100.0f,
                                                 .maxFloatValue = 300.0f,
                                    }}},
                                         }},
                         .minSampleRate = 1.0f,
                         .maxSampleRate = 2.0f,
                 },
         .initialValue = {.floatValues = {200.0f}}},  // units in kPa

        {.config =
@@ -595,11 +598,14 @@ const ConfigDeclaration kVehicleProperties[]{
                    .configArray = {(int)VehicleUnit::FAHRENHEIT, (int)VehicleUnit::CELSIUS}},
         .initialValue = {.int32Values = {(int)VehicleUnit::FAHRENHEIT}}},

        {.config = {.prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS),
        {.config =
                 {
                         .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS),
                         .access = VehiclePropertyAccess::READ_WRITE,
                         .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                         .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
                         .configArray = {(int)VehicleUnit::KILOMETER, (int)VehicleUnit::MILE},
                    .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}},
                 },
         .initialValue = {.int32Values = {(int)VehicleUnit::MILE}}},

        {.config =
@@ -692,13 +698,18 @@ const ConfigDeclaration kVehicleProperties[]{
                        },
        },

        {.config = {.prop = kMixedTypePropertyForTest,
        {
                .config = {.prop = kMixedTypePropertyForTest,
                           .access = VehiclePropertyAccess::READ_WRITE,
                           .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                           .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}},
         .initialValue = {.stringValue = "MIXED property",
                .initialValue =
                        {
                                .int32Values = {1 /* indicate TRUE boolean value */, 2, 3},
                          .floatValues = {4.5f}}},
                                .floatValues = {4.5f},
                                .stringValue = "MIXED property",
                        },
        },

        {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK),
                    .access = VehiclePropertyAccess::READ_WRITE,
+2 −2
Original line number Diff line number Diff line
@@ -286,8 +286,8 @@ void EmulatedVehicleHal::onCreate() {

            // Create a separate instance for each individual zone
            VehiclePropValue prop = {
                .prop = cfg.prop,
                    .areaId = curArea,
                    .prop = cfg.prop,
            };

            if (it.initialAreaValues.size() > 0) {
+5 −3
Original line number Diff line number Diff line
@@ -101,9 +101,11 @@ std::vector<VehiclePropValue> JsonFakeValueGenerator::parseFakeValueJson(std::is
                  rawEvent.toStyledString().c_str());
            continue;
        }
        VehiclePropValue event = {.prop = rawEvent["prop"].asInt(),
        VehiclePropValue event = {
                .timestamp = rawEvent["timestamp"].asInt64(),
                .areaId = rawEvent["areaId"].asInt(),
                                  .timestamp = rawEvent["timestamp"].asInt64()};
                .prop = rawEvent["prop"].asInt(),
        };

        Json::Value rawEventValue = rawEvent["value"];
        auto& value = event.value;
+8 −5
Original line number Diff line number Diff line
@@ -120,7 +120,10 @@ void VehicleEmulator::doGetProperty(VehicleEmulator::EmulatorMessage const& rxMs
    }

    {
        VehiclePropValue request = { .prop = propId, .areaId = areaId };
        VehiclePropValue request = {
                .areaId = areaId,
                .prop = propId,
        };
        StatusCode halStatus;
        auto val = mHal->get(request, &halStatus);
        if (val != nullptr) {
@@ -150,10 +153,10 @@ void VehicleEmulator::doSetProperty(VehicleEmulator::EmulatorMessage const& rxMs
                                    VehicleEmulator::EmulatorMessage& respMsg) {
    emulator::VehiclePropValue protoVal = rxMsg.value(0);
    VehiclePropValue val = {
        .prop = protoVal.prop(),
            .timestamp = elapsedRealtimeNano(),
            .areaId = protoVal.area_id(),
            .prop = protoVal.prop(),
            .status = (VehiclePropertyStatus)protoVal.status(),
        .timestamp = elapsedRealtimeNano(),
    };

    respMsg.set_msg_type(emulator::SET_PROPERTY_RESP);