1 /* 2 * Copyright (C) 2022 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 #include <gtest/gtest.h> 17 #include "common_event_subscribe_info.h" 18 19 namespace OHOS { 20 namespace EventFwk { CommonEventSubscribeInfo(const MatchingSkills & matchingSkills)21CommonEventSubscribeInfo::CommonEventSubscribeInfo(const MatchingSkills& matchingSkills) 22 : matchingSkills_(matchingSkills), priority_(0), threadMode_(CommonEventSubscribeInfo::ASYNC) 23 {} 24 CommonEventSubscribeInfo()25CommonEventSubscribeInfo::CommonEventSubscribeInfo() : priority_(0), threadMode_(CommonEventSubscribeInfo::ASYNC) 26 {} 27 CommonEventSubscribeInfo(const CommonEventSubscribeInfo & commonEventSubscribeInfo)28CommonEventSubscribeInfo::CommonEventSubscribeInfo(const CommonEventSubscribeInfo& commonEventSubscribeInfo) 29 { 30 matchingSkills_ = commonEventSubscribeInfo.matchingSkills_; 31 priority_ = commonEventSubscribeInfo.priority_; 32 permission_ = commonEventSubscribeInfo.permission_; 33 deviceId_ = commonEventSubscribeInfo.deviceId_; 34 threadMode_ = commonEventSubscribeInfo.threadMode_; 35 } 36 ~CommonEventSubscribeInfo()37CommonEventSubscribeInfo::~CommonEventSubscribeInfo() 38 {} 39 SetPriority(const int32_t & priority)40void CommonEventSubscribeInfo::SetPriority(const int32_t& priority) 41 { 42 priority_ = priority; 43 } 44 GetPriority() const45int32_t CommonEventSubscribeInfo::GetPriority() const 46 { 47 return priority_; 48 } 49 SetPermission(const std::string & permission)50void CommonEventSubscribeInfo::SetPermission(const std::string& permission) 51 { 52 GTEST_LOG_(INFO) << "MOCK CommonEventSubscribeInfo SetPermission"; 53 permission_ = permission; 54 } 55 GetPermission() const56std::string CommonEventSubscribeInfo::GetPermission() const 57 { 58 return permission_; 59 } 60 GetThreadMode() const61CommonEventSubscribeInfo::ThreadMode CommonEventSubscribeInfo::GetThreadMode() const 62 { 63 return threadMode_; 64 } 65 SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode)66void CommonEventSubscribeInfo::SetThreadMode(CommonEventSubscribeInfo::ThreadMode threadMode) 67 { 68 threadMode_ = threadMode; 69 } 70 SetDeviceId(const std::string & deviceId)71void CommonEventSubscribeInfo::SetDeviceId(const std::string& deviceId) 72 { 73 deviceId_ = deviceId; 74 } 75 GetDeviceId() const76std::string CommonEventSubscribeInfo::GetDeviceId() const 77 { 78 return deviceId_; 79 } 80 GetMatchingSkills() const81const MatchingSkills& CommonEventSubscribeInfo::GetMatchingSkills() const 82 { 83 return matchingSkills_; 84 } 85 Marshalling(Parcel & parcel) const86bool CommonEventSubscribeInfo::Marshalling(Parcel& parcel) const 87 { 88 return true; 89 } 90 ReadFromParcel(Parcel & parcel)91bool CommonEventSubscribeInfo::ReadFromParcel(Parcel& parcel) 92 { 93 return true; 94 } 95 Unmarshalling(Parcel & parcel)96CommonEventSubscribeInfo* CommonEventSubscribeInfo::Unmarshalling(Parcel& parcel) 97 { 98 CommonEventSubscribeInfo* commonEventSubscribeInfo = new CommonEventSubscribeInfo(); 99 return commonEventSubscribeInfo; 100 } 101 } // namespace EventFwk 102 } // namespace OHOS