0

How to send Signal point-to-point and multicast in C++

asked 2014-07-23 09:34:16 -0700

trandatnh gravatar image

From the article Posted By Brian Spencer, I understand signal can be sent multicast, broadcast and point-to-point.

In the C++ API, I guess this is the function to send signals, correct me if I am wrong.

The first parameter of the Signal function is the destination: The unique or well-known bus name or the signal recipient (NULL for broadcast signals)

  1. Could anyone give me examples of how to send a Signal to a specific end point by using unique name or well-known bus name?
    i.e: im20YHZc.3

  2. How to send multicast signals.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-07-23 13:15:58 -0700

bspencer gravatar image

Hello Trandatnh,

With AllJoyn a Signal can be sent out to all the applications connected with the same sessionId, to a specific application on a sessionId, or as a broadcast to all connected AllJoyn Routers by setting the sessionId to 0 and using the flag ALLJOYN_FLAG_GLOBAL_BROADCAST from Message.h

We also have what is called a "SessionLess Signal" which allows for publication and receipt of a Signal without joining a session or having the AllJoyn routers form a connection.

For information about a Signal you can read this content. For example software you can see the chat sample application, signal service example, and signalConsumer for signal service.

For Sessionless signals you can look at the About feature which makes use of this feature. Documentation for the About feature is on the AllSeenAlliance page.

To very directly answer your (1) question you would first join a session and then do something like this from inside your BusObject using the Signal API:

    QStatus status = Signal("ask.allseen.answer.brian", 3293355562, *signalMember);

Where the above snippet of code has a client side application sending a signal to the service it had joined. The name "ask.allseen.answer.brian" was found via Discovery using the Wellknown name prefix "ask.allseen.answer" where some application is advertising the service and signalMember is an InterfaceDescription::Member object that was setup as part of using the AllJoyn APIs.

or if the service wanted to send a signal to a specific endpoint that it knew about via the SessinJoined callback:

QStatus status = Signal(":WQ2J_Gnu.2", 3293355562, *signalMember);

Where the ":WQ2J_Gnu.2" represents the client application that we wish to send a directed signal to.

The above 2 code snippets have hardcoded strings for the first argument to a Signal and this would not be the case in a final application, just used as an example.

edit flag offensive delete publish link more

Comments

Could you give any detail of sending multicast? i.e: I want to send a message to 2 out of 10 participants in chat example.

trandatnh ( 2014-07-23 19:54:08 -0700 )edit

There are multiple ways that this can be accomplished. 1) Have a new session with the 2 participants and use that sessionId. 2) Send 2 signals, 1 to each participant 3) Ditch signals and use a BusMethod 4) (insecure) but modify the signal so that you have a recipients array and filter on the receiving side. Not a recommend option, but something that could be done. How you use AllJoyn is based on the needs and how you want to design your application. It is very flexible. Just like any API there are a ways to use it based on your development needs. What you are asking for is (1) above. Have a new multi-point session created and use the sessionId to send the signal.

bspencer ( 2014-07-24 13:52:50 -0700 )edit

Having new multi-point session is a good idea. Many thanks @bspencer

trandatnh ( 2014-07-24 17:49:14 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-07-23 09:34:16 -0700

Seen: 237 times

Last updated: Jul 23 '14