1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "gd/rust/topshim/common/utils.h" 18 19 #include "src/btif.rs.h" 20 21 using bluetooth::topshim::rust::RustRawAddress; 22 23 namespace bluetooth { 24 namespace topshim { 25 namespace rust { 26 CopyToRustAddress(const RawAddress & address)27RustRawAddress CopyToRustAddress(const RawAddress& address) { 28 RustRawAddress raddr; 29 std::copy(std::begin(address.address), std::end(address.address), std::begin(raddr.address)); 30 return raddr; 31 } 32 CopyFromRustAddress(const RustRawAddress & rust_address)33RawAddress CopyFromRustAddress(const RustRawAddress& rust_address) { 34 RawAddress addr; 35 addr.FromOctets(rust_address.address.data()); 36 return addr; 37 } 38 39 } // namespace rust 40 } // namespace topshim 41 } // namespace bluetooth 42