mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Keep a list of local adapters' UUIDs
This commit stores the UUID list when an adapter is discovered and updates it whenever a PropertiesChanged signal notifies it has changed. Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
This commit is contained in:
		
							parent
							
								
									a246bb77c7
								
							
						
					
					
						commit
						4b55b8a9d0
					
				
					 2 changed files with 26 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1441,6 +1441,7 @@ static pa_bluetooth_adapter* adapter_create(pa_bluetooth_discovery *y, const cha
 | 
			
		|||
    a = pa_xnew0(pa_bluetooth_adapter, 1);
 | 
			
		||||
    a->discovery = y;
 | 
			
		||||
    a->path = pa_xstrdup(path);
 | 
			
		||||
    a->uuids = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func, NULL, pa_xfree);
 | 
			
		||||
 | 
			
		||||
    pa_hashmap_put(y->adapters, a->path, a);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1643,6 +1644,30 @@ static void parse_adapter_properties(pa_bluetooth_adapter *a, DBusMessageIter *i
 | 
			
		|||
            dbus_message_iter_get_basic(&variant_i, &value);
 | 
			
		||||
            a->address = pa_xstrdup(value);
 | 
			
		||||
            a->valid = true;
 | 
			
		||||
        } else if (dbus_message_iter_get_arg_type(&variant_i) == DBUS_TYPE_ARRAY) {
 | 
			
		||||
            DBusMessageIter ai;
 | 
			
		||||
            dbus_message_iter_recurse(&variant_i, &ai);
 | 
			
		||||
 | 
			
		||||
            if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING && pa_streq(key, "UUIDs")) {
 | 
			
		||||
                pa_hashmap_remove_all(a->uuids);
 | 
			
		||||
                while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
 | 
			
		||||
                    const char *value;
 | 
			
		||||
                    char *uuid;
 | 
			
		||||
 | 
			
		||||
                    dbus_message_iter_get_basic(&ai, &value);
 | 
			
		||||
 | 
			
		||||
                    if (pa_hashmap_get(a->uuids, value)) {
 | 
			
		||||
                        dbus_message_iter_next(&ai);
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    uuid = pa_xstrdup(value);
 | 
			
		||||
                    pa_hashmap_put(a->uuids, uuid, uuid);
 | 
			
		||||
 | 
			
		||||
                    pa_log_debug("%s: %s", key, value);
 | 
			
		||||
                    dbus_message_iter_next(&ai);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        dbus_message_iter_next(&element_i);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue