Sending signal through a session.

asked 2014-04-30 12:49:51 -0700

mattpho gravatar image

updated 2014-05-01 11:33:06 -0700

Hi, I am prototyping a gateway app that can discover multiple thermostat devices, each device can send overheat signal. The gateway app maintains multiple proxy objects, one for each device. Each proxy object register its own overheat signal handler. On the thermostat device, I pass a valid session id (instead of 0) to the Signal() call, hoping that the signal will be sent only to the proxy object connecting to the session (I also found Java example that indicates that passing sessionId works, but my code is using Windows 7 C++ SDK). To my surprise, the signal is sent to all proxy objects. I tried other ways to get the source of the signal and 'route' it to the correct proxy, e.g. tried calling message->GetSender() in the signal handler but it returns unique name, not the advertised, well-known name, tried using BusListener->NameOwnerChanged() call back to map the will-known name to unique name but NameOwnerChanged doesn't work correctly for multiple devices.

Is there anyway to send signal through a session or find a unique name from an advertised name?

Thank you


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-02 17:07:32 -0700

bspencer gravatar image

Signals do not route to proxy objects, they route to a registered signalhandler. ProxyBusObjects are used to execute BusMethod calls on a remote endpoint.

One thing that will help with the situation you are prototyping is to move away from wellknown name advertisements and use service level discovery via the About feature: https://allseenalliance.org/docs-and-downloads/documentation/alljoyn-about-feature-10-interface-specification

Using this you will have an understanding of what devices speak the "Thermostat" interface. Then you can display the Friendly name and when you receive the annoucement you have the unique name (aka Bus Name) that you can use to identify when you receive a signal.

Another option is to look at the session ID that comes in. When the "gateway" joins the sessions to the thermostat devices it will give the connecting application and the sending application the same SessionID. So upon your joinSession keep track of the name you joined and the sessionId. Then when the Signal comes into the registered signal handler from the message get the message->GetSessionId() call.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-04-30 12:49:51 -0700

Seen: 174 times

Last updated: May 02 '14