-
Notifications
You must be signed in to change notification settings - Fork 0
/
DBusClient.h
executable file
·51 lines (44 loc) · 1.26 KB
/
DBusClient.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef DBUSCLIENT_H
#define DBUSCLIENT_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dbus/dbus.h>
#include <unistd.h>
#include <algorithm>
#include <string>
#include "DaemonService.h"
#include "Logger.h"
#include "Backtrace.h"
class DBusClient
{
public:
explicit DBusClient();
virtual ~DBusClient();
virtual int init(const char *service);
virtual int deinit();
const char *get_support_type(const DBUS_TYPE_INDEX index);
int register_service();
// client can create multiple msg into one transation
int create_transation(const char* host_name, const DBUS_TYPE_INDEX index);
int append_string_transation(const char *value);
int append_integer32_transation(const int32_t value);
int append_integer64_transation(const int64_t value);
int append_float_transation(const float value);
int commit_transation_with_reply();
int commit_transation_without_reply();
int abort_transation();
protected:
bool exit_flag;
bool already_init;
Backtrace trace;
DBusError err;
DBusConnection *conn;
std::string service_name;
std::string bus_name;
std::string object_name;
std::string interface_name;
DBusMessage *dbus_msg;
DBusMessageIter send_items;
};
#endif /* DBUSCLIENT_H */