Re: gupnp-binding-tool



I forgot one thing.

The autoconnect function does not seem to be able to deal with code that has been generated with a --prefix. When I give the callback functions a "on" prefix I get linker errors because some methods from the 3 services have the same name. There is no way to give a suffix so that I can append "cb" to the end of the function names. The consequence is that the autoconnect magic does not work and I get a "Not Found" message.

Shouldn't there be a "--suffix" parameter for the binding tool so that "cb" can be appended (or make it a default suffix)?
And shouldn't it be possible to pass the "prefix" to the autoconnect magic so that it works with functions that have a prefix?

Regards,
     Michael


On Sun, Jun 5, 2011 at 10:55 PM, Michael Rumpf <michael rumpf gmail com> wrote:
Hi,

I'm very new to gupnp and I might still have some issues understanding the concepts behind it. Here is what I'm trying to do. I use the gupnp-binding-tool in order to generate the server side stub code for 3 service description.xml files.

1. when I #include all the 3 generated files in my code (each one generated with a different prefix) I get a linker error that the function _free_cb_data() has been defined 3 times.

I see 3 possible solutions:
a) Use the --prefix also for the function  _free_cb_data() 
b) Move the function  _free_cb_data() into the gupnp library
c) Use a #ifndef #define #endif sequence in order to define the method only once

Currently I help myself with the following script

../../base/bin/gupnp-binding-tool --prefix renderingcontrol --mode server RenderingControl/description.xml > audio-renderer-renderingcontrol.c1
cat audio-renderer-renderingcontrol.c1 | sed -e 's/_free_cb_data/_renderingcontrol_free_cb_data/g' > audio-renderer-renderingcontrol.c
rm audio-renderer-renderingcontrol.c1

2. The generated code contains methods for connecting the action callback handlers and for the state variable handlers. But the code does not provide a method where all action callback and state variable handlers get connected. I still need to add calls like this

<PREFIX>_<ACTIONNAME>_action_connect(GUPNP_SERVICE (myServiceInfo), G_CALLBACK(<PREFIX>_<ACTIONNAME>_action_set), NULL);
<PREFIX>_<ACTIONNAME>_action_connect(GUPNP_SERVICE (myServiceInfo), G_CALLBACK(<PREFIX>_<ACTIONNAME>_action_get), NULL);

It would be no problem for the gupnp-binding-tool to generate one function like this

action_connect_all (GUPnPService *service)

This would be a dummy implementation where no individual userdata can be passed to the different action_connect functions, but it would save a lot of typing/scripting in order to get a service up and running.

Regards,
     Michael



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]