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.msgq@1.0;
18
19interface ITestMsgQ {
20    enum EventFlagBits : uint32_t {
21        FMQ_NOT_EMPTY = 1 << 0,
22        FMQ_NOT_FULL  = 1 << 1,
23    };
24
25    /**
26     * This method requests the service to set up a synchronous read/write
27     * wait-free FMQ using the input descriptor with the client as reader.
28     *
29     * @param mqDesc This structure describes the FMQ that was set up by the
30     * client. Server uses this descriptor to set up a FMQ object at its end.
31     *
32     * @return ret True if the setup is successful.
33     */
34    configureFmqSyncReadWrite(fmq_sync<uint16_t> mqDesc) generates(bool ret);
35
36    /**
37     * This method requests the service to return an MQDescriptor to
38     * an unsynchronized FMQ set up by the server. If 'configureFmq' is
39     * true, then the server sets up a new unsynchronized FMQ. This
40     * method is to be used to test multiple reader processes.
41     *
42     * @param configureFmq The server sets up a new unsynchronized FMQ if
43     * this parameter is true.
44     *
45     * @return ret True if successful.
46     * @return mqDesc This structure describes the unsynchronized FMQ that was
47     * set up by the service. Client can use it to set up the FMQ at its end.
48     */
49    getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync<uint16_t> mqDesc);
50
51    /**
52     * This method request the service to write into the synchronized read/write
53     * flavor of the FMQ.
54     *
55     * @param count Number to messages to write.
56     *
57     * @return ret True if the write operation was successful.
58     */
59    requestWriteFmqSync(int32_t count) generates(bool ret);
60
61    /**
62     * This method request the service to read from the synchronized read/write
63     * FMQ.
64     *
65     * @param count Number to messages to read.
66     *
67     * @return ret True if the read operation was successful.
68     */
69    requestReadFmqSync(int32_t count) generates(bool ret);
70
71    /**
72     * This method request the service to write into the unsynchronized flavor
73     * of FMQ.
74     *
75     * @param count Number to messages to write.
76     *
77     * @return ret True if the write operation was successful.
78     */
79    requestWriteFmqUnsync(int32_t count) generates(bool ret);
80
81    /**
82     * This method request the service to read from the unsynchronized flavor of
83     * FMQ.
84     *
85     * @param count Number to messages to read.
86     *
87     * @return ret Will be True if the read operation was successful.
88     */
89    requestReadFmqUnsync(int32_t count) generates(bool ret);
90
91    /**
92     * This method requests the service to trigger a blocking read.
93     *
94     * @param count Number of messages to read.
95     *
96     */
97    oneway requestBlockingRead(int32_t count);
98
99    /**
100     * This method requests the service to trigger a blocking read using
101     * default Event Flag notification bits defined by the MessageQueue class.
102     *
103     * @param count Number of messages to read.
104     *
105     */
106    oneway requestBlockingReadDefaultEventFlagBits(int32_t count);
107
108    /**
109     * This method requests the service to repeatedly trigger blocking reads.
110     *
111     * @param count Number of messages to read in a single blocking read.
112     * @param numIter Number of blocking reads to trigger.
113     *
114     */
115    oneway requestBlockingReadRepeat(int32_t count, int32_t numIter);
116
117};
118