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

Commit e03c4c18 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Convert Vehicle Property to integer"

parents c56b1257 8e624b32
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface IVehicle {
   * StatusCode::INVALID_ARG, otherwise a list of vehicle property
   * configurations with StatusCode::OK
   */
  getPropConfigs(vec<VehicleProperty> props)
  getPropConfigs(vec<int32_t> props)
          generates (StatusCode status, vec<VehiclePropConfig> propConfigs);

  /**
@@ -84,7 +84,7 @@ interface IVehicle {
   * If this client wasn't subscribed to the given property, this method
   * must return StatusCode::INVALID_ARG.
   */
  unsubscribe(IVehicleCallback callback, VehicleProperty propId)
  unsubscribe(IVehicleCallback callback, int32_t propId)
          generates (StatusCode status);

  /**
+1 −1
Original line number Diff line number Diff line
@@ -54,6 +54,6 @@ interface IVehicleCallback {
     *                 occurred, must be 0 for global properties
     */
    oneway onPropertySetError(StatusCode errorCode,
                              VehicleProperty propId,
                              int32_t propId,
                              int32_t areaId);
};
+7 −6
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public:

    using HalEventFunction = std::function<void(VehiclePropValuePtr)>;
    using HalErrorFunction = std::function<void(
            StatusCode errorCode, VehicleProperty property, int32_t areaId)>;
            StatusCode errorCode, int32_t property, int32_t areaId)>;

    virtual ~VehicleHal() {}

@@ -57,7 +57,7 @@ public:
     *                   rate, e.g. for properties with
     *                   VehiclePropertyChangeMode::CONTINUOUS
     */
    virtual StatusCode subscribe(VehicleProperty property,
    virtual StatusCode subscribe(int32_t property,
                                 int32_t areas,
                                 float sampleRate) = 0;

@@ -66,7 +66,7 @@ public:
     *
     * @param property vehicle property to unsubscribe
     */
    virtual StatusCode unsubscribe(VehicleProperty property) = 0;
    virtual StatusCode unsubscribe(int32_t property) = 0;

    /**
     * Override this method if you need to do one-time initialization.
@@ -95,7 +95,8 @@ protected:

    /* Propagates error during set operation to the vehicle HAL clients. */
    void doHalPropertySetError(StatusCode errorCode,
                               VehicleProperty propId, int32_t areaId) {
                               int32_t propId,
                               int32_t areaId) {
        mOnHalPropertySetError(errorCode, propId, areaId);
    }

+17 −17
Original line number Diff line number Diff line
@@ -29,20 +29,20 @@ namespace impl {

const VehiclePropConfig kVehicleProperties[] = {
    {
        .prop = VehicleProperty::INFO_MAKE,
        .prop = toInt(VehicleProperty::INFO_MAKE),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::STATIC,
    },

    {
        .prop = VehicleProperty::HVAC_POWER_ON,
        .prop = toInt(VehicleProperty::HVAC_POWER_ON),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
    },

    {
        .prop = VehicleProperty::HVAC_DEFROSTER,
        .prop = toInt(VehicleProperty::HVAC_DEFROSTER),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas =
@@ -51,28 +51,28 @@ const VehiclePropConfig kVehicleProperties[] = {
    },

    {
        .prop = VehicleProperty::HVAC_RECIRC_ON,
        .prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
    },

    {
        .prop = VehicleProperty::HVAC_AC_ON,
        .prop = toInt(VehicleProperty::HVAC_AC_ON),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
    },

    {
        .prop = VehicleProperty::HVAC_AUTO_ON,
        .prop = toInt(VehicleProperty::HVAC_AUTO_ON),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
    },

    {
        .prop = VehicleProperty::HVAC_FAN_SPEED,
        .prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1),
@@ -86,14 +86,14 @@ const VehiclePropConfig kVehicleProperties[] = {
    },

    {
        .prop = VehicleProperty::HVAC_FAN_DIRECTION,
        .prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas = toInt(VehicleAreaZone::ROW_1),
    },

    {
        .prop = VehicleProperty::HVAC_TEMPERATURE_SET,
        .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .supportedAreas =
@@ -114,25 +114,25 @@ const VehiclePropConfig kVehicleProperties[] = {
    },

    {
        .prop = VehicleProperty::NIGHT_MODE,
        .prop = toInt(VehicleProperty::NIGHT_MODE),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
    },

    {
        .prop = VehicleProperty::DRIVING_STATUS,
        .prop = toInt(VehicleProperty::DRIVING_STATUS),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
    },

    {
        .prop = VehicleProperty::GEAR_SELECTION,
        .prop = toInt(VehicleProperty::GEAR_SELECTION),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
    },

    {
        .prop = VehicleProperty::INFO_FUEL_CAPACITY,
        .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .areaConfigs = {
@@ -144,7 +144,7 @@ const VehiclePropConfig kVehicleProperties[] = {
    },

    {
        .prop = VehicleProperty::DISPLAY_BRIGHTNESS,
        .prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
        .access = VehiclePropertyAccess::READ_WRITE,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .areaConfigs = {
@@ -156,20 +156,20 @@ const VehiclePropConfig kVehicleProperties[] = {
    },

    {
        .prop = VehicleProperty::IGNITION_STATE,
        .prop = toInt(VehicleProperty::IGNITION_STATE),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
    },

    {
        .prop = VehicleProperty::OBD2_LIVE_FRAME,
        .prop = toInt(VehicleProperty::OBD2_LIVE_FRAME),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .configArray = {0,0}
    },

    {
        .prop = VehicleProperty::OBD2_FREEZE_FRAME,
        .prop = toInt(VehicleProperty::OBD2_FREEZE_FRAME),
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
        .configArray = {0,0}
+3 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(
    *outStatus = StatusCode::OK;

    VehiclePropValuePtr v;
    VehicleProperty property = requestedPropValue.prop;
    auto property = static_cast<VehicleProperty>(requestedPropValue.prop);
    int32_t areaId = requestedPropValue.areaId;
    auto& pool = *getValuePool();

@@ -105,7 +105,7 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(
    }

    if (StatusCode::OK == *outStatus && v.get() != nullptr) {
        v->prop = property;
        v->prop = toInt(property);
        v->areaId = areaId;
        v->timestamp = elapsedRealtimeNano();
    }
@@ -114,7 +114,7 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(
}

StatusCode DefaultVehicleHal::set(const VehiclePropValue& propValue) {
    auto property = propValue.prop;
    auto property = static_cast<VehicleProperty>(propValue.prop);
    const auto& v = propValue.value;

    StatusCode status = StatusCode::OK;
Loading