asked 2014-05-22 09:54:37 -0700

alphaemmeo gravatar image

Hi everyone,

I'm trying to extend the ledctrl.cc in order to have an application that controls the arduino board in a session and provide a service in another one. To do this I started adding the basic_service.cc features into my_ledctrl.cc.

Currently I can compile this new file, control the arduino board but not use the basic_client application for testing the service available in my_ledctrl.cc.

----- my_ledctrl.log ----------------

17:42:18@pata01 bin 344a451 ? ./my_ledctrl
   |myDEBUG: inside the Connect function - status variable is = ER_OK
Interface created.
RegisterBusObject succeeded.
ObjectRegistered has been called.
RequestName('org.alljoyn.Bus.sample') succeeded.
NameOwnerChanged(org.alljoyn.Bus.sample, null, :7ETmrBXA.2)
BindSessionPort succeeded.
Advertisement of the service name 'org.alljoyn.Bus.sample' succeeded.
RequestCredentials for authenticating  using mechanism ALLJOYN_PIN_KEYX
NameOwnerChanged(:7ETmrBXA.3, null, :7ETmrBXA.3)
NameOwnerChanged(org.alljoyn.sample.ledservice, null, :7ETmrBXA.3)
FoundAdvertisedName(name=org.alljoyn.sample.ledservice, transport=0x1, prefix=org.alljoyn.sample.ledservice)
Joined Session 1807392053
flash 2
>> flash 2
NameOwnerChanged(:HhWDfecg.2, null, :HhWDfecg.2)
NameOwnerChanged(:HhWDfecg.1, null, :HhWDfecg.1)
NameOwnerChanged(:HhWDfecg.1, :HhWDfecg.1, null)
NameOwnerChanged(:HhWDfecg.2, :HhWDfecg.2, null)

----- basic_client.log ----------------

17:43:15@pata01 samples 344a451 ? ./basic_client
BusListener Registered.
   0.028 ****** ERROR NETWORK lepDisp           common/os/posix/Socket.cc:283 | Binding (sockfd = 51) to 9955: 98 - Address already in use: ER_OS_ERROR
org.alljoyn.Bus.FindAdvertisedName ('org.alljoyn.Bus.sample') succeeded.
Waited 0 seconds for JoinSession completion.
FoundAdvertisedName(name='org.alljoyn.Bus.sample', prefix='org.alljoyn.Bus.sample')
   |myDEBUG: transportList.size() = 1
   |myDEBUG: transportList[0]: tcp
   |myDEBUG: trans->GetTransportName: tcp
   |myDEBUG: transportSpec = tcp:r4addr=,r4port=9955
   |myDEBUG: transportSpec.compare: 0
NameOwnerChanged: name='org.alljoyn.Bus.sample', oldOwner='<none>', newOwner=':7ETmrBXA.2'.
   0.328 ****** ERROR ALLJOYN external          ...router/DaemonRouter.cc:173 | Returning error METHOD_CALL[6] org.alljoyn.Bus.sample.cat(ss) no route to org.alljoyn.Bus.sample: ER_BUS_NO_ROUTE
MethodCall on 'org.alljoyn.Bus.sample.cat' failed.Basic client exiting with status 0x9032 (ER_BUS_REPLY_IS_ERROR_MESSAGE).

You can download the files here

I tried to debug the above issue but I didn't understand where I wrong.

If you need more details not hesitate to ask me.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-22 11:55:50 -0700

waynelee gravatar image

The basic_client.log show that the session failed with ER_ALLJOYN_JOINSESSION_REPLY_REJECTED. This points to the service not accepting the session.

On the thin core service side, check that you are processing the AJ_METHOD_ACCEPT_SESSION message correctly. Here are the pertinent bits from due_led.cc:

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

if (status == AJ_OK) {
    switch (msg.msgId) {
            uint16_t port;
            char* joiner;
            AJ_UnmarshalArgs(&msg, "qus", &port, &sessionId, &joiner);
            status = AJ_BusReplyAcceptSession(&msg, TRUE);
             if (status == AJ_OK) {
                AJ_InfoPrintf(("Accepted session session_id=%u joiner=%s\n", sessionId, joiner));
            } else {
                AJ_InfoPrintf(("AJ_BusReplyAcceptSession: error %d\n", status));

BTW, I took a peak at your my_ledctrl.cc and did not see any service bits in there, like the message processing loop. Take a look at due_led.cc for a better example of what is needed.

edit flag offensive delete publish link more


@waynelee thanks a lot. Differently from what did you hint, I used the snippet code from "basic_service.cc":208 bool AcceptSessionJoiner(SessionPort sessionPort, const char* joiner, const SessionOpts& opts). But any way your answer has been very useful. thx

alphaemmeo ( 2014-05-23 01:27:27 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-05-22 09:54:37 -0700

Seen: 350 times

Last updated: May 22 '14