1 /* 2 * Copyright (c) 2021 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 FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_HISTORY_EVENT_RECORD_H 17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_HISTORY_EVENT_RECORD_H 18 19 #include "common_event_constant.h" 20 #include "want.h" 21 22 namespace OHOS { 23 namespace EventFwk { 24 struct HistorySubscriberRecord { 25 struct tm recordTime {}; 26 std::string bundleName; 27 int32_t priority; 28 int32_t userId; 29 std::string permission; 30 std::string deviceId; 31 bool isFreeze; 32 int64_t freezeTime; HistorySubscriberRecordHistorySubscriberRecord33 HistorySubscriberRecord() : priority(0), userId(UNDEFINED_USER), isFreeze(false), freezeTime(0) 34 {} 35 }; 36 37 struct HistoryEventRecord { 38 enum EventState { 39 IDLE = 0, 40 RECEIVING, 41 RECEIVED, 42 }; 43 enum DeliveryState { 44 PENDING = 0, 45 DELIVERED, 46 SKIPPED, 47 TIMEOUT, 48 }; 49 50 Want want; 51 int32_t code; 52 std::string data; 53 54 bool sticky; 55 bool ordered; 56 std::vector<std::string> subscriberPermissions; 57 58 struct tm recordTime {}; 59 pid_t pid; 60 uid_t uid; 61 int32_t userId; 62 std::string bundleName; 63 bool isSystemApp; 64 bool isSystemEvent; 65 66 std::vector<HistorySubscriberRecord> receivers; 67 bool hasLastSubscribe; 68 std::vector<int> deliveryState; 69 int64_t dispatchTime; 70 int64_t receiverTime; 71 int8_t state; 72 bool resultAbort; 73 HistoryEventRecordHistoryEventRecord74 HistoryEventRecord() 75 : code(0), 76 sticky(false), 77 ordered(false), 78 pid(0), 79 uid(0), 80 userId(UNDEFINED_USER), 81 isSystemApp(false), 82 isSystemEvent(false), 83 hasLastSubscribe(false), 84 dispatchTime(0), 85 receiverTime(0), 86 state(0), 87 resultAbort(false) 88 {} 89 }; 90 } // namespace EventFwk 91 } // namespace OHOS 92 93 #endif // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_HISTORY_EVENT_RECORD_H