AJTCL signal_service example doesn't send signals

asked 2015-04-09 18:14:49 -0700

mfitzpatrick gravatar image

The example apps in AJTCL (samples/basic/signal_service, samples/basic/signalConsumer_client) do not appear to work correctly. When I run these apps from the thin core then invoke nameChange_client, no signal is received by the signalConsumer_client instance.

However, if I run the same sample apps from core/alljoyn/build/linux/x86_64/debug/dist/cpp/bin/samples/ then the signal is sent/received properly.

Has anybody managed to get signals working in AJTCL? If so, where is the bug in these sample apps?

For completeness, here's the signal sending code from signal_service.c:

static AJ_Status SendSignal()
    AJ_Message msg;

    AJ_AlwaysPrintf(("Emitting Name Changed Signal. New value for property 'name' is '%s'.\n", propertyName));

    /* For the signal to transmit outside of the current process the session ID must be 0. */
    AJ_MarshalSignal(&busAttachment, &msg, BASIC_SIGNAL_SERVICE_SIGNAL, NULL, 0, AJ_FLAG_GLOBAL_BROADCAST, 0);
    AJ_MarshalArgs(&msg, "s", propertyName);

    return AJ_DeliverMsg(&msg);

And here's the signal receiving code from signalConsumer_client.c:

AJ_Status ReceiveNewName(AJ_Message*msg)
    AJ_Arg arg;
    AJ_Status status = AJ_UnmarshalArg(msg, &arg);

    if (status == AJ_OK) {
        AJ_AlwaysPrintf(("--==## signalConsumer: Name Changed signal Received ##==--\n"));
        AJ_AlwaysPrintf(("\tNew name: '%s'.\n", arg.val.v_string));

    return status;

(receive segment from main loop):

    status = AJ_UnmarshalMsg(&bus, &msg, UNMARSHAL_TIMEOUT);

    if (AJ_ERR_TIMEOUT == status) {

    switch (status) {
    case AJ_OK:
         * The contents of the message are meaningful, only when
         * the message was unmarshaled successfully.
        switch (msg.msgId) {
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-04-10 04:19:43 -0700

vjrantal gravatar image

Not sure if this is your issue, but the signal consumer sample was missing a call to AJ_BusAddSignalRule so it never got the signals. This was fixed in this commit https://github.com/allseenalliance/core-ajtcl/commit/3db5cd293ab6c6f82c1bf6ca7a93516c942051b4 which isn't in the RB14.12 branch, but can be found from the master branch.

edit flag offensive delete publish link more


Fantastic! This was the issue, thanks. In fact, the issue required both changes to signalConsumer_client.c: the AJ_PRX_MESSAGE_ID() change and the AJ_BusAddSignalRule change.

mfitzpatrick ( 2015-04-10 05:39:05 -0700 )edit

answered 2015-04-10 02:43:04 -0700

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

There are some miss match between code generated ajcodegen.py and repo generated router V14.12. You can try Installing router from git checkout v14.12, and compile them with cmd : scons BINDINGS=cpp OS=linux CPU=x86_64 VARIANT=debug BUILD_SERVICES_SAMPLES=off

Compile AJTCL code of repo downloaded from alljoyn-suite-14.06.00a-src.tar.gz Check download page. Now you service would attach with the router.

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

Question Tools

1 follower


Asked: 2015-04-09 18:14:49 -0700

Seen: 99 times

Last updated: Apr 10 '15