Changeset 2fd730ea55ee6a1df6b457076c67e4a8edae0580
- Timestamp:
- 03/06/10 17:03:14 (5 months ago)
- Author:
- Nedko Arnaudov <nedko@…>
- Children:
- a459a2a19cd0f110f245f6c1cbf0a39f6f2a6dad
- Parents:
- a76c415981c63ef0bffe8be7e81ecde70ef3e2fd
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-03-06T17:03:14Z+0200
- Message:
-
daemon: expose new studio room objects on D-Bus
- Location:
- daemon
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r8475365
|
r2fd730e
|
|
| 49 | 49 | ladish_room_handle room; |
| 50 | 50 | |
| 51 | | if (!ladish_room_create(empty_room, "Empty", NULL, &room)) |
| | 51 | if (!ladish_room_create(empty_room, "Empty", NULL, NULL, &room)) |
| 52 | 52 | { |
| 53 | 53 | log_error("ladish_room_create() failed."); |
| … |
… |
|
| 57 | 57 | list_add_tail(ladish_room_get_list_node(room), &g_rooms); |
| 58 | 58 | |
| 59 | | if (!ladish_room_create(basic_room, "Basic", NULL, &room)) |
| | 59 | if (!ladish_room_create(basic_room, "Basic", NULL, NULL, &room)) |
| 60 | 60 | { |
| 61 | 61 | log_error("ladish_room_create() failed."); |
-
|
r093af66
|
r2fd730e
|
|
| 3 | 3 | * LADI Session Handler (ladish) |
| 4 | 4 | * |
| 5 | | * Copyright (C) 2008, 2009 Nedko Arnaudov <nedko@arnaudov.name> |
| | 5 | * Copyright (C) 2008, 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name> |
| 6 | 6 | * Copyright (C) 2008 Juuso Alasuutari |
| 7 | 7 | * |
| … |
… |
|
| 958 | 958 | } |
| 959 | 959 | free(graph_ptr); |
| | 960 | } |
| | 961 | |
| | 962 | const char * ladish_graph_get_opath(ladish_graph_handle graph_handle) |
| | 963 | { |
| | 964 | return graph_ptr->opath; |
| 960 | 965 | } |
| 961 | 966 | |
-
|
r093af66
|
r2fd730e
|
|
| 3 | 3 | * LADI Session Handler (ladish) |
| 4 | 4 | * |
| 5 | | * Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name> |
| | 5 | * Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name> |
| 6 | 6 | * |
| 7 | 7 | ************************************************************************** |
| … |
… |
|
| 50 | 50 | bool ladish_graph_create(ladish_graph_handle * graph_handle_ptr, const char * opath); |
| 51 | 51 | void ladish_graph_destroy(ladish_graph_handle graph_handle, bool destroy_ports); |
| | 52 | |
| | 53 | const char * ladish_graph_get_opath(ladish_graph_handle graph_handle); |
| 52 | 54 | |
| 53 | 55 | void |
-
|
r8475365
|
r2fd730e
|
|
| 26 | 26 | |
| 27 | 27 | #include "room.h" |
| | 28 | #include "../dbus_constants.h" |
| | 29 | #include "graph.h" |
| | 30 | #include "graph_dict.h" |
| 28 | 31 | |
| 29 | 32 | struct ladish_room |
| … |
… |
|
| 33 | 36 | char * name; |
| 34 | 37 | uuid_t template_uuid; |
| | 38 | dbus_object_path dbus_object; |
| | 39 | ladish_graph_handle graph; |
| 35 | 40 | }; |
| | 41 | |
| | 42 | extern const struct dbus_interface_descriptor g_interface_room; |
| 36 | 43 | |
| 37 | 44 | bool |
| … |
… |
|
| 40 | 47 | const char * name, |
| 41 | 48 | ladish_room_handle template, |
| | 49 | const char * object_path, |
| 42 | 50 | ladish_room_handle * room_handle_ptr) |
| 43 | 51 | { |
| … |
… |
|
| 84 | 92 | } |
| 85 | 93 | |
| | 94 | if (object_path) |
| | 95 | { |
| | 96 | if (!ladish_graph_create(&room_ptr->graph, object_path)) |
| | 97 | { |
| | 98 | free(room_ptr); |
| | 99 | return false; |
| | 100 | } |
| | 101 | |
| | 102 | room_ptr->dbus_object = dbus_object_path_new( |
| | 103 | object_path, |
| | 104 | &g_interface_room, room_ptr, |
| | 105 | &g_interface_patchbay, ladish_graph_get_dbus_context(room_ptr->graph), |
| | 106 | &g_iface_graph_dict, room_ptr->graph, |
| | 107 | //&g_iface_app_supervisor, room_ptr->app_supervisor, |
| | 108 | NULL); |
| | 109 | if (room_ptr->dbus_object == NULL) |
| | 110 | { |
| | 111 | log_error("dbus_object_path_new() failed"); |
| | 112 | ladish_graph_destroy(room_ptr->graph, true); |
| | 113 | free(room_ptr); |
| | 114 | return false; |
| | 115 | } |
| | 116 | |
| | 117 | if (!dbus_object_path_register(g_dbus_connection, room_ptr->dbus_object)) |
| | 118 | { |
| | 119 | log_error("object_path_register() failed"); |
| | 120 | dbus_object_path_destroy(g_dbus_connection, room_ptr->dbus_object); |
| | 121 | ladish_graph_destroy(room_ptr->graph, true); |
| | 122 | free(room_ptr); |
| | 123 | return false; |
| | 124 | } |
| | 125 | |
| | 126 | log_info("D-Bus object \"%s\" created for room \"%s\".", object_path, room_ptr->name); |
| | 127 | } |
| | 128 | else |
| | 129 | { |
| | 130 | room_ptr->dbus_object = NULL; |
| | 131 | room_ptr->graph = NULL; |
| | 132 | } |
| | 133 | |
| 86 | 134 | *room_handle_ptr = (ladish_room_handle)room_ptr; |
| 87 | 135 | return true; |
| … |
… |
|
| 94 | 142 | ladish_room_handle room_handle) |
| 95 | 143 | { |
| | 144 | if (room_ptr->dbus_object != NULL) |
| | 145 | { |
| | 146 | dbus_object_path_destroy(g_dbus_connection, room_ptr->dbus_object); |
| | 147 | ladish_graph_destroy(room_ptr->graph, true); |
| | 148 | } |
| | 149 | |
| 96 | 150 | free(room_ptr->name); |
| 97 | 151 | free(room_ptr); |
| … |
… |
|
| 108 | 162 | } |
| 109 | 163 | |
| | 164 | const char * ladish_room_get_opath(ladish_room_handle room_handle) |
| | 165 | { |
| | 166 | if (room_ptr->graph == NULL) |
| | 167 | { |
| | 168 | return NULL; |
| | 169 | } |
| | 170 | |
| | 171 | return ladish_graph_get_opath(room_ptr->graph); |
| | 172 | } |
| | 173 | |
| 110 | 174 | bool ladish_room_get_template_uuid(ladish_room_handle room_handle, uuid_t uuid_ptr) |
| 111 | 175 | { |
| … |
… |
|
| 130 | 194 | return (ladish_room_handle)list_entry(node_ptr, struct ladish_room, siblings); |
| 131 | 195 | } |
| | 196 | |
| | 197 | #define room_ptr ((struct ladish_room *)call_ptr->iface_context) |
| | 198 | |
| | 199 | static void ladish_get_room_name(struct dbus_method_call * call_ptr) |
| | 200 | { |
| | 201 | method_return_new_single(call_ptr, DBUS_TYPE_STRING, &room_ptr->name); |
| | 202 | } |
| | 203 | |
| | 204 | #undef room_ptr |
| | 205 | |
| | 206 | METHOD_ARGS_BEGIN(GetName, "Get room name") |
| | 207 | METHOD_ARG_DESCRIBE_OUT("room_name", "s", "Name of room") |
| | 208 | METHOD_ARGS_END |
| | 209 | |
| | 210 | METHODS_BEGIN |
| | 211 | METHOD_DESCRIBE(GetName, ladish_get_room_name) |
| | 212 | METHODS_END |
| | 213 | |
| | 214 | SIGNALS_BEGIN |
| | 215 | SIGNALS_END |
| | 216 | |
| | 217 | INTERFACE_BEGIN(g_interface_room, IFACE_ROOM) |
| | 218 | INTERFACE_DEFAULT_HANDLER |
| | 219 | INTERFACE_EXPOSE_METHODS |
| | 220 | INTERFACE_EXPOSE_SIGNALS |
| | 221 | INTERFACE_END |
-
|
r8475365
|
r2fd730e
|
|
| 37 | 37 | const char * name, |
| 38 | 38 | ladish_room_handle template, |
| | 39 | const char * object_path, |
| 39 | 40 | ladish_room_handle * room_handle_ptr); |
| 40 | 41 | |
| … |
… |
|
| 47 | 48 | |
| 48 | 49 | const char * ladish_room_get_name(ladish_room_handle room_handle); |
| | 50 | const char * ladish_room_get_opath(ladish_room_handle room_handle); |
| 49 | 51 | bool ladish_room_get_template_uuid(ladish_room_handle room_handle, uuid_t uuid_ptr); |
| 50 | 52 | void ladish_room_get_uuid(ladish_room_handle room_handle, uuid_t uuid_ptr); |
-
|
r8475365
|
r2fd730e
|
|
| 329 | 329 | g_studio.filename = NULL; |
| 330 | 330 | |
| | 331 | g_studio.room_count = 0; |
| | 332 | |
| 331 | 333 | if (!ladish_graph_create(&g_studio.jack_graph, NULL)) |
| 332 | 334 | { |
| … |
… |
|
| 701 | 703 | const char * template_name; |
| 702 | 704 | ladish_room_handle room; |
| | 705 | char room_dbus_name[1024]; |
| | 706 | const char * arg; |
| 703 | 707 | |
| 704 | 708 | dbus_error_init(&g_dbus_error); |
| … |
… |
|
| 720 | 724 | } |
| 721 | 725 | |
| 722 | | if (!ladish_room_create(NULL, room_name, room, &room)) |
| | 726 | g_studio.room_count++; |
| | 727 | |
| | 728 | sprintf(room_dbus_name, DBUS_BASE_PATH "/Room%u", g_studio.room_count); |
| | 729 | |
| | 730 | if (!ladish_room_create(NULL, room_name, room, room_dbus_name, &room)) |
| 723 | 731 | { |
| 724 | 732 | lash_dbus_error(call_ptr, LASH_DBUS_ERROR_GENERIC, "ladish_room_create() failed."); |
| | 733 | g_studio.room_count--; |
| 725 | 734 | return; |
| 726 | 735 | } |
| … |
… |
|
| 728 | 737 | list_add_tail(ladish_room_get_list_node(room), &g_studio.rooms); |
| 729 | 738 | |
| 730 | | //dbus_signal_emit(g_dbus_connection, STUDIO_OBJECT_PATH, IFACE_STUDIO, "RoomAppeared", ""); |
| | 739 | arg = room_dbus_name; |
| | 740 | dbus_signal_emit(g_dbus_connection, STUDIO_OBJECT_PATH, IFACE_STUDIO, "RoomAppeared", "s", &arg); |
| 731 | 741 | |
| 732 | 742 | method_return_new_void(call_ptr); |
| … |
… |
|
| 744 | 754 | ladish_room_handle template; |
| 745 | 755 | const char * template_name; |
| | 756 | const char * opath; |
| 746 | 757 | |
| 747 | 758 | call_ptr->reply = dbus_message_new_method_return(call_ptr->message); |
| … |
… |
|
| 762 | 773 | room = ladish_room_from_list_node(node_ptr); |
| 763 | 774 | name = ladish_room_get_name(room); |
| | 775 | opath = ladish_room_get_opath(room); |
| 764 | 776 | |
| 765 | 777 | if (!ladish_room_get_template_uuid(room, template_uuid)) |
| … |
… |
|
| 791 | 803 | |
| 792 | 804 | if (!dbus_maybe_add_dict_entry_string(&dict_iter, "template", template_name)) |
| | 805 | goto fail_unref; |
| | 806 | |
| | 807 | if (!dbus_maybe_add_dict_entry_string(&dict_iter, "opath", opath)) |
| 793 | 808 | goto fail_unref; |
| 794 | 809 | |
-
|
rb5565fd
|
r2fd730e
|
|
| 3 | 3 | * LADI Session Handler (ladish) |
| 4 | 4 | * |
| 5 | | * Copyright (C) 2009 Nedko Arnaudov <nedko@arnaudov.name> |
| | 5 | * Copyright (C) 2009, 2010 Nedko Arnaudov <nedko@arnaudov.name> |
| 6 | 6 | * |
| 7 | 7 | ************************************************************************** |
| … |
… |
|
| 152 | 152 | ladish_virtualizer_handle virtualizer; |
| 153 | 153 | ladish_app_supervisor_handle app_supervisor; |
| | 154 | |
| | 155 | unsigned int room_count; |
| 154 | 156 | }; |
| 155 | 157 | |