Initial import to Git
[profile/ivi/common-api-dbus-runtime.git] / src / CommonAPI / DBus / DBusDaemonProxy.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public\r
2  * License, v. 2.0. If a copy of the MPL was not distributed with this\r
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\r
4 #ifndef COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r
5 #define COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r
6 \r
7 #include "DBusProxy.h"\r
8 #include "DBusEvent.h"\r
9 \r
10 #include "DBusServiceStatusEvent.h"\r
11 \r
12 #include <string>\r
13 #include <vector>\r
14 \r
15 namespace CommonAPI {\r
16 namespace DBus {\r
17 \r
18 class DBusServiceStatusEvent;\r
19 \r
20 class DBusDaemonProxy: public DBusProxy {\r
21 \r
22  public:\r
23         typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;\r
24         typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback;\r
25         typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback;\r
26 \r
27 \r
28         DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& connection);\r
29 \r
30     const char* getInterfaceName() const;\r
31 \r
32     NameOwnerChangedEvent& getNameOwnerChangedEvent();\r
33 \r
34     void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;\r
35     std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;\r
36 \r
37     void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;\r
38     std::future<CallStatus> nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;\r
39 \r
40  protected:\r
41     void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;\r
42 \r
43  private:\r
44     DBusEvent<NameOwnerChangedEvent> nameOwnerChangedEvent_;\r
45 \r
46 };\r
47 \r
48 } // namespace DBus\r
49 } // namespace CommonAPI\r
50 \r
51 #endif // COMMONAPI_DBUS_DBUS_DAEMON_PROXY_H_\r