Add stub DiscoveryManager

This commit is contained in:
Florian Märkl 2019-06-28 14:39:37 +02:00
commit b3cc46ee0f
No known key found for this signature in database
GPG key ID: 125BC8A5A6A1E857
3 changed files with 78 additions and 1 deletions

View file

@ -20,7 +20,9 @@ add_executable(chiaki
include/dynamicgridwidget.h
src/dynamicgridwidget.cpp
include/serveritemwidget.h
src/serveritemwidget.cpp)
src/serveritemwidget.cpp
include/discoverymanager.h
src/discoverymanager.cpp)
target_include_directories(chiaki PRIVATE include)
target_link_libraries(chiaki chiaki-lib)

View file

@ -0,0 +1,38 @@
/*
* This file is part of Chiaki.
*
* Chiaki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chiaki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef CHIAKI_DISCOVERYMANAGER_H
#define CHIAKI_DISCOVERYMANAGER_H
#include <QObject>
#include <chiaki/discoveryservice.h>
class DiscoveryManager : public QObject
{
Q_OBJECT
private:
ChiakiDiscoveryService service;
public:
explicit DiscoveryManager(QObject *parent = nullptr);
~DiscoveryManager();
};
#endif //CHIAKI_DISCOVERYMANAGER_H

View file

@ -0,0 +1,37 @@
/*
* This file is part of Chiaki.
*
* Chiaki is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chiaki is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chiaki. If not, see <https://www.gnu.org/licenses/>.
*/
#include <discoverymanager.h>
DiscoveryManager::DiscoveryManager(QObject *parent) : QObject(parent)
{
ChiakiDiscoveryServiceOptions options;
options.ping_ms = 500;
options.servers_max = 16;
options.send_addr = nullptr; // TODO
options.send_addr_size = 0; // TODO
ChiakiErrorCode err = chiaki_discovery_service_init(&service, &options, nullptr /* TODO */);
if(err != CHIAKI_ERR_SUCCESS)
throw std::exception();
}
DiscoveryManager::~DiscoveryManager()
{
chiaki_discovery_service_fini(&service);
}