About service does not provide WKN

asked 2014-04-02 08:39:47 -0700

praetp gravatar image

updated 2014-04-03 00:37:02 -0700

I have modified the AboutServiceMain.cc sample in such a way first a WKN is succesfully requested and advertised. I would then assume this WKN is also presented at the other end, for instance as the 'busName' in the Announce(..) virtual function in AboutClientAnnounceHandler. However, in the function busname is still the unique name like before :( This seems to contradict the API description in AnnounceHandler.h though..

Why do I ask this ? I want to know when a bus appears (through the About feature) and when it disappears WITHOUT establishing sessions (as our use cases involve potentially many buses and we will only establish sessions when really needed). To accomplish this I would then use the WKN to 'find' the bus with FindAdvertisedName() and thereby using the LostAdvertisedName() to be notified when it disappears. This sounds like a convoluted way of doing things but AFAIK there is no other 'nice' way.

edit retag flag offensive close merge delete


What are you trying to do exactly that required you to want to add a wellknown name to the About feature?

bspencer ( 2014-04-02 11:23:48 -0700 )edit

I have edited the question because the comment field does not leave me enough space.

praetp ( 2014-04-03 00:37:23 -0700 )edit

2 answers

Sort by » oldest newest most voted

answered 2014-04-03 08:46:53 -0700

georgen gravatar image

BusNames can be unique or well-known names. The Unique name will always start with ":" character. The well-known name is just an alias for a unique name. The Unique name is generated when the BusAttachment first connects with the router node. The router node generates a name that is unique typically that name will look something like this :xw21sac.1. Then at run time a developer can give that random name a more meaningful well-known name. For example com.example.georgen.media this name actually caries some additional information it hints at the url of the people developing the code www.example.com as well as what the code does it is something for media. Whats good about the well-known name is that it is assigned after the application starts and can be constant between runs of the program. This is useful since the unique name will change each time you run your program. The well-known name can be advertised and discovered. Remember the well-known name is only an alias for a unique name. That well-known name could be used with any application so could be reused for completely different code. Its unlikely but could happen. See well-known name (Uniquename alias)

The About service uses the unique name because that is the only name that is known to always map to the interface contained in the announce signal. If you know the well-known name there is little need to rely on the About service for discovery.

A possible solution for your problem would be to have the code that sends out the About announce signal also advertise its unique name.

Then when you get the announce signal you can do a FindAdvertisedName on the unique name. That way you can get the FoundAdvertisedName and LostAdvertisedName on that name.

edit flag offensive delete publish link more


As a side note : for me, About is the recommended way to implement discovery and there is generally no need to use the low level API FindAdvertisedName.

PierreR ( 2014-04-03 08:52:40 -0700 )edit

Thanks for your clear answer. Still, I think the comments in AnnounceHandler.h are misleading then: it clearly writes "well known name of the service", this should be "unique name of the service" then.

praetp ( 2014-04-04 00:09:32 -0700 )edit

I agree is If it says well-known name it should be updated.

georgen ( 2014-04-04 08:38:33 -0700 )edit

answered 2014-04-02 11:23:05 -0700

bspencer gravatar image

You should not be modifying the About Feature. It does not need a wellknown name. A wellknown name is an alias to the busName/uniqueName that identifies the remote application. ( https://allseenalliance.org/well-known-name-uniquename-alias )
The About Feature allows you to send the session port so that you can use the name provided via Announce and issue a JoinSession to the busName on the session port. Then you can join and communicate through the AllJoyn Session.

edit flag offensive delete publish link more


I was not modifying the About feature, merely the sample. I also find it strange this answer has already been selected as the 'correct' one. Isn't it up to the submitter to do this ?

praetp ( 2014-04-03 00:29:31 -0700 )edit

Moreover, the documentation explicitly mentions in AnnounceHander.h that the provided name is the well-known name so I think the current behaviour is a bug.

praetp ( 2014-04-03 00:31:05 -0700 )edit

@praetp you are correct the question should not have been marked as 'correct' except by you. I assume one of the other moderators clicked the button my mistake. I have un-checked it if you feel this question was correct please re-check the question.

georgen ( 2014-04-03 08:17:27 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-04-02 08:39:47 -0700

Seen: 629 times

Last updated: Apr 03 '14