mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: telephony: make the call list public
This commit is contained in:
		
							parent
							
								
									a501c887ea
								
							
						
					
					
						commit
						5dacd77866
					
				
					 2 changed files with 12 additions and 14 deletions
				
			
		| 
						 | 
					@ -153,7 +153,6 @@ struct agimpl {
 | 
				
			||||||
	struct spa_list link;
 | 
						struct spa_list link;
 | 
				
			||||||
	int id;
 | 
						int id;
 | 
				
			||||||
	char *path;
 | 
						char *path;
 | 
				
			||||||
	struct spa_list call_list;
 | 
					 | 
				
			||||||
	struct spa_hook_list listener_list;
 | 
						struct spa_hook_list listener_list;
 | 
				
			||||||
	void *user_data;
 | 
						void *user_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -163,7 +162,6 @@ struct agimpl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct callimpl {
 | 
					struct callimpl {
 | 
				
			||||||
	struct spa_bt_telephony_call this;
 | 
						struct spa_bt_telephony_call this;
 | 
				
			||||||
	struct spa_list link;
 | 
					 | 
				
			||||||
	int id;
 | 
						int id;
 | 
				
			||||||
	char *path;
 | 
						char *path;
 | 
				
			||||||
	struct spa_hook_list listener_list;
 | 
						struct spa_hook_list listener_list;
 | 
				
			||||||
| 
						 | 
					@ -186,7 +184,7 @@ struct callimpl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void dbus_iter_append_call_properties(DBusMessageIter *i, struct spa_bt_telephony_call *call);
 | 
					static void dbus_iter_append_call_properties(DBusMessageIter *i, struct spa_bt_telephony_call *call);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define find_free_object_id(list, obj_type)	\
 | 
					#define find_free_object_id(list, obj_type, link)	\
 | 
				
			||||||
({						\
 | 
					({						\
 | 
				
			||||||
	int id = 0;				\
 | 
						int id = 0;				\
 | 
				
			||||||
	obj_type *object;			\
 | 
						obj_type *object;			\
 | 
				
			||||||
| 
						 | 
					@ -389,7 +387,7 @@ static DBusMessage *ag_get_managed_objects(struct agimpl *agimpl, DBusMessage *m
 | 
				
			||||||
	dbus_message_iter_init_append(r, &iter);
 | 
						dbus_message_iter_init_append(r, &iter);
 | 
				
			||||||
	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{oa{sa{sv}}}", &array1);
 | 
						dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{oa{sa{sv}}}", &array1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each (callimpl, &agimpl->call_list, link) {
 | 
						spa_list_for_each (callimpl, &agimpl->this.call_list, this.link) {
 | 
				
			||||||
		dbus_message_iter_open_container(&array1, DBUS_TYPE_DICT_ENTRY, NULL, &entry1);
 | 
							dbus_message_iter_open_container(&array1, DBUS_TYPE_DICT_ENTRY, NULL, &entry1);
 | 
				
			||||||
		dbus_message_iter_append_basic(&entry1, DBUS_TYPE_OBJECT_PATH, &callimpl->path);
 | 
							dbus_message_iter_append_basic(&entry1, DBUS_TYPE_OBJECT_PATH, &callimpl->path);
 | 
				
			||||||
		dbus_message_iter_open_container(&entry1, DBUS_TYPE_ARRAY, "{sa{sv}}", &array2);
 | 
							dbus_message_iter_open_container(&entry1, DBUS_TYPE_ARRAY, "{sa{sv}}", &array2);
 | 
				
			||||||
| 
						 | 
					@ -498,7 +496,7 @@ static DBusMessage *ag_create_multiparty(struct agimpl *agimpl, DBusMessage *m)
 | 
				
			||||||
	dbus_message_iter_init_append(r, &i);
 | 
						dbus_message_iter_init_append(r, &i);
 | 
				
			||||||
	dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, "{o}", &oi);
 | 
						dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, "{o}", &oi);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each (callimpl, &agimpl->call_list, link) {
 | 
						spa_list_for_each (callimpl, &agimpl->this.call_list, this.link) {
 | 
				
			||||||
		if (callimpl->this.multiparty)
 | 
							if (callimpl->this.multiparty)
 | 
				
			||||||
			dbus_message_iter_append_basic(&oi, DBUS_TYPE_OBJECT_PATH,
 | 
								dbus_message_iter_append_basic(&oi, DBUS_TYPE_OBJECT_PATH,
 | 
				
			||||||
				&callimpl->path);
 | 
									&callimpl->path);
 | 
				
			||||||
| 
						 | 
					@ -590,8 +588,8 @@ telephony_ag_new(struct spa_bt_telephony *telephony, size_t user_data_size)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	agimpl->this.telephony = telephony;
 | 
						agimpl->this.telephony = telephony;
 | 
				
			||||||
	agimpl->id = find_free_object_id(&impl->ag_list, struct agimpl);
 | 
						agimpl->id = find_free_object_id(&impl->ag_list, struct agimpl, link);
 | 
				
			||||||
	agimpl->call_list = SPA_LIST_INIT(&agimpl->call_list);
 | 
						spa_list_init(&agimpl->this.call_list);
 | 
				
			||||||
	spa_hook_list_init(&agimpl->listener_list);
 | 
						spa_hook_list_init(&agimpl->listener_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&impl->ag_list, &agimpl->link);
 | 
						spa_list_append(&impl->ag_list, &agimpl->link);
 | 
				
			||||||
| 
						 | 
					@ -607,7 +605,7 @@ void telephony_ag_destroy(struct spa_bt_telephony_ag *ag)
 | 
				
			||||||
	struct agimpl *agimpl = SPA_CONTAINER_OF(ag, struct agimpl, this);
 | 
						struct agimpl *agimpl = SPA_CONTAINER_OF(ag, struct agimpl, this);
 | 
				
			||||||
	struct callimpl *callimpl;
 | 
						struct callimpl *callimpl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_consume (callimpl, &agimpl->call_list, link) {
 | 
						spa_list_consume (callimpl, &agimpl->this.call_list, this.link) {
 | 
				
			||||||
		telephony_call_destroy(&callimpl->this);
 | 
							telephony_call_destroy(&callimpl->this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -731,10 +729,10 @@ telephony_call_new(struct spa_bt_telephony_ag *ag, size_t user_data_size)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	callimpl->this.ag = ag;
 | 
						callimpl->this.ag = ag;
 | 
				
			||||||
	callimpl->id = find_free_object_id(&agimpl->call_list, struct callimpl);
 | 
						callimpl->id = find_free_object_id(&ag->call_list, struct callimpl, this.link);
 | 
				
			||||||
	spa_hook_list_init(&callimpl->listener_list);
 | 
						spa_hook_list_init(&callimpl->listener_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&agimpl->call_list, &callimpl->link);
 | 
						spa_list_append(&ag->call_list, &callimpl->this.link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (user_data_size > 0)
 | 
						if (user_data_size > 0)
 | 
				
			||||||
		callimpl->user_data = SPA_PTROFF(callimpl, sizeof(struct callimpl), void);
 | 
							callimpl->user_data = SPA_PTROFF(callimpl, sizeof(struct callimpl), void);
 | 
				
			||||||
| 
						 | 
					@ -751,7 +749,7 @@ void telephony_call_destroy(struct spa_bt_telephony_call *call)
 | 
				
			||||||
	struct callimpl *callimpl = SPA_CONTAINER_OF(call, struct callimpl, this);
 | 
						struct callimpl *callimpl = SPA_CONTAINER_OF(call, struct callimpl, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	telephony_call_unregister(call);
 | 
						telephony_call_unregister(call);
 | 
				
			||||||
	spa_list_remove(&callimpl->link);
 | 
						spa_list_remove(&call->link);
 | 
				
			||||||
	spa_hook_list_clean(&callimpl->listener_list);
 | 
						spa_hook_list_clean(&callimpl->listener_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free(call->line_identification);
 | 
						free(call->line_identification);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,10 +23,12 @@ struct spa_bt_telephony {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct spa_bt_telephony_ag {
 | 
					struct spa_bt_telephony_ag {
 | 
				
			||||||
	struct spa_bt_telephony *telephony;
 | 
						struct spa_bt_telephony *telephony;
 | 
				
			||||||
 | 
						struct spa_list call_list;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct spa_bt_telephony_call {
 | 
					struct spa_bt_telephony_call {
 | 
				
			||||||
	struct spa_bt_telephony_ag *ag;
 | 
						struct spa_bt_telephony_ag *ag;
 | 
				
			||||||
 | 
						struct spa_list link;	/* link in ag->call_list */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* D-Bus properties */
 | 
						/* D-Bus properties */
 | 
				
			||||||
	char *line_identification;
 | 
						char *line_identification;
 | 
				
			||||||
| 
						 | 
					@ -62,6 +64,7 @@ struct spa_bt_telephony *telephony_new(struct spa_log *log, struct spa_dbus *dbu
 | 
				
			||||||
					const struct spa_dict *info);
 | 
										const struct spa_dict *info);
 | 
				
			||||||
void telephony_free(struct spa_bt_telephony *telephony);
 | 
					void telephony_free(struct spa_bt_telephony *telephony);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* create/destroy the ag object */
 | 
					/* create/destroy the ag object */
 | 
				
			||||||
struct spa_bt_telephony_ag * telephony_ag_new(struct spa_bt_telephony *telephony,
 | 
					struct spa_bt_telephony_ag * telephony_ag_new(struct spa_bt_telephony *telephony,
 | 
				
			||||||
					      size_t user_data_size);
 | 
										      size_t user_data_size);
 | 
				
			||||||
| 
						 | 
					@ -79,9 +82,6 @@ void telephony_ag_add_listener(struct spa_bt_telephony_ag *ag,
 | 
				
			||||||
int telephony_ag_register(struct spa_bt_telephony_ag *ag);
 | 
					int telephony_ag_register(struct spa_bt_telephony_ag *ag);
 | 
				
			||||||
void telephony_ag_unregister(struct spa_bt_telephony_ag *ag);
 | 
					void telephony_ag_unregister(struct spa_bt_telephony_ag *ag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//TODO
 | 
					 | 
				
			||||||
//struct spa_bt_telephony_call *telephony_ag_find_call_by_????(struct spa_bt_telephony_ag *ag, ???);
 | 
					 | 
				
			||||||
//void telephony_ag_iterate_calls(struct spa_bt_telephony_ag *ag, callback, userdata);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* create/destroy the call object */
 | 
					/* create/destroy the call object */
 | 
				
			||||||
struct spa_bt_telephony_call * telephony_call_new(struct spa_bt_telephony_ag *ag,
 | 
					struct spa_bt_telephony_call * telephony_call_new(struct spa_bt_telephony_ag *ag,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue