mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
refs #334 FS9 DirectPlay peer classes using CContinuousWorker.
This commit is contained in:
committed by
Roland Winklmeier
parent
2a1541786a
commit
195c909ca0
@@ -23,8 +23,8 @@ namespace BlackSimPlugin
|
||||
{
|
||||
namespace Fs9
|
||||
{
|
||||
CFs9Host::CFs9Host(QObject *parent) :
|
||||
CDirectPlayPeer(CProject::systemNameAndVersion(), parent)
|
||||
CFs9Host::CFs9Host(QObject *owner) :
|
||||
CDirectPlayPeer(owner, CProject::systemNameAndVersion())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,39 +63,6 @@ namespace BlackSimPlugin
|
||||
return address;
|
||||
}
|
||||
|
||||
void CFs9Host::init()
|
||||
{
|
||||
initDirectPlay();
|
||||
createHostAddress();
|
||||
startHosting(CProject::systemNameAndVersion(), m_callsign);
|
||||
}
|
||||
|
||||
HRESULT CFs9Host::stopHosting()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (m_hostStatus == Terminated) return hr;
|
||||
|
||||
qDebug() << "Terminating host";
|
||||
|
||||
if (FAILED(hr = m_directPlayPeer->TerminateSession(nullptr, 0, 0)))
|
||||
{
|
||||
qWarning() << "Failed to terminate session!";
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (FAILED(hr = m_directPlayPeer->Close(0)))
|
||||
{
|
||||
qWarning() << "Failed to close peer!";
|
||||
return hr;
|
||||
}
|
||||
|
||||
m_hostStatus = Terminated;
|
||||
|
||||
emit statusChanged(m_hostStatus);
|
||||
return hr;
|
||||
}
|
||||
|
||||
void CFs9Host::sendTextMessage(const QString &textMessage)
|
||||
{
|
||||
MPChatText mpChatText;
|
||||
@@ -107,6 +74,19 @@ namespace BlackSimPlugin
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
void CFs9Host::initialize()
|
||||
{
|
||||
initDirectPlay();
|
||||
createHostAddress();
|
||||
startHosting(CProject::systemNameAndVersion(), m_callsign);
|
||||
}
|
||||
|
||||
void CFs9Host::cleanup()
|
||||
{
|
||||
stopHosting();
|
||||
}
|
||||
|
||||
|
||||
HRESULT CFs9Host::startHosting(const QString &session, const QString &callsign)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
@@ -170,5 +150,20 @@ namespace BlackSimPlugin
|
||||
emit statusChanged(m_hostStatus);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CFs9Host::stopHosting()
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (m_hostStatus == Terminated) return hr;
|
||||
|
||||
qDebug() << "Terminating host";
|
||||
hr = m_directPlayPeer->TerminateSession(nullptr, 0, 0);
|
||||
hr = m_directPlayPeer->Close(0);
|
||||
m_hostStatus = Terminated;
|
||||
|
||||
emit statusChanged(m_hostStatus);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user