Skip to content

Commit

Permalink
fix code review
Browse files Browse the repository at this point in the history
  • Loading branch information
cassio-lazaro committed Jan 14, 2025
1 parent 7e513fb commit 0975ed6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (HALST_STANDALONE)
FetchContent_Declare(
emil
GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib.git
GIT_TAG 863b57558fa785625d96758a3cbdcbbdd73ac8bd # unreleased
GIT_TAG 90aaaf3f3c42c06db362344c9cd123efea164f93 # unreleased
)
FetchContent_MakeAvailable(emil)

Expand Down
8 changes: 4 additions & 4 deletions hal_st/middlewares/ble_middleware/GapCentralSt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ namespace hal
aci_gap_terminate_gap_proc(GAP_GENERAL_DISCOVERY_PROC);
}

infra::Optional<hal::MacAddress> GapCentralSt::ResolveDeviceAddress(hal::MacAddress deviceAddress) const
infra::Optional<hal::MacAddress> GapCentralSt::ResolvePrivateAddress(hal::MacAddress address) const
{
hal::MacAddress address;
if (aci_gap_resolve_private_addr(deviceAddress.data(), address.data()) != BLE_STATUS_SUCCESS)
hal::MacAddress identityAddress;
if (aci_gap_resolve_private_addr(address.data(), identityAddress.data()) != BLE_STATUS_SUCCESS)
return infra::none;
return infra::MakeOptional(address);
return infra::MakeOptional(identityAddress);
}

void GapCentralSt::AllowPairing(bool)
Expand Down
2 changes: 1 addition & 1 deletion hal_st/middlewares/ble_middleware/GapCentralSt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace hal
void SetAddress(hal::MacAddress macAddress, services::GapDeviceAddressType addressType) override;
void StartDeviceDiscovery() override;
void StopDeviceDiscovery() override;
infra::Optional<hal::MacAddress> ResolveDeviceAddress(hal::MacAddress deviceAddress) const override;
infra::Optional<hal::MacAddress> ResolvePrivateAddress(hal::MacAddress address) const override;

// Implementation of GapPairing
void AllowPairing(bool allow) override;
Expand Down
4 changes: 2 additions & 2 deletions hal_st/middlewares/ble_middleware/GapSt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ namespace hal
return numberOfBondedAddress;
}

bool GapSt::IsDeviceBonded(MacAddress deviceAddress) const
bool GapSt::IsDeviceBonded(MacAddress identityAddress) const
{
return aci_gap_is_device_bonded(static_cast<uint8_t>(PeerAddressType::publicStatic), deviceAddress.data()) == BLE_STATUS_SUCCESS;
return aci_gap_is_device_bonded(static_cast<uint8_t>(PeerAddressType::publicStatic), identityAddress.data()) == BLE_STATUS_SUCCESS;
}

void GapSt::Pair()
Expand Down
2 changes: 1 addition & 1 deletion hal_st/middlewares/ble_middleware/GapSt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace hal
void RemoveOldestBond() override;
std::size_t GetMaxNumberOfBonds() const override;
std::size_t GetNumberOfBonds() const override;
bool IsDeviceBonded(MacAddress deviceAddress) const override;
bool IsDeviceBonded(MacAddress identityAddress) const override;

// Implementation of GapPairing
void Pair() override;
Expand Down
12 changes: 6 additions & 6 deletions hal_st/middlewares/ble_middleware/TracingGapCentralSt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ namespace hal
GapCentralSt::StopDeviceDiscovery();
}

infra::Optional<hal::MacAddress> TracingGapCentralSt::ResolveDeviceAddress(hal::MacAddress deviceAddress) const
infra::Optional<hal::MacAddress> TracingGapCentralSt::ResolvePrivateAddress(hal::MacAddress address) const
{
auto resolvedMac = GapCentralSt::ResolveDeviceAddress(deviceAddress);
tracer.Trace() << "TracingGapCentralSt::ResolveDeviceAddress, MAC address: " << infra::AsMacAddress(deviceAddress);
auto resolvedMac = GapCentralSt::ResolvePrivateAddress(address);
tracer.Trace() << "TracingGapCentralSt::ResolvePrivateAddress, MAC address: " << infra::AsMacAddress(address);
if (resolvedMac)
tracer.Continue() << ", resolved MAC address " << infra::AsMacAddress(*resolvedMac);
else
Expand Down Expand Up @@ -80,10 +80,10 @@ namespace hal
return GapCentralSt::GetNumberOfBonds();
}

bool TracingGapCentralSt::IsDeviceBonded(hal::MacAddress deviceAddress) const
bool TracingGapCentralSt::IsDeviceBonded(hal::MacAddress identityAddress) const
{
auto ret = GapCentralSt::IsDeviceBonded(deviceAddress);
tracer.Trace() << "TracingGapCentralSt::IsDeviceBonded " << infra::AsMacAddress(deviceAddress) << " -> " << (ret ? "true" : "false");
auto ret = GapCentralSt::IsDeviceBonded(identityAddress);
tracer.Trace() << "TracingGapCentralSt::IsDeviceBonded " << infra::AsMacAddress(identityAddress) << " -> " << (ret ? "true" : "false");
return ret;
}

Expand Down
4 changes: 2 additions & 2 deletions hal_st/middlewares/ble_middleware/TracingGapCentralSt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ namespace hal
void SetAddress(hal::MacAddress macAddress, services::GapDeviceAddressType addressType) override;
void StartDeviceDiscovery() override;
void StopDeviceDiscovery() override;
infra::Optional<hal::MacAddress> ResolveDeviceAddress(hal::MacAddress deviceAddress) const override;
infra::Optional<hal::MacAddress> ResolvePrivateAddress(hal::MacAddress address) const override;

// Implementation of GapBonding
void RemoveAllBonds() override;
void RemoveOldestBond() override;
std::size_t GetMaxNumberOfBonds() const override;
std::size_t GetNumberOfBonds() const override;
bool IsDeviceBonded(hal::MacAddress deviceAddress) const override;
bool IsDeviceBonded(hal::MacAddress identityAddress) const override;

// Implementation of GapPairing
void Pair() override;
Expand Down

0 comments on commit 0975ed6

Please sign in to comment.