xref: /aosp_15_r20/external/deqp/executor/xeCommLink.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1 #ifndef _XECOMMLINK_HPP
2 #define _XECOMMLINK_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program Test Executor
5  * ------------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief Communication link abstraction.
24  *//*--------------------------------------------------------------------*/
25 
26 #include "xeDefs.hpp"
27 #include "xeCallQueue.hpp"
28 
29 namespace xe
30 {
31 
32 enum CommLinkState
33 {
34     COMMLINKSTATE_READY,                  //!< CommLink is ready to accept commands.
35     COMMLINKSTATE_TEST_PROCESS_LAUNCHING, //!< Test process is launching. Allowed commands: stop process
36     COMMLINKSTATE_TEST_PROCESS_RUNNING,   //!< Test process is running: Allowed commands: stop process
37     COMMLINKSTATE_TEST_PROCESS_FINISHED,  //!< Test process is finished. Allowed commands: reset
38 
39     COMMLINKSTATE_TEST_PROCESS_LAUNCH_FAILED, //!< Test process launch failed. Allowed commands: reset
40     COMMLINKSTATE_ERROR,                      //!< Other error occurred: Allowed commands: reset
41 
42     COMMLINKSTATE_LAST
43 };
44 
45 const char *getCommLinkStateName(CommLinkState state);
46 
47 class CommLink
48 {
49 public:
50     typedef void (*StateChangedFunc)(void *userPtr, CommLinkState state, const char *message);
51     typedef void (*LogDataFunc)(void *userPtr, const uint8_t *bytes, size_t numBytes);
52 
53     CommLink(void);
54     virtual ~CommLink(void);
55 
56     virtual void reset(void)                                 = DE_NULL;
57     virtual CommLinkState getState(void) const               = DE_NULL;
58     virtual CommLinkState getState(std::string &error) const = DE_NULL;
59 
60     virtual void setCallbacks(StateChangedFunc stateChangedCallback, LogDataFunc testLogDataCallback,
61                               LogDataFunc infoLogDataCallback, void *userPtr) = DE_NULL;
62 
63     virtual void startTestProcess(const char *name, const char *params, const char *workingDir,
64                                   const char *caseList) = DE_NULL;
65     virtual void stopTestProcess(void)                  = DE_NULL;
66 };
67 
68 } // namespace xe
69 
70 #endif // _XECOMMLINK_HPP
71