1 /* 2 * Copyright (C) Huawei Device Co., Ltd. 2025-2025. All rights reserved. 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 "bt_trust_pair_device.h" 17 18 namespace OHOS { 19 namespace bluetooth { SetMacAddress(const std::string & mac)20void TrustPairDevice::SetMacAddress(const std::string &mac) 21 { 22 macAddress_ = mac; 23 } 24 GetMacAddress() const25std::string TrustPairDevice::GetMacAddress() const 26 { 27 return macAddress_; 28 } 29 SetBluetoothClass(int32_t bluetoothClass)30void TrustPairDevice::SetBluetoothClass(int32_t bluetoothClass) 31 { 32 bluetoothClass_ = bluetoothClass; 33 } 34 GetBluetoothClass() const35int32_t TrustPairDevice::GetBluetoothClass() const 36 { 37 return bluetoothClass_; 38 } 39 SetDeviceName(const std::string & deviceName)40void TrustPairDevice::SetDeviceName(const std::string &deviceName) 41 { 42 deviceName_ = deviceName; 43 } 44 GetDeviceName() const45std::string TrustPairDevice::GetDeviceName() const 46 { 47 return deviceName_; 48 } 49 SetToken(const std::vector<uint8_t> & token)50void TrustPairDevice::SetToken(const std::vector<uint8_t> &token) 51 { 52 token_ = token; 53 } 54 GetToken()55std::vector<uint8_t> TrustPairDevice::GetToken() 56 { 57 return token_; 58 } 59 SetUuid(const std::vector<std::string> & uuids)60void TrustPairDevice::SetUuid(const std::vector<std::string> &uuids) 61 { 62 uuids_ = uuids; 63 } 64 GetUuid() const65std::vector<std::string> TrustPairDevice::GetUuid() const 66 { 67 return uuids_; 68 } 69 GetParseUuid()70std::vector<bluetooth::Uuid> TrustPairDevice::GetParseUuid() 71 { 72 std::vector<bluetooth::Uuid> uuidsExt; 73 uuidsExt.reserve(uuids_.size()); 74 for (const auto &str : uuids_) { 75 uuidsExt.emplace_back(bluetooth::Uuid::ConvertFromString(str)); 76 } 77 return uuidsExt; 78 } 79 SetSecureAdvertisingInfo(const std::vector<uint8_t> & randomDeviceInfo)80void TrustPairDevice::SetSecureAdvertisingInfo(const std::vector<uint8_t> &randomDeviceInfo) 81 { 82 secureAdvertisingInfo_ = randomDeviceInfo; 83 } 84 GetSecureAdvertisingInfo()85std::vector<uint8_t> TrustPairDevice::GetSecureAdvertisingInfo() 86 { 87 return secureAdvertisingInfo_; 88 } 89 } // namespace bluetooth 90 } // namespace OHOS 91