1 /* 2 * Copyright (c) 2022-2023 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 OHOS_DISTRIBUTED_ABILITY_MANAGER_STUB_H 17 #define OHOS_DISTRIBUTED_ABILITY_MANAGER_STUB_H 18 19 #include <functional> 20 #include <map> 21 22 #include "distributed_ability_manager_interface.h" 23 #include "ipc_types.h" 24 #include "iremote_stub.h" 25 #include "message_option.h" 26 #include "message_parcel.h" 27 #include "refbase.h" 28 29 namespace OHOS { 30 namespace DistributedSchedule { 31 class DistributedAbilityManagerStub : public IRemoteStub<IDistributedAbilityManager> { 32 public: 33 DistributedAbilityManagerStub(); 34 ~DistributedAbilityManagerStub(); 35 int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, 36 MessageParcel& reply, MessageOption& option) override; 37 38 private: 39 bool EnforceInterfaceToken(MessageParcel& data); 40 41 int32_t RegisterInner(MessageParcel& data, MessageParcel& reply); 42 int32_t UnregisterInner(MessageParcel& data, MessageParcel& reply); 43 int32_t RegisterDeviceSelectionCallbackInner(MessageParcel& data, MessageParcel& reply); 44 int32_t UnregisterDeviceSelectionCallbackInner(MessageParcel& data, MessageParcel& reply); 45 int32_t UpdateConnectStatusInner(MessageParcel& data, MessageParcel& reply); 46 int32_t StartDeviceManagerInner(MessageParcel& data, MessageParcel& reply); 47 bool VerifyPermission(uint32_t accessToken, const std::string& permissionName) const; 48 49 using Func = int32_t(DistributedAbilityManagerStub::*)(MessageParcel& data, MessageParcel& reply); 50 std::map<uint32_t, Func> funcsMap_; 51 }; 52 } // namespace DistributedSchedule 53 } // namespace OHOS 54 #endif // OHOS_DISTRIBUTED_ABILITY_MANAGER_STUB_H