Imported Upstream version 1.7.1
[platform/upstream/edbus.git] / src / lib / bluez / e_bluez_devicefound.c
1 #include "e_bluez_private.h"
2
3 /**
4  * Free a E_Bluez_Device_Found struct
5  *
6  * @param device the struct to be freed
7  */
8 void
9 e_bluez_devicefound_free(E_Bluez_Device_Found *device)
10 {
11    EINA_SAFETY_ON_NULL_RETURN(device);
12
13    eina_stringshare_del(device->name);
14    e_bluez_element_array_free(device->array, NULL);
15 }
16
17 /**
18  * Return the pointer to the stringshared alias for the given found device.
19  *
20  * @return stringshared pointer, or @c NULL if unknown.
21  */
22 const char *
23 e_bluez_devicefound_alias_get(const E_Bluez_Device_Found *device)
24 {
25    E_Bluez_Element_Dict_Entry *entry;
26
27    EINA_SAFETY_ON_NULL_RETURN_VAL(device, NULL);
28
29    entry = e_bluez_element_array_dict_find_stringshared
30          (device->array, e_bluez_prop_alias);
31
32    if ((entry) && (entry->type == DBUS_TYPE_STRING))
33       return entry->value.str;
34
35    return NULL;
36 }
37