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

Commit 496b86cc authored by Tanmay Patil's avatar Tanmay Patil
Browse files

Adds HAL for ultrasonics to EVS 1.1

- Adds new structs in types.h
- Adds two new .hal IEvsUltrasonicsArray and IEvsUltrasonicsArrayStream
- Adds new APIs calls in IEvsEnumerator
- Adds empty default implementation for all

Bug: 148619310

Test: Build and functionality tested with demo app.

Change-Id: I8b501c7328d4c02cc694b5a2c73a519ca6d87710
parent 30425b85
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,8 @@ hidl_interface {
        "IEvsCameraStream.hal",
        "IEvsDisplay.hal",
        "IEvsEnumerator.hal",
        "IEvsUltrasonicsArray.hal",
        "IEvsUltrasonicsArrayStream.hal",
    ],
    interfaces: [
        "android.frameworks.automotive.display@1.0",
+31 −1
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@ package android.hardware.automotive.evs@1.1;

import IEvsCamera;
import IEvsDisplay;
import IEvsUltrasonicsArray;
import @1.0::IEvsEnumerator;
import @1.0::EvsResult;
import android.hardware.camera.device@3.2::Stream;

/**
 * Provides the mechanism for EVS camera discovery
 * Provides the mechanism for EVS camera and ultrasonics array discovery
 */
interface IEvsEnumerator extends @1.0::IEvsEnumerator {
    /**
@@ -76,4 +77,33 @@ interface IEvsEnumerator extends @1.0::IEvsEnumerator {
     * @return display EvsDisplay object to be used.
     */
    openDisplay_1_1(uint8_t id) generates (IEvsDisplay display);

    /**
     * Returns a list of all ultrasonics array available to the system.
     * Will return an empty vector if ultrasonics is not supported.
     *
     * @return ultrasonicsArrays A list of ultrasonics available for EVS service.
     */
    getUltrasonicsArrayList() generates (vec<UltrasonicsArrayDesc> ultrasonicsArrays);

    /**
     * Gets the IEvsUltrasonicsArray associated with a ultrasonicsArrayId from a
     * UltrasonicsDataDesc
     *
     * @param  ultrasonicsArrayId  A unique identifier of the ultrasonic array.
     * @return evsUltrasonicsArray IEvsUltrasonicsArray object associated with a
     *                             given ultrasonicsArrayId.
     */
    openUltrasonicsArray(string ultrasonicsArrayId) generates (
            IEvsUltrasonicsArray evsUltrasonicsArray);

    /**
     * Return the specified IEvsUltrasonicsArray interface as no longer in use
     *
     * When the IEvsUltrasonicsArray object is no longer required, it must be released.
     * NOTE: Data streaming must be cleanly stopped before making this call.
     *
     * @param  evsUltrasonicsArray EvsUltrasonics array object to be closed.
     */
    closeUltrasonicsArray(IEvsUltrasonicsArray evsUltrasonicsArray);
};
+81 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.automotive.evs@1.1;

import @1.0::EvsResult;
import UltrasonicsArrayDesc;
import UltrasonicsDataFrameDesc;
import IEvsUltrasonicsArrayStream;

/**
 * HAL interface for ultrasonics sensor array.
 */
interface IEvsUltrasonicsArray {
   /**
    * Returns the ultrasonic sensor array information.
    *
    * @return  info  The description of this ultrasonic array. This must be the
    *                same value as reported by IEvsEnumerator::getUltrasonicsArrayList().
    */
   getUltrasonicArrayInfo() generates (UltrasonicsArrayDesc info);

   /**
    * Specifies the depth of the buffer chain the ultrasonic sensors is
    * asked to support.
    *
    * Up to this many data frames may be held concurrently by the client of IEvsUltrasonicsArray.
    * If this many frames have been delivered to the receiver without being returned
    * by doneWithFrame, the stream must skip frames until a buffer is returned for reuse.
    * It is legal for this call to come at any time, even while streams are already running,
    * in which case buffers should be added or removed from the chain as appropriate.
    * If no call is made to this entry point, the IEvsUltrasonicsArray must support at least one
    * data frame by default. More is acceptable.
    *
    * @param  bufferCount Number of buffers the client of
    *                     IEvsUltrasonicsArray may hold concurrently.
    * @return result      EvsResult::OK is returned if this call is successful.
    *                     Will return EvsResult::INVALID_ARG on invalid bufferCount.
    */
   setMaxFramesInFlight(uint32_t bufferCount) generates (EvsResult result);

   /**
    * Requests to start the stream.
    *
    * @param  stream Implementation of IEvsUltrasonicsArrayStream.
    * @return result EvsResult::OK is returned if this call is successful. Returns
    *                EvsResult::STREAM_ALREADY_RUNNING if stream is already running.
    */
   startStream(IEvsUltrasonicsArrayStream stream) generates (EvsResult result);

   /**
    * Requests to stop the delivery of the ultrasonic array data frames.
    *
    * Because delivery is asynchronous, frames may continue to arrive for
    * some time after this call returns. Each must be returned until the
    * closure of the stream is signaled to the IEvsCameraStream.
    * This function cannot fail and is ignored if the stream isn't running.
    */
   stopStream();

   /**
    * Notifies the UltrasonicsDataDesc is consumed that was received from
    * IEvsUltrasonicsArrayStream.
    *
    * @param  dataFrameDesc Ultrasonics data descriptor.
    */
    doneWithDataFrame(UltrasonicsDataFrameDesc dataFrameDesc);
};
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.automotive.evs@1.1;

import UltrasonicsDataFrameDesc;
import @1.1::EvsEventDesc;

/**
 * Implemented on client side to receive asynchronous ultrasonic data
 * deliveries.
 */
interface IEvsUltrasonicsArrayStream {
   /**
    * Receives calls from the HAL each time a data frame is ready.
    *
    * @param dataFrameDesc Ultrasonic array data frame descriptor.
    */
    oneway deliverDataFrame(UltrasonicsDataFrameDesc dataFrameDesc);

    /**
     * Receives calls from the HAL each time an event happens.
     *
     * @param event Event EVS event with possible event information.
     */
    oneway notify(EvsEventDesc event);
};
+22 −0
Original line number Diff line number Diff line
@@ -355,6 +355,28 @@ EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& ca
    return pRecord;
}

// TODO(b/148608401): Add default implementation with dummy data.
Return<void> EvsEnumerator::getUltrasonicsArrayList(getUltrasonicsArrayList_cb _hidl_cb) {
    hidl_vec<UltrasonicsArrayDesc> ultrasonicsArrayDesc;
    _hidl_cb(ultrasonicsArrayDesc);
    return Void();
}

// TODO(b/148608401): Add default implementation with dummy data.
Return<sp<IEvsUltrasonicsArray>> EvsEnumerator::openUltrasonicsArray(
        const hidl_string& ultrasonicsArrayId) {
    (void)ultrasonicsArrayId;
    sp<IEvsUltrasonicsArray> pEvsUltrasonicsArray;
    return pEvsUltrasonicsArray;
}

// TODO(b/148608401): Add default implementation with dummy data.
Return<void> EvsEnumerator::closeUltrasonicsArray(
        const ::android::sp<IEvsUltrasonicsArray>& evsUltrasonicsArray)  {
    (void)evsUltrasonicsArray;
    return Void();
}

} // namespace implementation
} // namespace V1_1
} // namespace evs
Loading