1 /* 2 * Copyright (c) 2022 Huawei Device 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 DISTRIBUTED_INPUT_SINK_SWITCH_H 17 #define DISTRIBUTED_INPUT_SINK_SWITCH_H 18 19 #include <mutex> 20 #include <set> 21 #include <string> 22 #include <vector> 23 24 #include "dinput_softbus_define.h" 25 26 namespace OHOS { 27 namespace DistributedHardware { 28 namespace DistributedInput { 29 class DistributedInputSinkSwitch { 30 public: 31 static DistributedInputSinkSwitch &GetInstance(); 32 DistributedInputSinkSwitch(); 33 ~DistributedInputSinkSwitch(); 34 void InitSwitch(); 35 36 int32_t StartSwitch(int32_t sessionId); 37 void StopSwitch(int32_t sessionId); 38 void AddSession(int32_t sessionId); 39 void RemoveSession(int32_t sessionId); 40 void StopAllSwitch(); 41 std::vector<int32_t> GetAllSessionId(); 42 int32_t GetSwitchOpenedSession(); 43 44 private: 45 std::mutex operationMutex_; 46 std::vector<SwitchStateData> switchVector_; 47 }; 48 } // namespace DistributedInput 49 } // namespace DistributedHardware 50 } // namespace OHOS 51 52 #endif // DISTRIBUTED_INPUT_SINK_SWITCH_H 53