mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-10 02:02:21 +02:00
OP-35 Add new method to connection manager to let a plugin initiate a disconnection. Needed for Uploader plugin.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2052 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
ba781dec9a
commit
f19439b1c7
@ -123,6 +123,35 @@ void ConnectionManager::aboutToRemoveObject(QObject *obj)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method called by plugins who want to force a disconnection. Used
|
||||||
|
* by Uploader gadget for instance.
|
||||||
|
*/
|
||||||
|
bool ConnectionManager::disconnectDevice()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Check if we are currently connected or not
|
||||||
|
if(!m_ioDev)
|
||||||
|
{
|
||||||
|
return false; // We were not connected
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//signal interested plugins that we are disconnecting the device
|
||||||
|
emit deviceDisconnected();
|
||||||
|
if(m_connectionDevice.connection)
|
||||||
|
{
|
||||||
|
m_connectionDevice.connection->closeDevice(m_connectionDevice.devName);
|
||||||
|
m_ioDev = NULL;
|
||||||
|
m_connectionDevice.connection = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_connectBtn->setText("Connect");
|
||||||
|
m_availableDevList->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slot called when the user pressed the connect/disconnect button
|
* Slot called when the user pressed the connect/disconnect button
|
||||||
*/
|
*/
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
QIODevice *getCurrentConnection();
|
QIODevice *getCurrentConnection();
|
||||||
|
bool disconnectDevice();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void unregisterAll(IConnection *connection);
|
void unregisterAll(IConnection *connection);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user