wifi_display: Add a utility function to get the sub-elements as IEs
This will be useful for DBus API to expose current WFD configuration. Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
a8833b84f4
commit
d4177443d4
2 changed files with 29 additions and 0 deletions
|
@ -36,6 +36,34 @@ void wifi_display_deinit(struct wpa_global *global)
|
|||
}
|
||||
|
||||
|
||||
struct wpabuf * wifi_display_get_wfd_ie(struct wpa_global *global)
|
||||
{
|
||||
struct wpabuf *ie;
|
||||
size_t len;
|
||||
int i;
|
||||
|
||||
if (global->p2p == NULL)
|
||||
return NULL;
|
||||
|
||||
len = 0;
|
||||
for (i = 0; i < MAX_WFD_SUBELEMS; i++) {
|
||||
if (global->wfd_subelem[i])
|
||||
len += wpabuf_len(global->wfd_subelem[i]);
|
||||
}
|
||||
|
||||
ie = wpabuf_alloc(len);
|
||||
if (ie == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < MAX_WFD_SUBELEMS; i++) {
|
||||
if (global->wfd_subelem[i])
|
||||
wpabuf_put_buf(ie, global->wfd_subelem[i]);
|
||||
}
|
||||
|
||||
return ie;
|
||||
}
|
||||
|
||||
|
||||
static int wifi_display_update_wfd_ie(struct wpa_global *global)
|
||||
{
|
||||
struct wpabuf *ie, *buf;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
int wifi_display_init(struct wpa_global *global);
|
||||
void wifi_display_deinit(struct wpa_global *global);
|
||||
void wifi_display_enable(struct wpa_global *global, int enabled);
|
||||
struct wpabuf *wifi_display_get_wfd_ie(struct wpa_global *global);
|
||||
int wifi_display_subelem_set(struct wpa_global *global, char *cmd);
|
||||
int wifi_display_subelem_get(struct wpa_global *global, char *cmd,
|
||||
char *buf, size_t buflen);
|
||||
|
|
Loading…
Reference in a new issue