Mesage port receives no data

Mesage port receives no data

BY 08 Jul 2015 Native Application Development

Hi,

I’m developing a native UI application that need to share data with a native service. 

UI application is sending a simple message to the service using a bundle:

bundle *b = bundle_create ();
bundle_add_str (b, "command", "begin");
bundle_add_str (b, "data", "dummy");

dlog_print(DLOG_INFO, "TAS-SERVICE",
     "From server, content of bundle: command: %s data: %s", command, data);

// remote_app_id, remote_port
 ret = message_port_send_message ("org.tizen.test-service", "tas-service", b);

And service receives this message:

void message_port_cb_32(int local_port_id, const char *remote_app_id, bundle *message)
{
   char *command = NULL;
   char *data = NULL;

   bundle_get_str(message, "command", &command);
   bundle_get_str(message, "data", &data);

   dlog_print(DLOG_INFO, "TAS-SERVICE",
   "Message from remote %s, command: %s data: %s", remote_app_id, command, data);
}

-callback is called, but with no data, “message” param is always NULL and dlog prints:

07-07 19:51:32.387 : INFO / TAS-SERVICE ( 20365 : 20365 ) : Message from remote org.tizen.test-ui, command: (null) data: (null)

When I register local port in the service application:

int port_id = message_port_register_local_port("tas-service", message_port_cb_32, NULL);

Compiler shows this message (clearly seems that the current callback definition is not following public documented API) :

incompatible pointer types passing 'void (int, const char *, bundle *)' to parameter of type 'message_port_message_cb' (aka 'void (*)(int, const char *, const char *, bool, bundle *, void *)') [-Wincompatible-pointer-types]

Do you know what is happening?

Thanks in advance. 

 

Written by