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 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
|
/*
* dLeyna
*
* Copyright (C) 2012-2017 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Mark Ryan <mark.d.ryan@intel.com>
*
*/
#ifndef DLS_TASK_H__
#define DLS_TASK_H__
#include <gio/gio.h>
#include <glib.h>
#include <libdleyna/core/connector.h>
#include <libdleyna/core/task-atom.h>
#include "server.h"
enum dls_task_type_t_ {
DLS_TASK_GET_VERSION,
DLS_TASK_GET_SERVERS,
DLS_TASK_RESCAN,
DLS_TASK_GET_CHILDREN,
DLS_TASK_GET_ALL_PROPS,
DLS_TASK_GET_PROP,
DLS_TASK_SEARCH,
DLS_TASK_BROWSE_OBJECTS,
DLS_TASK_GET_RESOURCE,
DLS_TASK_SET_PREFER_LOCAL_ADDRESSES,
DLS_TASK_SET_PROTOCOL_INFO,
DLS_TASK_UPLOAD_TO_ANY,
DLS_TASK_UPLOAD,
DLS_TASK_GET_UPLOAD_STATUS,
DLS_TASK_GET_UPLOAD_IDS,
DLS_TASK_CANCEL_UPLOAD,
DLS_TASK_DELETE_OBJECT,
DLS_TASK_CREATE_CONTAINER,
DLS_TASK_CREATE_CONTAINER_IN_ANY,
DLS_TASK_UPDATE_OBJECT,
DLS_TASK_GET_OBJECT_METADATA,
DLS_TASK_CREATE_REFERENCE,
DLS_TASK_GET_ICON,
DLS_TASK_MANAGER_GET_ALL_PROPS,
DLS_TASK_MANAGER_GET_PROP,
DLS_TASK_MANAGER_SET_PROP,
DLS_TASK_WAKE
};
typedef enum dls_task_type_t_ dls_task_type_t;
typedef void (*dls_cancel_task_t)(void *handle);
typedef struct dls_task_get_children_t_ dls_task_get_children_t;
struct dls_task_get_children_t_ {
gboolean containers;
gboolean items;
guint start;
guint count;
GVariant *filter;
gchar *sort_by;
};
typedef struct dls_task_get_props_t_ dls_task_get_props_t;
struct dls_task_get_props_t_ {
gchar *interface_name;
};
typedef struct dls_task_get_prop_t_ dls_task_get_prop_t;
struct dls_task_get_prop_t_ {
gchar *prop_name;
gchar *interface_name;
};
typedef struct dls_task_set_prop_t_ dls_task_set_prop_t;
struct dls_task_set_prop_t_ {
gchar *prop_name;
gchar *interface_name;
GVariant *params;
};
typedef struct dls_task_search_t_ dls_task_search_t;
struct dls_task_search_t_ {
gchar *query;
guint start;
guint count;
gchar *sort_by;
GVariant *filter;
};
typedef struct dls_task_browse_objects_t_ dls_task_browse_objects_t;
struct dls_task_browse_objects_t_ {
GVariant *objects;
GVariant *filter;
};
typedef struct dls_task_get_resource_t_ dls_task_get_resource_t;
struct dls_task_get_resource_t_ {
gchar *protocol_info;
GVariant *filter;
};
typedef struct dls_task_set_prefer_local_addresses_t_
dls_task_set_prefer_local_addresses_t;
struct dls_task_set_prefer_local_addresses_t_ {
gboolean prefer;
};
typedef struct dls_task_set_protocol_info_t_ dls_task_set_protocol_info_t;
struct dls_task_set_protocol_info_t_ {
gchar *protocol_info;
};
typedef struct dls_task_upload_t_ dls_task_upload_t;
struct dls_task_upload_t_ {
gchar *display_name;
gchar *file_path;
};
typedef struct dls_task_upload_action_t_ dls_task_upload_action_t;
struct dls_task_upload_action_t_ {
guint upload_id;
};
typedef struct dls_task_create_container_t_ dls_task_create_container_t;
struct dls_task_create_container_t_ {
gchar *display_name;
gchar *type;
GVariant *child_types;
};
typedef struct dls_task_update_t_ dls_task_update_t;
struct dls_task_update_t_ {
GVariant *to_add_update;
GVariant *to_delete;
};
typedef struct dls_task_create_reference_t_ dls_task_create_reference_t;
struct dls_task_create_reference_t_ {
gchar *item_path;
};
typedef struct dls_task_target_info_t_ dls_task_target_info_t;
struct dls_task_target_info_t_ {
gchar *path;
gchar *root_path;
gchar *id;
dls_device_t *device;
};
typedef struct dls_task_get_icon_t_ dls_task_get_icon_t;
struct dls_task_get_icon_t_ {
gchar *mime_type;
gchar *resolution;
};
typedef struct dls_task_t_ dls_task_t;
struct dls_task_t_ {
dleyna_task_atom_t atom; /* pseudo inheritance - MUST be first field */
dls_task_type_t type;
dls_task_target_info_t target;
const gchar *result_format;
GVariant *result;
dleyna_connector_msg_id_t invocation;
gboolean synchronous;
gboolean multiple_retvals;
union {
dls_task_get_children_t get_children;
dls_task_get_props_t get_props;
dls_task_get_prop_t get_prop;
dls_task_set_prop_t set_prop;
dls_task_search_t search;
dls_task_get_resource_t resource;
dls_task_set_prefer_local_addresses_t prefer_local_addresses;
dls_task_set_protocol_info_t protocol_info;
dls_task_upload_t upload;
dls_task_upload_action_t upload_action;
dls_task_create_container_t create_container;
dls_task_update_t update;
dls_task_create_reference_t create_reference;
dls_task_get_icon_t get_icon;
dls_task_browse_objects_t browse_objects;
} ut;
};
dls_task_t *dls_task_rescan_new(dleyna_connector_msg_id_t invocation);
dls_task_t *dls_task_get_version_new(dleyna_connector_msg_id_t invocation);
dls_task_t *dls_task_get_servers_new(dleyna_connector_msg_id_t invocation);
dls_task_t *dls_task_get_children_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
gboolean items, gboolean containers,
GError **error);
dls_task_t *dls_task_get_children_ex_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters, gboolean items,
gboolean containers,
GError **error);
dls_task_t *dls_task_get_prop_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_get_props_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_search_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_search_ex_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_browse_objects_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_get_resource_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_set_protocol_info_new(dleyna_connector_msg_id_t invocation,
GVariant *parameters);
dls_task_t *dls_task_prefer_local_addresses_new(
dleyna_connector_msg_id_t invocation,
GVariant *parameters);
dls_task_t *dls_task_upload_to_any_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_upload_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_get_upload_status_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_get_upload_ids_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GError **error);
dls_task_t *dls_task_cancel_upload_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_delete_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GError **error);
dls_task_t *dls_task_create_container_new_generic(
dleyna_connector_msg_id_t invocation,
dls_task_type_t type,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_create_reference_new(dleyna_connector_msg_id_t invocation,
dls_task_type_t type,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_update_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_get_metadata_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GError **error);
dls_task_t *dls_task_get_icon_new(dleyna_connector_msg_id_t invocation,
const gchar *path, GVariant *parameters,
GError **error);
dls_task_t *dls_task_manager_get_prop_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_manager_get_props_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_manager_set_prop_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GVariant *parameters,
GError **error);
dls_task_t *dls_task_wake_new(dleyna_connector_msg_id_t invocation,
const gchar *path,
GError **error);
void dls_task_cancel(dls_task_t *task);
void dls_task_complete(dls_task_t *task);
void dls_task_fail(dls_task_t *task, GError *error);
void dls_task_delete(dls_task_t *task);
#endif /* DLS_TASK_H__ */
|