guint8 *deferred_response, size_t length);
/**
+ * @brief method to get an advertisement MAC from a session
+ * @param [in] session_mac mac address of the device that assigned the value of session_id
+ * @param [in] session_id ASP session ID assigned by the remote ASP
+ * @param [out] adv_mac advertisement MAC
+ * @return gboolean
+ *
+ * @paragraph <Example>
+ *
+ * @verbatim
+ * guint8 *adv_mac;
+ * asp_session_get_advertisement_mac(session_mac, session_id, &adv_mac);
+ * @endverbatim
+*/
+gboolean asp_session_get_advertisement_mac(const guint8 *session_mac,
+ guint32 session_id, guint8 **adv_mac);
+
+/**
* @brief method to get an advertisement ID from a session
* @param [in] session_mac mac address of the device that assigned the value of session_id
* @param [in] session_id ASP session ID assigned by the remote ASP
* asp_session_get_advertisement_id(session_mac, session_id, &adv_id);
* @endverbatim
*/
-gboolean asp_session_get_advertisement_id(guint8 *session_mac,
+gboolean asp_session_get_advertisement_id(const guint8 *session_mac,
guint32 session_id, guint32 *adv_id);
/**
return TRUE;
}
-gboolean asp_session_get_advertisement_id(guint8 *session_mac,
+gboolean asp_session_get_advertisement_mac(const guint8 *session_mac,
+ guint32 session_id, guint8 **adv_mac)
+{
+ INFO_MSG;
+
+ asp_session_s *session = _get_exist_session(session_id, session_mac);
+ g_assert(session);
+
+ *adv_mac = session->service_mac;
+
+ return TRUE;
+}
+
+gboolean asp_session_get_advertisement_id(const guint8 *session_mac,
guint32 session_id, guint32 *advertisement_id)
{
INFO_MSG;
GVariant *params = NULL;
GVariant *reply = NULL;
GError* error = NULL;
+ guint8 *service_mac = NULL;
+ guint32 adv_id = 0;
gchar mac_str[MACSTR_LEN + 1] = {0, };
gchar pin_str[PINSTR_LEN + 1] = {0, };
gint32 result = 0;
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_snprintf(mac_str, MACSTR_LEN + 1, MACSTR, MAC2STR(session_mac));
- g_variant_builder_add(builder, "{sv}", "service_mac", g_variant_new("s", mac_str));
+ g_variant_builder_add(builder, "{sv}", "session_mac", g_variant_new("s", mac_str));
g_variant_builder_add(builder, "{sv}", "session_id", g_variant_new("u", session_id));
g_variant_builder_add(builder, "{sv}", "confirm", g_variant_new("i", confirm));
if (pin != 0) {
g_snprintf(pin_str, PINSTR_LEN + 1, "%u", pin);
g_variant_builder_add(builder, "{sv}", "pin", g_variant_new("s", pin_str));
}
+ if (asp_session_get_advertisement_mac(session_mac, session_id, &service_mac)) {
+ g_snprintf(mac_str, MACSTR_LEN + 1, MACSTR, MAC2STR(service_mac));
+ g_variant_builder_add(builder, "{sv}", "service_mac", g_variant_new("s", mac_str));
+ }
+ if (asp_session_get_advertisement_id(session_mac, session_id, &adv_id))
+ g_variant_builder_add(builder, "{sv}", "adv_id", g_variant_new("u", adv_id));
params = g_variant_new("(a{sv})", builder);
g_variant_builder_unref(builder);
/* Confirm session requested via P2P */
- reply = asp_tech_p2p_dbus_method_call_sync(WFD_MANAGER_MANAGE_INTERFACE,
+ reply = asp_tech_p2p_dbus_method_call_sync(WFD_MANAGER_ASP_INTERFACE,
"ConfirmSession", params, &error);
if (error != NULL) {
result = __net_wifidirect_gerror_to_enum(error);