1 /* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_SHARING_AGENT_DEF_H 17 #define OHOS_SHARING_AGENT_DEF_H 18 19 namespace OHOS { 20 namespace Sharing { 21 22 enum AgentType { NONE_AGENT, SRC_AGENT, SINK_AGENT }; 23 24 enum AgentRunStep { 25 AGENT_STEP_IDLE, 26 AGENT_STEP_CREATE, 27 AGENT_STEP_START, 28 AGENT_STEP_PAUSE, 29 AGENT_STEP_RESUME, 30 AGENT_STEP_APPENDSURFACE, 31 AGENT_STEP_REMOVESURFACE, 32 AGENT_STEP_PLAY, 33 AGENT_STEP_PLAYSTOP, 34 AGENT_STEP_DESTROY 35 }; 36 37 enum AgentRunStepWeight { 38 AGENT_STEP_WEIGHT_IDLE, 39 AGENT_STEP_WEIGHT_REUSABLE, 40 AGENT_STEP_WEIGHT_START, 41 AGENT_STEP_WEIGHT_DESTROY 42 }; 43 44 enum AgentRunningStatus { 45 AGENT_STATUS_IDLE, 46 AGENT_STATUS_RUNNING, 47 AGENT_STATUS_DONE, 48 AGENT_STATUS_ERROR, 49 AGENT_STATUS_INTERRUPT 50 }; 51 52 struct AgentRunStepKey { 53 bool operator<(AgentRunStepKey const &agentRunStepKey) const 54 { 55 if (weight == agentRunStepKey.weight) { 56 if (stepType == agentRunStepKey.stepType) { 57 return requestId < agentRunStepKey.requestId; 58 } 59 return stepType < agentRunStepKey.stepType; 60 } else { 61 return weight > agentRunStepKey.weight; 62 } 63 } 64 65 uint32_t requestId = 0; 66 AgentRunStep stepType = AGENT_STEP_IDLE; 67 AgentRunStepWeight weight = AGENT_STEP_WEIGHT_IDLE; 68 }; 69 70 } // namespace Sharing 71 } // namespace OHOS 72 #endif