Add public function tdRemoveController() to telldus-core, see #108
This commit is contained in:
parent
3de0a98f89
commit
a766fe32de
5 changed files with 47 additions and 0 deletions
|
@ -276,6 +276,29 @@ std::wstring ControllerManager::getControllerValue(int id, const std::wstring &n
|
|||
return L"";
|
||||
}
|
||||
|
||||
int ControllerManager::removeController(int id) {
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
|
||||
ControllerMap::iterator it = d->controllers.find(id);
|
||||
if (it == d->controllers.end()) {
|
||||
return TELLSTICK_ERROR_NOT_FOUND;
|
||||
}
|
||||
if (it->second.controller) {
|
||||
//Still connected
|
||||
return TELLSTICK_ERROR_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
int ret = d->settings.removeNode(Settings::Controller, id);
|
||||
if (ret != TELLSTICK_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
d->controllers.erase(it);
|
||||
|
||||
//TODO: signal
|
||||
return TELLSTICK_SUCCESS;
|
||||
}
|
||||
|
||||
int ControllerManager::setControllerValue(int id, const std::wstring &name, const std::wstring &value) {
|
||||
TelldusCore::MutexLocker locker(&d->mutex);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue