mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Add stub DiscoveryManager
This commit is contained in:
parent
08137faaff
commit
b3cc46ee0f
3 changed files with 78 additions and 1 deletions
|
@ -20,7 +20,9 @@ add_executable(chiaki
|
||||||
include/dynamicgridwidget.h
|
include/dynamicgridwidget.h
|
||||||
src/dynamicgridwidget.cpp
|
src/dynamicgridwidget.cpp
|
||||||
include/serveritemwidget.h
|
include/serveritemwidget.h
|
||||||
src/serveritemwidget.cpp)
|
src/serveritemwidget.cpp
|
||||||
|
include/discoverymanager.h
|
||||||
|
src/discoverymanager.cpp)
|
||||||
target_include_directories(chiaki PRIVATE include)
|
target_include_directories(chiaki PRIVATE include)
|
||||||
|
|
||||||
target_link_libraries(chiaki chiaki-lib)
|
target_link_libraries(chiaki chiaki-lib)
|
||||||
|
|
38
gui/include/discoverymanager.h
Normal file
38
gui/include/discoverymanager.h
Normal 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
|
37
gui/src/discoverymanager.cpp
Normal file
37
gui/src/discoverymanager.cpp
Normal 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);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue