/usr/include/mediascanner-1.0/mediascanner/dbusservice.h is in libmediascanner-dev 0.3.93+14.04.20131024.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | /*
* This file is part of the Ubuntu TV Media Scanner
* Copyright (C) 2012-2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contact: Jim Hodapp <jim.hodapp@canonical.com>
* Authored by: Mathias Hasselmann <mathias@openismus.com>
*/
#ifndef MEDIASCANNER_DBUSSERVICE_H
#define MEDIASCANNER_DBUSSERVICE_H
// C++ Standard Library
#include <set>
#include <string>
#include <vector>
// Media Scanner Library
#include "mediascanner/dbusutils.h"
#include "mediascanner/mediautils.h"
namespace mediascanner {
namespace dbus {
using std::set;
using std::string;
using std::vector;
enum MediaChangeType {
MEDIA_INFO_CREATED,
MEDIA_INFO_UPDATED,
MEDIA_INFO_REMOVED
};
template<typename InterfaceType>
class MediaScannerInterface : public InterfaceType {
private:
typedef typename MethodTrait
< InterfaceType,
ArgumentList<string>,
ArgumentList<bool> >::
type MediaInfoExistsMethodType;
typedef typename MethodTrait
< InterfaceType,
ArgumentList<string, vector<string> >,
ArgumentList<MediaInfo> >::
type LookupMediaInfoMethodType;
typedef typename MethodTrait
< InterfaceType,
ArgumentList<string, vector<string>, int32_t, int32_t> >::
type QueryMediaInfoMethodType;
typedef typename MethodTrait
< InterfaceType,
ArgumentList< MediaInfo >,
ArgumentList< set<string> > >::
type StoreMediaInfoMethodType;
typedef typename MethodTrait
< InterfaceType, ArgumentList<string> >::
type RemoveMediaInfoMethodType;
typedef typename PropertyTrait
< InterfaceType, ReadOnly, string >::
type IndexPathPropertyType;
typedef typename PropertyTrait
< InterfaceType, ReadOnly, vector<string> >::
type MediaRootsPropertyType;
typedef typename SignalTrait
< InterfaceType, ArgumentList<uint32_t, vector<MediaInfo> > >::
type MediaInfoAvailableSignalType;
typedef typename SignalTrait
< InterfaceType, ArgumentList<MediaChangeType, vector<string> > >::
type MediaInfoChangedSignalType;
public:
class MediaInfoExistsMethod : public MediaInfoExistsMethodType {
public:
typedef MediaInfoExistsMethodType inherited;
typedef typename inherited::input_args_type input_args_type;
typedef typename inherited::output_args_type output_args_type;
explicit MediaInfoExistsMethod(InterfaceType *parent = nullptr)
: inherited(parent, "MediaInfoExists",
input_args_type(Argument<string>("url")),
output_args_type(Argument<bool>("exists"))) {
}
};
class LookupMediaInfoMethod : public LookupMediaInfoMethodType {
public:
typedef LookupMediaInfoMethodType inherited;
typedef typename inherited::input_args_type input_args_type;
typedef typename inherited::output_args_type output_args_type;
explicit LookupMediaInfoMethod(InterfaceType *parent = nullptr)
: inherited(parent, "LookupMediaInfo",
input_args_type(Argument<string>("url"),
Argument<vector<string> >("fields")),
output_args_type(Argument<MediaInfo>("item"))) {
}
};
class QueryMediaInfoMethod : public QueryMediaInfoMethodType {
public:
typedef QueryMediaInfoMethodType inherited;
typedef typename inherited::input_args_type input_args_type;
typedef typename inherited::output_args_type output_args_type;
explicit QueryMediaInfoMethod(InterfaceType *parent = nullptr)
: inherited(parent, "QueryMediaInfo",
input_args_type(Argument<string>("query"),
Argument<vector<string> >("fields"),
Argument<int32_t>("offset"),
Argument<int32_t>("limit"))) {
}
};
/**
* @brief This class implements the @c StoreMediaInfo method of the media
* scanner's D-Bus service. It inserts new media information into the index.
* The actual URL of the media information is retreived from @p item.
* @param[in] item A key-value map of the information to store.
* @see WritableMediaIndex::Insert()
* @ingroup dbus
*/
class StoreMediaInfoMethod : public StoreMediaInfoMethodType {
public:
typedef StoreMediaInfoMethodType inherited;
typedef typename inherited::input_args_type input_args_type;
typedef typename inherited::output_args_type output_args_type;
explicit StoreMediaInfoMethod(InterfaceType *parent = nullptr)
: inherited(parent, "StoreMediaInfo",
input_args_type(Argument<MediaInfo>("item")),
output_args_type(Argument<set<string> >("bad_keys"))) {
}
};
/**
* @brief This class implements the @c RemoveMediaInfo method of the media
* scanner's D-Bus service. It removes all information about the media
* referenced by @p url.
* @param[in] url The URL of the media to remove.
* @see WritableMediaIndex::Delete()
* @ingroup dbus
*/
class RemoveMediaInfoMethod : public RemoveMediaInfoMethodType {
public:
typedef RemoveMediaInfoMethodType inherited;
typedef typename inherited::input_args_type input_args_type;
typedef typename inherited::output_args_type output_args_type;
explicit RemoveMediaInfoMethod(InterfaceType *parent = nullptr)
: inherited(parent, "RemoveMediaInfo",
input_args_type(Argument<string>("url"))) {
}
};
/**
* @brief This class implements the @c IndexPath property of the media
* scanner's D-Bus service. It contains the local file system path of
* the media index.
* @see MediaIndex::path()
* @ingroup dbus
*/
class IndexPathProperty : public IndexPathPropertyType {
public:
typedef IndexPathPropertyType inherited;
IndexPathProperty()
: inherited("IndexPath") {
}
};
/**
* @brief This class implements the @c MediaRoots property of the media
* scanner's D-Bus service. It contains the paths of all the directories the
* file system scanner is watching.
* the media index.
* @see FileSystemScanner::directories()
* @ingroup dbus
*/
class MediaRootsProperty : public MediaRootsPropertyType {
public:
typedef MediaRootsPropertyType inherited;
MediaRootsProperty()
: inherited("MediaRoots") {
}
};
class MediaInfoAvailableSignal : public MediaInfoAvailableSignalType {
public:
typedef MediaInfoAvailableSignalType inherited;
typedef typename inherited::args_type args_type;
MediaInfoAvailableSignal()
: inherited("MediaInfoAvailable",
args_type(Argument<uint32_t>("serial"),
Argument<vector<MediaInfo> >("items"))) {
}
};
/**
* @brief This class describes the @c MediaInfoChanged signal of the media
* scanner's D-Bus service. This signal is emitted when the media index
* updates media information. It is emitted in batches to reduce load.
* @param items A list of key-value maps of the stored information.
* @ingroup dbus
*/
class MediaInfoChangedSignal : public MediaInfoChangedSignalType {
public:
typedef MediaInfoChangedSignalType inherited;
typedef typename inherited::args_type args_type;
MediaInfoChangedSignal()
: inherited("MediaInfoChanged",
args_type(Argument<MediaChangeType>("type"),
Argument<vector<string> >("urls"))) {
}
};
MediaScannerInterface()
: InterfaceType("com.canonical.MediaScanner") {
// FIXME(M5): Initialize members here
}
};
class MediaScannerProxy : public MediaScannerInterface<InterfaceProxy> {
public:
MediaScannerProxy()
: MediaInfoExists(this)
, LookupMediaInfo(this)
, QueryMediaInfo(this)
, StoreMediaInfo(this)
, RemoveMediaInfo(this) {
}
void connect(Wrapper<GDBusConnection> connection,
Wrapper<GCancellable> cancellable = Wrapper<GCancellable>());
void connect(Wrapper<GCancellable> cancellable = Wrapper<GCancellable>());
bool ConnectAndWait(Wrapper<GDBusConnection> connection,
Wrapper<GCancellable> cancellable, GError **error);
bool ConnectAndWait(Wrapper<GCancellable> cancellable, GError **error);
const MediaInfoExistsMethod MediaInfoExists;
const LookupMediaInfoMethod LookupMediaInfo;
const QueryMediaInfoMethod QueryMediaInfo;
const StoreMediaInfoMethod StoreMediaInfo;
const RemoveMediaInfoMethod RemoveMediaInfo;
const IndexPathProperty index_path;
const MediaRootsProperty media_roots;
const MediaInfoAvailableSignal media_info_available;
const MediaInfoChangedSignal media_info_changed;
};
class MediaScannerSkeleton : public MediaScannerInterface<InterfaceSkeleton> {
public:
static const string& object_path();
static const string& service_name();
};
string to_string(MediaChangeType change_type);
} // namespace dbus
} // namespace mediascanner
#endif // MEDIASCANNER_DBUSSERVICE_H
|