Make sure we call the callback from SendCommandLocked if the device isn't connected and we're not queueing the command.
This commit is contained in:
parent
159a9a4da2
commit
880774f9e4
@ -111,15 +111,20 @@ void SMX::SMXDevice::SendCommandLocked(string cmd, function<void()> pComplete)
|
|||||||
{
|
{
|
||||||
m_Lock.AssertLockedByCurrentThread();
|
m_Lock.AssertLockedByCurrentThread();
|
||||||
|
|
||||||
// This call is nonblocking, so it's safe to do this in the UI thread.
|
if(!m_pConnection->IsConnected())
|
||||||
if(m_pConnection->IsConnected())
|
|
||||||
{
|
{
|
||||||
m_pConnection->SendCommand(cmd, pComplete);
|
// If we're not connected, just call pComplete.
|
||||||
|
if(pComplete)
|
||||||
// Wake up the communications thread to send the message.
|
pComplete();
|
||||||
if(m_hEvent)
|
return;
|
||||||
SetEvent(m_hEvent->value());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This call is nonblocking, so it's safe to do this in the UI thread.
|
||||||
|
m_pConnection->SendCommand(cmd, pComplete);
|
||||||
|
|
||||||
|
// Wake up the communications thread to send the message.
|
||||||
|
if(m_hEvent)
|
||||||
|
SetEvent(m_hEvent->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMX::SMXDevice::GetInfo(SMXInfo &info)
|
void SMX::SMXDevice::GetInfo(SMXInfo &info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user