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 COMMON_EVENT_MANAGER_IMPL_H
17 #define COMMON_EVENT_MANAGER_IMPL_H
18 
19 #include "subscribe_info.h"
20 #include "subscriber.h"
21 
22 #include <cinttypes>
23 
24 namespace OHOS::CommonEventManager {
25 
26     class CommonEventManagerImpl {
27     public:
28         static int32_t PublishEvent(char *event, int32_t userId);
29         static int32_t PublishEventWithData(char *event, int32_t userId, CommonEventPublishDataBycj options);
30         static int32_t SetStaticSubscriberState(bool enable);
31         static int32_t RemoveStickyCommonEvent(char *event);
32         static std::shared_ptr<CommonEventSubscribeInfo> CreateCommonEventSubscribeInfo(char **event, int64_t size);
33         static int32_t Subscribe(std::shared_ptr<SubscriberImpl> subscriber,
34                     const std::function<void(CCommonEventData)> &callback);
35         static int32_t Unsubscribe(std::shared_ptr<SubscriberImpl> subscriber);
36     };
37 }
38 
39 #endif // COMMON_EVENT_MANAGER_IMPL