언어 설정

Menu
Sites
Language
Mesage port receives no data

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. 

 

Edited by: Francisco Fernandez on 08 7월, 2015

Responses

3 댓글
Francisco Fernandez

After some tries, I found a work-around:

Instead using:

void message_port_cb_32(int local_port_id, const char *remote_app_id, bundle *message);

I must use:

void message_port_cb_32(int local_port_id, const char *remote_app_id, const char *char2, bool unused, bundle *message, void *unused2)

I found no ducumentation about this API changes, it is just a bug?

Thanks

Jeongsu Kim

I don't know it really changed or not but you can see the prototype of message_port_message_cb link below. It has 6 parameters.

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__MESSAGE__PORT__MODULE.html#ga64f4a2a143ca0e757ffc674cbd0bb841

Francisco Fernandez

It's true, but all documentation regarding how to use Message port is outdated:

  • https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/app_framework/message_port_tutorial_n.htm
  • https://developer.tizen.org/documentation/guides/native-application/application-framework/message-port?langredirect=1
  • https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__MESSAGE__PORT__MODULE.html

Thank you for your answer.

Best regards.