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_OPERATION_INFO_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_OPERATION_INFO_H 18 19 #include "parcel.h" 20 #include <cstdint> 21 #include <string> 22 23 namespace OHOS { 24 namespace Notification { 25 26 enum OperationType { 27 DISTRIBUTE_OPERATION_JUMP = 0, 28 DISTRIBUTE_OPERATION_REPLY, 29 DISTRIBUTE_OPERATION_JUMP_BY_TYPE 30 }; 31 32 class NotificationOperationInfo : public Parcelable { 33 public: 34 NotificationOperationInfo() = default; 35 36 ~NotificationOperationInfo() = default; 37 38 /** 39 * @brief Obtains the initialTime. 40 * 41 * @return Returns the initialTime. 42 */ 43 std::string GetActionName() const; 44 45 void SetActionName(const std::string& actionName); 46 47 /** 48 * @brief Obtains the initialTime. 49 * 50 * @return Returns the initialTime. 51 */ 52 std::string GetUserInput() const; 53 54 void SetUserInput(const std::string& userInput); 55 56 std::string GetHashCode() const; 57 58 void SetHashCode(const std::string& hashCode); 59 60 std::string GetEventId() const; 61 62 void SetEventId(const std::string& eventId); 63 64 OperationType GetOperationType() const; 65 66 void SetOperationType(const OperationType& operationType); 67 68 int32_t GetBtnIndex() const; 69 70 void SetBtnIndex(const int32_t btnIndex); 71 72 int32_t GetJumpType() const; 73 74 void SetJumpType(const int32_t jumpType); 75 76 std::string GetNotificationUdid() const; 77 78 void SetNotificationUdid(const std::string& udid); 79 80 std::string Dump(); 81 82 /** 83 * @brief Marshal a object into a Parcel. 84 * 85 * @param parcel Indicates the object into the parcel. 86 * @return Returns true if succeed; returns false otherwise. 87 */ 88 bool Marshalling(Parcel &parcel) const override; 89 90 /** 91 * @brief Unmarshal object from a Parcel. 92 * 93 * @param parcel Indicates the parcel object. 94 * @return Returns the NotificationOperationInfo. 95 */ 96 static NotificationOperationInfo *Unmarshalling(Parcel &parcel); 97 98 private: 99 100 bool ReadFromParcel(Parcel &parcel); 101 102 std::string actionName_; 103 std::string userInput_; 104 std::string hashCode_; 105 std::string eventId_; 106 int32_t btnIndex_; 107 int32_t jumpType_; 108 std::string notificationUdid_; 109 OperationType operationType_; 110 }; 111 } // namespace Notification 112 } // namespace OHOS 113 114 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_INTERFACES_INNER_API_TIME_H 115