Commit b6827a06 authored by Bryan Godbolt's avatar Bryan Godbolt

added disconnect to OpalLink

OpalLink should now be able to be disconnected.  I also added a test to see if params had already been allocated before calling new in OpalLink::connect()
parent 5679e5a4
......@@ -38,7 +38,8 @@ OpalLink::OpalLink() :
getSignalsPeriod(10),
receiveBuffer(new QQueue<QByteArray>()),
systemID(1),
componentID(1)
componentID(1),
params(NULL)
{
start(QThread::LowPriority);
......@@ -306,7 +307,8 @@ bool OpalLink::connect()
&& (OpalGetParameterControl(true) == EOK))
{
connectState = true;
/// \todo try/catch a delete in case params has already been allocated
if (params)
delete params;
params = new OpalRT::ParameterList();
emit connected();
heartbeatTimer->start(1000/heartbeatRate);
......@@ -324,7 +326,11 @@ bool OpalLink::connect()
bool OpalLink::disconnect()
{
return false;
// OpalDisconnect returns void so its success or failure cannot be tested
OpalDisconnect();
heartbeatTimer->stop();
getSignalsTimer->stop();
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment