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 OHOS_DP_SERVICE_PROFILE_H 17 #define OHOS_DP_SERVICE_PROFILE_H 18 19 #include <cstdint> 20 #include <string> 21 #include "distributed_device_profile_constants.h" 22 #include "dp_parcel.h" 23 24 namespace OHOS { 25 namespace DistributedDeviceProfile { 26 class ServiceProfile : public DpParcel { 27 public: 28 ServiceProfile(const std::string& deviceId, const std::string& serviceName, const std::string& serviceType); 29 ServiceProfile(const std::string& deviceId, const std::string& serviceName, const std::string& serviceType, 30 const bool isMultiUser, const int32_t userId); 31 ServiceProfile(); 32 ~ServiceProfile(); 33 34 std::string GetDeviceId() const; 35 void SetDeviceId(const std::string& deviceId); 36 std::string GetServiceName() const; 37 void SetServiceName(const std::string& serviceName); 38 std::string GetServiceType() const; 39 void SetServiceType(const std::string& serviceType); 40 bool IsMultiUser() const; 41 void SetIsMultiUser(bool isMultiUser); 42 int32_t GetUserId() const; 43 void SetUserId(int32_t userId); 44 bool Marshalling(MessageParcel& parcel) const override; 45 bool UnMarshalling(MessageParcel& parcel) override; 46 bool operator!=(const ServiceProfile& serviceProfile) const; 47 std::string dump() const override; 48 49 private: 50 std::string deviceId_ = ""; 51 std::string serviceName_ = ""; 52 std::string serviceType_ = ""; 53 bool isMultiUser_ = false; 54 int32_t userId_ = DEFAULT_USER_ID; 55 }; 56 } // namespace DistributedDeviceProfile 57 } // namespace OHOS 58 #endif //OHOS_DP_SERVICE_PROFILE_H 59