15ba71b47Sopenharmony_ci/* 25ba71b47Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 35ba71b47Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 45ba71b47Sopenharmony_ci * you may not use this file except in compliance with the License. 55ba71b47Sopenharmony_ci * You may obtain a copy of the License at 65ba71b47Sopenharmony_ci * 75ba71b47Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 85ba71b47Sopenharmony_ci * 95ba71b47Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 105ba71b47Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 115ba71b47Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 125ba71b47Sopenharmony_ci * See the License for the specific language governing permissions and 135ba71b47Sopenharmony_ci * limitations under the License. 145ba71b47Sopenharmony_ci */ 155ba71b47Sopenharmony_ci 165ba71b47Sopenharmony_ci#ifndef INTERFACES_INNERKITS_SAMGR_INCLUDE_STATUS_CHANGE_WRAPPER_H 175ba71b47Sopenharmony_ci#define INTERFACES_INNERKITS_SAMGR_INCLUDE_STATUS_CHANGE_WRAPPER_H 185ba71b47Sopenharmony_ci 195ba71b47Sopenharmony_ci#include <memory> 205ba71b47Sopenharmony_ci 215ba71b47Sopenharmony_ci#include "cxx.h" 225ba71b47Sopenharmony_ci#include "if_system_ability_manager.h" 235ba71b47Sopenharmony_ci#include "ipc_object_stub.h" 245ba71b47Sopenharmony_ci#include "system_ability_status_change_stub.h" 255ba71b47Sopenharmony_ci 265ba71b47Sopenharmony_cinamespace OHOS { 275ba71b47Sopenharmony_cinamespace SamgrRust { 285ba71b47Sopenharmony_cistruct SystemProcessInfo; 295ba71b47Sopenharmony_ciclass SystemAbilityStatusChangeWrapper : public SystemAbilityStatusChangeStub { 305ba71b47Sopenharmony_cipublic: 315ba71b47Sopenharmony_ci SystemAbilityStatusChangeWrapper(const rust::Fn<void(int32_t systemAbilityId, const rust::str deviceId)> onAdd, 325ba71b47Sopenharmony_ci const rust::Fn<void(int32_t systemAbilityId, const rust::str deviceId)> onRemove); 335ba71b47Sopenharmony_ci ~SystemAbilityStatusChangeWrapper() = default; 345ba71b47Sopenharmony_ci void OnAddSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; 355ba71b47Sopenharmony_ci void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string &deviceId) override; 365ba71b47Sopenharmony_ci 375ba71b47Sopenharmony_ciprivate: 385ba71b47Sopenharmony_ci rust::Fn<void(int32_t systemAbilityId, const rust::str deviceId)> onAdd_; 395ba71b47Sopenharmony_ci rust::Fn<void(int32_t systemAbilityId, const rust::str deviceId)> onRemove_; 405ba71b47Sopenharmony_ci}; 415ba71b47Sopenharmony_ci 425ba71b47Sopenharmony_ciclass SystemProcessStatusChangeWrapper : public IRemoteProxy<ISystemProcessStatusChange> { 435ba71b47Sopenharmony_cipublic: 445ba71b47Sopenharmony_ci SystemProcessStatusChangeWrapper(const sptr<IRemoteObject> &impl, 455ba71b47Sopenharmony_ci const rust::Fn<void(const OHOS::SamgrRust::SystemProcessInfo &systemProcessInfo)> onStart, 465ba71b47Sopenharmony_ci const rust::Fn<void(const OHOS::SamgrRust::SystemProcessInfo &systemProcessInfo)> onStop); 475ba71b47Sopenharmony_ci ~SystemProcessStatusChangeWrapper() = default; 485ba71b47Sopenharmony_ci 495ba71b47Sopenharmony_ci void OnSystemProcessStarted(OHOS::SystemProcessInfo &systemProcessInfo) override; 505ba71b47Sopenharmony_ci void OnSystemProcessStopped(OHOS::SystemProcessInfo &systemProcessInfo) override; 515ba71b47Sopenharmony_ci 525ba71b47Sopenharmony_ciprivate: 535ba71b47Sopenharmony_ci rust::Fn<void(const OHOS::SamgrRust::SystemProcessInfo &systemProcessInfo)> onStart_; 545ba71b47Sopenharmony_ci rust::Fn<void(const OHOS::SamgrRust::SystemProcessInfo &systemProcessInfo)> onStop_; 555ba71b47Sopenharmony_ci}; 565ba71b47Sopenharmony_ci 575ba71b47Sopenharmony_ciclass UnSubscribeSystemAbilityHandler { 585ba71b47Sopenharmony_cipublic: 595ba71b47Sopenharmony_ci UnSubscribeSystemAbilityHandler(int32_t systemAbilityId, sptr<ISystemAbilityStatusChange> listener); 605ba71b47Sopenharmony_ci void UnSubscribe(); 615ba71b47Sopenharmony_ci 625ba71b47Sopenharmony_ciprivate: 635ba71b47Sopenharmony_ci int32_t said_; 645ba71b47Sopenharmony_ci sptr<ISystemAbilityStatusChange> listener_; 655ba71b47Sopenharmony_ci}; 665ba71b47Sopenharmony_ci 675ba71b47Sopenharmony_ciclass UnSubscribeSystemProcessHandler { 685ba71b47Sopenharmony_cipublic: 695ba71b47Sopenharmony_ci UnSubscribeSystemProcessHandler(sptr<ISystemProcessStatusChange> listener); 705ba71b47Sopenharmony_ci void UnSubscribe(); 715ba71b47Sopenharmony_ci 725ba71b47Sopenharmony_ciprivate: 735ba71b47Sopenharmony_ci sptr<ISystemProcessStatusChange> listener_; 745ba71b47Sopenharmony_ci}; 755ba71b47Sopenharmony_ci 765ba71b47Sopenharmony_ci} // namespace SamgrRust 775ba71b47Sopenharmony_ci} // namespace OHOS 785ba71b47Sopenharmony_ci 795ba71b47Sopenharmony_ci#endif