0

Find out signal emitter's well-known name

asked 2014-10-16 04:17:19 -0800

yan.foto gravatar image

Is there any way to find out the well-known name of a signal emitter except mentioning it directly as a parameter of that signal? This would be useful if the signal consumer decides to contact the emitter depending on the received values of the signal (Room 501 is too hot -> turn AC on).

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-11-10 15:23:48 -0800

bspencer gravatar image

There is no need to know the well-known name (WKN) of the sending device. The WKN is something that you discover that can be used to help understand what the BusId is of the other devices around you. Very much like an Alias. When you receive a Signal you can call back directly to the device via the sender value of the the MessageContext. In order to get this in the SignalHandler you will use your BusAttachment.getMessageContext()) call. Then assuming that the sender has a Session that has been bound and you are aware of the Session Port then you can perform a JoinSession and then call methods.

One thing that I would encourage you to look at Notification with Action's. This combines the Notification Service with the Control Panel Service so that a Popup can be rendered on a device that is capable of accepting user input and then the user can take action to perform a call on the remote application. The Notification service allows for the ability to set a respObject path which you would set as a CPS object path for your dialog. Then using the CPS code gen tool you can define the popup dialog in notificationActions tag ( https://git.allseenalliance.org/cgit/services/base_tcl.git/tree/controlpanel/tools/CPSAppGenerator/SampleXMLs/aj_on_airconditioner.xml ). In your example the AC could send out a Notification of "Room 501 is too hot" with the actions of: Dismiss, Turn AC on, Call room (etc.).

NOTE: You said Signal emitter which is only present using the Java Language binding. The same concept applies to other language bindings, get the sender field and then JoinSession back to them.

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

Question Tools

Follow
1 follower

Stats

Asked: 2014-10-16 04:17:19 -0800

Seen: 89 times

Last updated: Nov 10 '14