1/*
2 * Copyright (C) 2016 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
17package android.hardware.tests.foo@1.0;
18
19//import IFoo;
20
21interface IFooCallback {
22    //heyItsMe(IFoo cb);
23    heyItsYou(IFooCallback cb);
24    heyItsYouIsntIt(IFooCallback cb) generates (bool yesOrNo);
25    oneway heyItsTheMeaningOfLife(uint8_t tmol);
26
27    // The next two methods are for instrumentation purposes.
28
29    // Block the caller for up to ns nanosesonds and return the number
30    // of nanoseconds it took to invoke each of the three methods
31    // above, both from the point of view of the caller (callerBlockedNs) and
32    // from the point of view of IFooCallback itself (timeNs).  timeNs measures
33    // how long a method's body took to execute, regardless of whether the
34    // method was oneway or two-way.  callerBlockedNs reflects the amount of
35    // time the caller was blocked before the method returned.  For two-way
36    // methods, callerBlockedNs should be slightly higher than timeNs.  For
37    // one-way calls, callerBlockedNs will be very low, and unrelated to
38    // timeNs.
39
40    struct InvokeInfo {
41        bool invoked;
42	int64_t callerBlockedNs;
43	int64_t timeNs;
44    };
45    reportResults(int64_t ns) generates (int64_t leftNs, InvokeInfo[3] invokeInfo);
46
47    // This method is used by the caller of IFooCallback to tell IFooCallback
48    // how long the three methods above took, from the point of view of that
49    // caller.  IFooCallback adds this information to the one reported by
50    // reportResults in InvokeInfo.
51
52    youBlockedMeFor(int64_t[3] callerBlockedInfo);
53};
54