1 /*
2  * Copyright (c) 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 SUBSCRIBE_INFO_H
17 #define SUBSCRIBE_INFO_H
18 
19 #include "ffi_remote_data.h"
20 #include "common_event_subscribe_info.h"
21 
22 namespace OHOS::CommonEventManager {
23     using CommonEventSubscribeInfo = OHOS::EventFwk::CommonEventSubscribeInfo;
24     class CommonEventSubscribeInfoImpl : public OHOS::FFI::FFIData {
25     public:
GetRuntimeType()26         OHOS::FFI::RuntimeType *GetRuntimeType() override
27         {
28             return GetClassType();
29         }
CommonEventSubscribeInfoImpl(std::shared_ptr<CommonEventSubscribeInfo> info)30         explicit CommonEventSubscribeInfoImpl(std::shared_ptr<CommonEventSubscribeInfo> info): info_(info){};
31         void SetPriority(int32_t &priority);
32         int32_t GetPriority();
33         void SetUserId(int32_t &userId);
34         int32_t GetUserId();
35         void SetPermission(const std::string &permission);
36         std::string GetPermission();
37         void SetDeviceId(const std::string &deviceId);
38         std::string GetDeviceId();
39         void SetPublisherBundleName(const std::string &publisherBundleName);
40         std::string GetPublisherBundleName();
41         std::vector<std::string> GetEvents();
42         std::shared_ptr<CommonEventSubscribeInfo> GetInfoPtr();
43 
44     private:
45         friend class OHOS::FFI::RuntimeType;
46         friend class OHOS::FFI::TypeBase;
GetClassType()47         static OHOS::FFI::RuntimeType *GetClassType()
48         {
49             static OHOS::FFI::RuntimeType runtimeType =
50                 OHOS::FFI::RuntimeType::Create<OHOS::FFI::FFIData>("CommonEventSubscribeInfoImpl");
51             return &runtimeType;
52         }
53         std::shared_ptr<CommonEventSubscribeInfo> info_;
54     };
55 } // namespace OHOS::CommonEventManager
56 
57 #endif // SUBSCRIBE_INFO_H
58