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.
This commit is contained in:
Lioncash 2018-06-09 15:50:20 -04:00
parent 38d155f993
commit f906785e88
4 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -112,7 +112,7 @@ private:
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);

View File

@ -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);
}

View File

@ -40,7 +40,7 @@ public:
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; }