hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// Copyright 2020 Fuzhou Rockchip Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
#ifndef __STORAGE_MANAGER_PROXY_H__
#define __STORAGE_MANAGER_PROXY_H__
 
#include <dbus-c++/dbus.h>
#include <cassert>
 
class storage_manager_proxy
    : public ::DBus::InterfaceProxy
{
public:
 
    storage_manager_proxy(const char *interface)
        : ::DBus::InterfaceProxy(interface) {}
 
    /* properties exported by this interface */
public:
 
    /* methods exported by this interface,
     * this functions will invoke the corresponding methods on the remote objects
     */
    std::string GetFileList(const std::string& param)
    {
        std::string argout;
 
        ::DBus::CallMessage call;
        ::DBus::MessageIter wi = call.writer();
 
        wi << param;
        call.member("GetFileList");
        ::DBus::Message ret = invoke_method (call);
        ::DBus::MessageIter ri = ret.reader();
 
        ri >> argout;
 
        return argout;
    }
 
    std::string DiskFormat(const std::string& param)
    {
        std::string argout;
 
        ::DBus::CallMessage call;
        ::DBus::MessageIter wi = call.writer();
 
        wi << param;
        call.member("DiskFormat");
        ::DBus::Message ret = invoke_method (call);
        ::DBus::MessageIter ri = ret.reader();
 
        ri >> argout;
 
        return argout;
    }
 
    std::string GetMediaPath(const std::string& param)
    {
        std::string argout;
 
        ::DBus::CallMessage call;
        ::DBus::MessageIter wi = call.writer();
 
        wi << param;
        call.member("GetMediaPath");
        ::DBus::Message ret = invoke_method (call);
        ::DBus::MessageIter ri = ret.reader();
 
        ri >> argout;
 
        return argout;
    }
 
    std::string GetDisksStatus(const std::string& param)
    {
        std::string argout;
 
        ::DBus::CallMessage call;
        ::DBus::MessageIter wi = call.writer();
 
        wi << param;
        call.member("GetDisksStatus");
        ::DBus::Message ret = invoke_method (call);
        ::DBus::MessageIter ri = ret.reader();
 
        ri >> argout;
 
        return argout;
    }
 
    std::string MediaStorageStopNotify(const std::string& param)
    {
        std::string argout;
 
        ::DBus::CallMessage call;
        ::DBus::MessageIter wi = call.writer();
 
        wi << param;
        call.member("MediaStorageStopNotify");
        ::DBus::Message ret = invoke_method (call);
        ::DBus::MessageIter ri = ret.reader();
 
        ri >> argout;
 
        return argout;
    }
};
 
class DBusStorageManager : public storage_manager_proxy,
    public DBus::IntrospectableProxy,
    public DBus::ObjectProxy
{
public:
    DBusStorageManager(DBus::Connection &connection, const char *adaptor_path,
                       const char *adaptor_name, const char *interface)
    : DBus::ObjectProxy(0, connection, adaptor_path, adaptor_name), storage_manager_proxy::storage_manager_proxy(interface) {}
    ~DBusStorageManager() {}
};
#endif