I have a question with sample of 'about'

asked 2015-03-18 03:14:54 -0700

gc5084 gravatar image

updated 2015-03-19 15:01:37 -0700

georgen gravatar image

I have a question with sample of about.(Path:alljoyn-14.12.00a-src\alljoyn_core\samples\about)

There is a interface "com.example.about.feature.interface.sample" in The Service ,

<interface name=com.example.about.feature.interface.sample>
    <method name='Echo'>
      <arg name='out_arg' type='s' direction='in' />"
      <arg name='return_arg' type='s' direction='out' />"

In client, how to get the interface all information that include interface name,method name ,arg name,arg type,arg direction.

If client do not know the method's function prototype , how to call the method.

in AboutClent.cc:

proxyObject.MethodCall(INTERFACE_NAME, "Echo", &arg, 1, replyMsg);

in other word. Whether the client must know the method's function prototype in the interface , the client be able to call the method.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-03-19 15:25:41 -0700

georgen gravatar image

The about signal contains the remote bus name, interface names, and object paths, etc. It does not give information about the internal contents of the interface. Typically you would already know about the interface that you want to talk with. So you put a full copy of the interface in both the service and the client.

Only the application that implements the BusObject really needs to have the interface (typically called the service). The side that implements the ProxyBusObject (typically called client) can use introspection to get the full interface from the remote BusObject

ProxyBusObject proxyBusObject(busAttachment, remoteBusName, objectPath, sessionId);
// Note the remoteBusName, objectPath can be obtained from the AboutListener.  
// The sessionId you get when you Join a session.
// now the ProxyBusObject know about the remote interface.
const InterfaceDescription* ifc = proxyBusObject.GetInterface(interfaceName);
// Print the xml for the remote interface.
printf("%s\n", ifc->Introspect().c_str());

Generally dynamically populating the interface using the IntrospectRemoteObject member function is not used because it adds extra steps to the connection process. There are also few situations that the information is useful since your program has no way to interact with unknown interfaces.

edit flag offensive delete publish link more


Thanks for the answer.

gc5084 ( 2015-03-19 18:50:58 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-03-18 03:14:54 -0700

Seen: 78 times

Last updated: Mar 19 '15