1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 // https://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, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14
15 #include "pw_bluetooth_sapphire/internal/host/hci/fake_low_energy_connection.h"
16
17 namespace bt::hci::testing {
18
FakeLowEnergyConnection(hci_spec::ConnectionHandle handle,const DeviceAddress & local_address,const DeviceAddress & peer_address,pw::bluetooth::emboss::ConnectionRole role,const hci::Transport::WeakPtr & hci)19 FakeLowEnergyConnection::FakeLowEnergyConnection(
20 hci_spec::ConnectionHandle handle,
21 const DeviceAddress& local_address,
22 const DeviceAddress& peer_address,
23 pw::bluetooth::emboss::ConnectionRole role,
24 const hci::Transport::WeakPtr& hci)
25 : LowEnergyConnection(handle,
26 local_address,
27 peer_address,
28 hci_spec::LEConnectionParameters(),
29 role,
30 hci) {}
31
TriggerEncryptionChangeCallback(hci::Result<bool> result)32 void FakeLowEnergyConnection::TriggerEncryptionChangeCallback(
33 hci::Result<bool> result) {
34 PW_CHECK(encryption_change_callback());
35 encryption_change_callback()(result);
36 }
37
StartEncryption()38 bool FakeLowEnergyConnection::StartEncryption() {
39 start_encryption_count_++;
40 return true;
41 }
42
43 } // namespace bt::hci::testing
44