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,16 +111,21 @@ void SMX::SMXDevice::SendCommandLocked(string cmd, function<void()> pComplete)
|
||||
{
|
||||
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())
|
||||
{
|
||||
// If we're not connected, just call pComplete.
|
||||
if(pComplete)
|
||||
pComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user