Opened 12 years ago

Closed 12 years ago

#254 closed enhancement/feature request (fixed)

navit/binding/dbus/binding_dbus.c: Rewrite of pcoord_get_from_message()

Reported by: Singesang Owned by: cp15
Priority: trivial Milestone:
Component: dbus Version: git master
Severity: Keywords:
Cc:

Description

I expanded that function so it can be used globally.

static int
pcoord_get_from_message(DBusMessage *message, DBusMessageIter *iter, struct pcoord *pc)
{
	DBusMessageIter iter2;

	dbg(0,"%s\n", dbus_message_iter_get_signature(iter));
    
	dbus_message_iter_recurse(iter, &iter2);

	if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
		return 0;
	dbus_message_iter_get_basic(&iter2, &pc->pro);
    
	dbus_message_iter_next(&iter2);
	
	if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
		return 0;
	dbus_message_iter_get_basic(&iter2, &pc->x);
	
	dbus_message_iter_next(&iter2);

	if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INT32)
		return 0;
	dbus_message_iter_get_basic(&iter2, &pc->y);

	dbg(0, " pro -> %i x -> %i y -> %i\n", &pc->pro, &pc->x, &pc->y);
    
	dbus_message_iter_next(&iter2);
	
	if (dbus_message_iter_get_arg_type(&iter2) != DBUS_TYPE_INVALID)
		return 0;

	return 1;
}

Remember that request_navit_set_center() need adaption:

static DBusHandlerResult
request_navit_set_center(DBusConnection *connection, DBusMessage *message)
{
	struct pcoord pc;
	struct navit *navit;
	DBusMessageIter iter;

	navit=object_get_from_message(message, "navit");
	if (! navit)
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;

	dbus_message_iter_init(message, &iter);

	if (!pcoord_get_from_message(message, &iter, &pc))
		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
	navit_set_center(navit, &pc);
	return empty_reply(connection, message);
}

Change History (2)

comment:1 in reply to: ↑ description Changed 12 years ago by Singesang

Can be closed -> Rev 1425

comment:2 Changed 12 years ago by KaZeR

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.