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 16 #ifndef BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_BADGE_NUMBER_CALLBACK_DATA_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_BADGE_NUMBER_CALLBACK_DATA_H 18 19 #include "notification_constant.h" 20 #include "parcel.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class BadgeNumberCallbackData : public Parcelable { 25 public: 26 /** 27 * Default constructor used to create a BadgeNumberCallbackData instance. 28 */ 29 BadgeNumberCallbackData() = default; 30 31 /** 32 * A constructor used to create a BadgeNumberCallbackData instance with the input parameters passed. 33 * @param bundle Indicates the name of the application. 34 * @param uid Indicates the uid of the application. 35 * @param badgeNumber badge number. 36 */ 37 BadgeNumberCallbackData(const std::string &bundle, int32_t uid, int32_t badgeNumber); 38 39 /** 40 * Default deconstructor used to deconstruct. 41 */ 42 ~BadgeNumberCallbackData() = default; 43 44 void SetBundle(const std::string &bundle); 45 46 std::string GetBundle() const; 47 48 void SetUid(int32_t uid); 49 50 int32_t GetUid() const; 51 52 void SetBadgeNumber(int32_t badgeNumber); 53 54 int32_t GetBadgeNumber() const; 55 56 /** 57 * Returns a string representation of the BadgeNumberCallbackData object. 58 */ 59 std::string Dump(); 60 61 /** 62 * Marshal a object into a Parcel. 63 * @param parcel the object into the parcel 64 */ 65 bool Marshalling(Parcel &parcel) const override; 66 67 /** 68 * Unmarshal object from a Parcel. 69 * @return the BadgeNumberCallbackData 70 */ 71 static BadgeNumberCallbackData *Unmarshalling(Parcel &parcel); 72 73 private: 74 bool ReadFromParcel(Parcel &parcel); 75 76 std::string bundle_; 77 int32_t uid_; 78 int32_t badgeNumber_; 79 }; 80 } // namespace Notification 81 } // namespace OHOS 82 83 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_BADGE_NUMBER_CALLBACK_DATA_H