Skip to content
Snippets Groups Projects
Commit 5237c352 authored by jpbl's avatar jpbl
Browse files

We added a getLine function

parent 648cf5cf
No related branches found
No related tags found
No related merge requests found
......@@ -178,6 +178,45 @@ PhoneLineManagerImpl::getNextAvailableLine()
return selectedLine;
}
PhoneLine *
PhoneLineManagerImpl::getLine(const Call &call)
{
isInitialized();
PhoneLine *selectedLine = NULL;
QMutexLocker guard(&mPhoneLinesMutex);
unsigned int i = 0;
while(i < mPhoneLines.size() && !selectedLine) {
mPhoneLines[i]->lock();
if(mPhoneLines[i]->getCallId() == call->id())
selectedLine = mPhoneLines[i];
}
else {
mPhoneLines[i]->unlock();
i++;
}
}
return selectedLine;
}
PhoneLine *
PhoneLineManagerImpl::getLine(unsigned int line)
{
isInitialized();
PhoneLine *selectedLine = NULL;
QMutexLocker guard(&mPhoneLinesMutex);
if(line < mPhoneLines.size()) {
selectedLine = mPhoneLines[line];
selectedLine->lock();
}
return selectedLine;
}
PhoneLine *
PhoneLineManagerImpl::selectNextAvailableLine()
{
......
......@@ -169,6 +169,21 @@ public slots:
*/
PhoneLine *getNextAvailableLine();
/**
* This function will return the PhoneLine with the
* given id. If there's no such line, it will return
* NULL. The line is locked, So you'll need to unlock it.
*/
PhoneLine *getLine(unsigned int line);
/**
* This function will return the PhoneLine with the
* given call id. If there's no such line, it will
* return NULL. The line is locked, So you'll need to
* unlock it.
*/
PhoneLine *getLine(const Call &call);
/**
* This function will return the next available line.
* The line is NOT locked.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment