1 /* 2 * Copyright (c) 2021-2024 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 DISRIBUTED_INPUT_SOURCE_STUB_H 17 #define DISRIBUTED_INPUT_SOURCE_STUB_H 18 19 #include "i_distributed_source_input.h" 20 21 #include <atomic> 22 #include <iostream> 23 #include <mutex> 24 25 #include "iremote_stub.h" 26 27 namespace OHOS { 28 namespace DistributedHardware { 29 namespace DistributedInput { 30 class DistributedInputSourceStub : public IRemoteStub<IDistributedSourceInput> { 31 public: 32 DistributedInputSourceStub(); 33 ~DistributedInputSourceStub() override; 34 35 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 36 37 private: 38 int32_t HandleInitDistributedHardware(MessageParcel &reply); 39 int32_t HandleReleaseDistributedHardware(MessageParcel &reply); 40 int32_t HandleRegisterDistributedHardware(MessageParcel &data, MessageParcel &reply); 41 int32_t HandleUnregisterDistributedHardware(MessageParcel &data, MessageParcel &reply); 42 int32_t HandlePrepareRemoteInput(MessageParcel &data, MessageParcel &reply); 43 int32_t HandleUnprepareRemoteInput(MessageParcel &data, MessageParcel &reply); 44 int32_t HandleStartRemoteInput(MessageParcel &data, MessageParcel &reply); 45 int32_t HandleStopRemoteInput(MessageParcel &data, MessageParcel &reply); 46 int32_t HandleStartRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply); 47 int32_t HandleStopRelayTypeRemoteInput(MessageParcel &data, MessageParcel &reply); 48 int32_t HandlePrepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply); 49 int32_t HandleUnprepareRelayRemoteInput(MessageParcel &data, MessageParcel &reply); 50 int32_t HandleStartDhidRemoteInput(MessageParcel &data, MessageParcel &reply); 51 int32_t HandleStopDhidRemoteInput(MessageParcel &data, MessageParcel &reply); 52 int32_t HandleStartRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply); 53 int32_t HandleStopRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply); 54 int32_t HandleRegisterAddWhiteListCallback(MessageParcel &data, MessageParcel &reply); 55 int32_t HandleRegisterDelWhiteListCallback(MessageParcel &data, MessageParcel &reply); 56 int32_t HandleRegisterSimulationEventListener(MessageParcel &data, MessageParcel &reply); 57 int32_t HandleUnregisterSimulationEventListener(MessageParcel &data, MessageParcel &reply); 58 int32_t HandleRegisterSessionStateCb(MessageParcel &data, MessageParcel &reply); 59 int32_t HandleUnregisterSessionStateCb(MessageParcel &data, MessageParcel &reply); 60 bool HasEnableDHPermission(); 61 bool HasAccessDHPermission(); 62 int32_t HandleRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); 63 DISALLOW_COPY_AND_MOVE(DistributedInputSourceStub); 64 private: 65 std::atomic<bool> sourceManagerInitFlag_ {false}; 66 std::mutex operatorMutex_; 67 }; 68 } // namespace DistributedInput 69 } // namespace DistributedHardware 70 } // namespace OHOS 71 72 #endif // DISRIBUTED_INPUT_STUB_H 73