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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_DO_NOT_DISTURB_DATE_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_DO_NOT_DISTURB_DATE_H 18 19 #include "notification_constant.h" 20 #include "parcel.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class NotificationDoNotDisturbDate : public Parcelable { 25 public: 26 /** 27 * Default constructor used to create a NotificationDoNotDisturbDate instance. 28 */ 29 NotificationDoNotDisturbDate() = default; 30 31 /** 32 * A constructor used to create a NotificationDoNotDisturbDate instance with the input parameters passed. 33 * @param doNotDisturbType Indicates the do not disturb type to add. 34 * @param beginDate Indicates the begin time to add. 35 * @param endDate Indicates the begin time to add. 36 */ 37 NotificationDoNotDisturbDate(NotificationConstant::DoNotDisturbType doNotDisturbType, 38 int64_t beginDate, int64_t endDate); 39 40 /** 41 * Default deconstructor used to deconstruct. 42 */ 43 ~NotificationDoNotDisturbDate() = default; 44 45 /** 46 * Sets do not disturb type for this NotificationDoNotDisturbDate. 47 * @param doNotDisturbType Indicates the do not disturb type to add. 48 * For available values, see NotificationConstant::DoNotDisturbType. 49 */ 50 void SetDoNotDisturbType(NotificationConstant::DoNotDisturbType doNotDisturbType); 51 52 /** 53 * Obtains the do not disturb type of this NotificationDoNotDisturbDate. 54 * @return the do not disturb type of this NotificationDoNotDisturbDate, 55 * as enumerated in NotificationConstant::DoNotDisturbType. 56 */ 57 NotificationConstant::DoNotDisturbType GetDoNotDisturbType() const; 58 59 /** 60 * Sets begin time for this NotificationDoNotDisturbDate. 61 * @param beginDate Indicates the begin time to add. 62 */ 63 void SetBeginDate(const int64_t beginDate); 64 65 /** 66 * Obtains the begin time of this NotificationDoNotDisturbDate. 67 * @return the begin time of this NotificationDoNotDisturbDate. 68 */ 69 int64_t GetBeginDate() const; 70 71 /** 72 * Sets end time for this NotificationDoNotDisturbDate. 73 * @param endDate Indicates the end time to add. 74 */ 75 void SetEndDate(const int64_t endDate); 76 77 /** 78 * Obtains the end time of this NotificationDoNotDisturbDate. 79 * @return the end time of this NotificationDoNotDisturbDate. 80 */ 81 int64_t GetEndDate() const; 82 83 /** 84 * Returns a string representation of the object. 85 * @return a string representation of the object. 86 */ 87 std::string Dump(); 88 89 /** 90 * Marshal a object into a Parcel. 91 * @param parcel the object into the parcel 92 */ 93 virtual bool Marshalling(Parcel &parcel) const override; 94 95 /** 96 * Unmarshal object from a Parcel. 97 * @return the NotificationDoNotDisturbDate 98 */ 99 static NotificationDoNotDisturbDate *Unmarshalling(Parcel &parcel); 100 101 private: 102 /** 103 * Read a NotificationDoNotDisturbDate object from a Parcel. 104 * @param parcel the parcel 105 */ 106 bool ReadFromParcel(Parcel &parcel); 107 108 private: 109 NotificationConstant::DoNotDisturbType doNotDisturbType_ {NotificationConstant::DoNotDisturbType::NONE}; 110 int64_t beginDate_ {0}; 111 int64_t endDate_ {0}; 112 }; 113 } // namespace Notification 114 } // namespace OHOS 115 116 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_NOTIFICATION_DO_NOT_DISTURB_DATE_H