Permalink
Browse files

WiimoteDevice: Make EventPagingChanged() a const member function

This only queries internal state, it doesn't modify it. With minor
adjustments to BTEmu, this also allows us to make its usage instance a
constant reference.
  • Loading branch information...
lioncash committed Jun 9, 2018
1 parent 38d155f commit f906785e88d330453620f9731a1abea3b6104a9b
@@ -339,7 +339,7 @@ void BluetoothEmu::Update()
// Create ACL connection
if (m_HCIEndpoint && (m_ScanEnable & HCI_PAGE_SCAN_ENABLE))
{
for (auto& wiimote : m_WiiMotes)
for (const auto& wiimote : m_WiiMotes)
{
if (wiimote.EventPagingChanged(m_ScanEnable))
SendEventRequestConnection(wiimote);
@@ -524,7 +524,7 @@ bool BluetoothEmu::SendEventConnectionComplete(const bdaddr_t& _bd)
}
// This is called from Update() after ScanEnable has been enabled.
bool BluetoothEmu::SendEventRequestConnection(WiimoteDevice& _rWiiMote)
bool BluetoothEmu::SendEventRequestConnection(const WiimoteDevice& _rWiiMote)
{
SQueuedEvent Event(sizeof(SHCIEventRequestConnection), 0);
@@ -112,7 +112,7 @@ class BluetoothEmu final : public BluetoothBase
bool SendEventInquiryResponse();
bool SendEventInquiryComplete();
bool SendEventRemoteNameReq(const bdaddr_t& _bd);
bool SendEventRequestConnection(WiimoteDevice& _rWiiMote);
bool SendEventRequestConnection(const WiimoteDevice& _rWiiMote);
bool SendEventConnectionComplete(const bdaddr_t& _bd);
bool SendEventReadClockOffsetComplete(u16 _connectionHandle);
bool SendEventConPacketTypeChange(u16 _connectionHandle, u16 _packetType);
@@ -222,7 +222,7 @@ void WiimoteDevice::EventDisconnect()
ResetChannels();
}
bool WiimoteDevice::EventPagingChanged(u8 page_mode)
bool WiimoteDevice::EventPagingChanged(u8 page_mode) const
{
return (m_ConnectionState == ConnectionState::Ready) && (page_mode & HCI_PAGE_SCAN_ENABLE);
}
@@ -40,7 +40,7 @@ class WiimoteDevice
void EventConnectionAccepted();
void EventDisconnect();
bool EventPagingChanged(u8 page_mode);
bool EventPagingChanged(u8 page_mode) const;
const bdaddr_t& GetBD() const { return m_BD; }
const uint8_t* GetClass() const { return uclass; }

0 comments on commit f906785

Please sign in to comment.