1 /* 2 * Copyright (c) 2025 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 OHOS_DP_BUSINESS_EVENT_H 17 #define OHOS_DP_BUSINESS_EVENT_H 18 19 #include <cstdint> 20 #include <string> 21 22 #include "distributed_device_profile_constants.h" 23 #include "dp_parcel.h" 24 #include "parcel.h" 25 26 namespace OHOS { 27 namespace DistributedDeviceProfile { 28 class BusinessEvent : public DpParcel { 29 public: BusinessEvent(const std::string & businessKey,const std::string & businessValue)30 BusinessEvent(const std::string& businessKey, const std::string& businessValue) 31 : businessKey_(businessKey), businessValue_(businessValue) {}; 32 33 BusinessEvent(); 34 ~BusinessEvent(); 35 36 std::string GetBusinessKey() const; 37 void SetBusinessKey(const std::string& businessKey); 38 std::string GetBusinessValue() const; 39 void SetBusinessValue(const std::string& businessValue); 40 bool Marshalling(MessageParcel& parcel) const override; 41 bool UnMarshalling(MessageParcel& parcel) override; 42 std::string dump() const override; 43 44 private: 45 std::string businessKey_ = ""; 46 std::string businessValue_ = ""; 47 }; 48 49 class BusinessEventExt : public Parcelable { 50 public: BusinessEventExt(const std::string & businessKey,const std::string & businessValue)51 BusinessEventExt(const std::string& businessKey, const std::string& businessValue) 52 : businessKey_(businessKey), businessValue_(businessValue) {}; 53 54 BusinessEventExt(); 55 ~BusinessEventExt(); 56 57 std::string GetBusinessKey() const; 58 void SetBusinessKey(const std::string& businessKey); 59 std::string GetBusinessValue() const; 60 void SetBusinessValue(const std::string& businessValue); 61 bool Marshalling(Parcel &parcel) const override; 62 static BusinessEventExt *Unmarshalling(Parcel &parcel); 63 64 private: 65 std::string businessKey_ = ""; 66 std::string businessValue_ = ""; 67 }; 68 } // namespace DistributedDeviceProfile 69 } // namespace OHOS 70 #endif //OHOS_DP_BUSINESS_EVENT_H 71 72