void asp_manager_gdbus_notify_session_request(gint32 error_code,
gchar *session_mac, guint32 session_id, guint32 adv_id,
- gchar *device_name, guint8 *session_info,
+ gchar *device_name, gchar *session_info,
gboolean get_pin, gchar *pin);
void asp_manager_gdbus_notify_session_config_request(guint32 sessoin_id,
}
DEBUG_PARAMS(parameters);
- g_variant_get(parameters, "(a{sv})", &iter);
+ g_variant_get(parameters, "a{sv}", &iter);
while (g_variant_iter_loop(iter, "{sv}", &key, &var)) {
if (!g_strcmp0(key, "session_mac"))
g_variant_get(var, "&s", &session_mac);
else
;/* Do Nothing */
}
- if (session_id == 0 || session_mac == NULL) {
+ if (session_mac == NULL) {
ASP_LOGE("Invalid parameter");
ASP_RETURN_SESSION_ERR(invocation, -ASP_ERROR_INVALIED_PARAMS);
goto out;
ASP_LOGD("session ID [%u] session mac [%s]", session_id, session_mac);
macaddr_atoe(session_mac, mac_addr);
- pin = (guint32)atoi(pin_str);
+ if(pin_str != NULL)
+ pin = (guint32)atoi(pin_str);
res = asp_session_confirm_session(mac_addr, session_id, confirmed, pin);
if (!res) {
ASP_LOGE("Operation Failed");
goto out;
}
- if (session_id == 0 || session_mac == NULL) {
+ if (session_mac == NULL) {
ASP_LOGE("Invalid parameter");
ASP_RETURN_SESSION_ERR(invocation, -ASP_ERROR_INVALIED_PARAMS);
goto out;
goto out;
}
+ ASP_LOGD("adv id [%u]", adv_id);
builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
g_variant_builder_add(builder, "{sv}", "adv_id", g_variant_new("u", adv_id));
- session = g_variant_new("(a{sv})", builder);
+ session = g_variant_new("a{sv}", builder);
g_variant_builder_unref(builder);
asp_session_complete_get_session(object, invocation, result, session);
void asp_manager_gdbus_notify_session_request(gint32 error_code,
gchar * session_mac, guint32 session_id, guint32 adv_id,
- gchar * device_name, guint8 * session_info,
+ gchar * device_name, gchar * session_info,
gboolean get_pin, gchar *pin)
{
__ASP_LOG_FUNC_ENTER__;
{
__ASP_LOG_FUNC_ENTER__;
+ gchar *session_info_str = NULL;
gchar session_mac_str[MACSTR_LEN + 1] = {0,};
gchar pin_str[MACSTR_LEN + 1] = {0,};
+ if(info_length != 0) {
+ session_info_str = g_try_malloc0(info_length + 1);
+ memcpy(session_info_str, session_info, info_length);
+ }
+
g_snprintf(session_mac_str, MACSTR_LEN + 1, MACSTR, MAC2STR(session_mac));
g_snprintf(pin_str, PINSTR_LEN + 1, "%u", pin);
asp_manager_gdbus_notify_session_request(error_code, session_mac_str,
- session_id, adv_id, device_name, session_info, get_pin, pin_str);
+ session_id, adv_id, device_name, session_info_str, get_pin, pin_str);
__ASP_LOG_FUNC_EXIT__;
return;
void asp_tech_p2p_process_connect_status(GDBusConnection *connection,
const gchar *object_path, GVariant *parameters);
+
+void asp_tech_p2p_process_session_peer_ip(GDBusConnection *connection,
+ const gchar *object_path, GVariant *parameters);
+
/*****************************************************************************
* Global Variables
*****************************************************************************/
asp_tech_p2p_process_connect_status
},
{
+ WFD_MANAGER_ASP_INTERFACE,
+ "SessionPeerIPAssigned",
+ asp_tech_p2p_process_session_peer_ip
+ },
+ {
NULL,
NULL,
NULL
return;
}
+void asp_tech_p2p_process_session_peer_ip(GDBusConnection *connection,
+ const gchar *object_path, GVariant *parameters)
+{
+ __ASP_LOG_FUNC_ENTER__;
+
+ GVariantIter *iter = NULL;
+ GVariant *var = NULL;
+ const gchar *key = NULL;
+ const gchar *str = NULL;
+ guint8 session_mac[MAC_LEN] = {0,};
+ guint8 service_mac[MAC_LEN] = {0,};
+ guint32 session_id = 0;
+ gchar *peer_ip = NULL;
+
+ if (!parameters) {
+ __ASP_LOG_FUNC_EXIT__;
+ return;
+ }
+
+ g_variant_get(parameters, "(a{sv})", &iter);
+ while (g_variant_iter_loop(iter, "{sv}", &key, &var)) {
+ if (!g_strcmp0(key, "session_mac")) {
+ if (asp_dbus_unpack_ay(session_mac, var, MAC_LEN) < 0)
+ return;
+ } else if (!g_strcmp0(key, "session_id")) {
+ g_variant_get(var, "u", &session_id);
+ } else if (!g_strcmp0(key, "service_mac")) {
+ if (asp_dbus_unpack_ay(service_mac, var, MAC_LEN) < 0)
+ return;
+ } else if (!g_strcmp0(key, "assigned_ip_address")) {
+ g_variant_get(var, "&s", &str);
+ peer_ip = g_strdup(str);
+ } else {
+ ;/* Do Nothing */
+ }
+ }
+
+ if(peer_ip == NULL) {
+ ASP_LOGE("Invalid peer IP address");
+ return;
+ }
+
+ if (asp_tech_p2p_ops.ip_assigned_cb) {
+ asp_tech_p2p_ops.ip_assigned_cb(0,
+ session_mac, session_id, service_mac, peer_ip,
+ strlen(peer_ip), asp_tech_p2p_ops.ip_assigned_cb_user_data);
+ }
+
+ g_free(peer_ip);
+
+ __ASP_LOG_FUNC_EXIT__;
+ return;
+}
+
gint32 asp_tech_p2p_advertise(asp_service_advertise_s *service, gint32 replace)
{
__ASP_LOG_FUNC_ENTER__;