How to create multi services for AJTC?

asked 2014-08-23 11:21:09 -0700

congtam gravatar image

Hi everyone,

I'm trying to create 2 AJTC services on Arduino (one to turn on/off a led, one to blink it) to test running multi-services on AJTC. As what I know, each service is presented by its object and its interface. So i think that I can create two services by defining two objects and also two corresponding interfaces. Then I used the method AJ_StartService(...) to create one by one these service. For the first, it is successfully created. But for the second, it doesn't work. I think the problem is that once time we call AJ_StartService, we make again the connecting procedure with the Daemon. I also looked up in the module: aj_helper, it seems that all methods to create the service make the connecting Daemon. Is there another the method to create a service for AJTC without making again the connecting to Daemon? Or Did I make a mistake for the basic information, do anybody try to do the same thing? Could you advice me how to do?

edit retag flag offensive close merge delete


Hi everyone, i would like to update my question a little. Perhaps, I have had a confusion between Service and Application of a bus. for the method AJ_StartService(...) of AJTC on ARduino, this method creates a service corresponding to an application on the bus. When we want to create another service, we need only define its interface and its object. So, the method AJ_StartService(...) needs just called once. Am I right or wrong in this explain? Could anybody help me to understand more? Thanks.

congtam ( 2014-08-25 08:33:30 -0700 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-03 00:51:04 -0700

bspencer gravatar image

Hi Congtam,

There is no need to create multiple services to perform the functionality you are looking for. On a Thin Core Library application since you want to conserve resources one would traditionally offer up multiple interfaces on the same service. IE you have one Advertisement via About or wellknown name, that expresses that you support the ability to be blinked or turned on/off. You can then either have a single BusObject that implements multiple AllJoyn Interfaces or you can have multiple BusObjects.

For the use case that you have mentioned I would recommend having a single interface that has 3 BusMethods ofturnOn(),turnOff(), andblink()`. Separating out the functionality is overkill for this simple experience. If you were to do more complicated things then I could see splitting out a power interface from some controls.

edit flag offensive delete publish link more


Hi Bspencer, thanks for the reply. My purpose is to test the multi services on AJTC. Follow https://ask.allseenalliance.org/question/726/does-ajtc-support-multi_services/, I would like to make the test if AJTC supports several services in the same process . So I have made two services: org.alljoyn.sample.ledcontroller for turnOn/Off, org.alljoyn.sample.ledcontroller for blink. And we have two advertisements correspondent to two services. Could we do that? Thanks

congtam ( 2014-09-05 08:43:08 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2014-08-23 11:21:09 -0700

Seen: 103 times

Last updated: Sep 03 '14