X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdbus%2Fbus.h;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdbus%2Fbus.h;h=fe3eeac979a5bed8c60aac88a278cddbf6ca19fb;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/bus.h b/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/bus.h new file mode 100644 index 0000000..fe3eeac --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/dbus/bus.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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 this program. If not, see . + * + */ + +#ifndef ANBOX_DBUS_BUS_H_ +#define ANBOX_DBUS_BUS_H_ + +#include "anbox/do_not_copy_or_move.h" + +#include +#include +#include +#include + +#include + +namespace anbox { +namespace dbus { +class Bus : public DoNotCopyOrMove { + public: + enum class Type { + System, + Session + }; + + Bus(Type type); + ~Bus(); + + sd_bus* raw(); + + bool has_service_with_name(const std::string& name); + void run_async(); + void stop(); + + private: + void worker_main(); + + sd_bus *bus_ = nullptr; + std::thread worker_thread_; + std::atomic_bool running_{false}; +}; +using BusPtr = std::shared_ptr; +} // namespace dbus +} // namespace anbox + +#endif