1 /* 2 * Copyright (c) 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 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CHECK_REQUEST_H 16 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CHECK_REQUEST_H 17 18 #include "parcel.h" 19 #include "notification_content.h" 20 #include "notification_constant.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class NotificationCheckRequest : public Parcelable { 25 public: 26 NotificationCheckRequest() = default; 27 28 /** 29 * @brief A constructor used to create a NotificationCheckRequest instance based on the filter condition. 30 * 31 * @param contentType Indicates type of notification content. 32 * @param SlotType Indicates type of slot. 33 * @param extraInfoKeys Indicates keys of extra info that need to be filtered. 34 */ 35 NotificationCheckRequest(NotificationContent::Type contentType, NotificationConstant::SlotType slotType, 36 std::vector<std::string> extraInfoKeys); 37 38 ~NotificationCheckRequest(); 39 40 /** 41 * @brief Returns a string representation of the object. 42 * 43 * @return Returns a string representation of the object. 44 */ 45 std::string Dump(); 46 47 /** 48 * @brief Sets the content type of a notification check request. 49 * 50 * @param contentType Indicates the content type of the notification check request. 51 */ 52 void SetContentType(NotificationContent::Type contentType); 53 54 /** 55 * @brief Obtains the content type of a notification check request. 56 * 57 * @return Returns the content type of a notification check request. 58 */ 59 NotificationContent::Type GetContentType() const; 60 61 /** 62 * @brief Sets the slot type of a notification check request. 63 * 64 * @param slotType Indicates the slot type of the notification check request. 65 */ 66 void SetSlotType(NotificationConstant::SlotType slotType); 67 68 /** 69 * @brief Obtains the slot type of a notification check request. 70 * 71 * @return Returns the slot type of a notification check request. 72 */ 73 NotificationConstant::SlotType GetSlotType() const; 74 75 /** 76 * @brief Sets the extra info keys of a notification check request. 77 * 78 * @param extraKeys Indicates the extra info keys of the notification check request. 79 */ 80 void SetExtraKeys(std::vector<std::string> extraKeys); 81 82 /** 83 * @brief Obtains the extra info keys of a notification check request. 84 * 85 * @return Returns the extra info keys of a notification check request. 86 */ 87 std::vector<std::string> GetExtraKeys() const; 88 89 /** 90 * @brief Sets the creator uid. 91 * 92 * @param uid Indicates the creator uid. 93 */ 94 void SetUid(const int32_t uid); 95 96 /** 97 * @brief Obtains the creator uid. 98 * 99 * @return Returns the creator uid. 100 */ 101 int32_t GetUid() const; 102 103 /** 104 * @brief Marshal a object into a Parcel. 105 * 106 * @param parcel Indicates the object into the parcel 107 * @return Returns true if succeed; returns false otherwise. 108 */ 109 virtual bool Marshalling(Parcel &parcel) const override; 110 111 /** 112 * @brief Unmarshal object from a Parcel. 113 * 114 * @param parcel Indicates the parcel object. 115 * @return Returns the NotificationBundleOption 116 */ 117 static NotificationCheckRequest *Unmarshalling(Parcel &parcel); 118 119 bool ReadFromParcel(Parcel &parcel); 120 121 private: 122 NotificationContent::Type contentType_ {}; 123 NotificationConstant::SlotType slotType_ {}; 124 std::vector<std::string> extraKeys_ {}; 125 int32_t creatorUid_ {}; 126 }; 127 } // namespace Notification 128 } // namespace OHOS 129 130 #endif //BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_CHECK_REQUEST_H 131