1

Doubts concerning About function and Method call

asked 2015-04-02 11:51:47 -0700

marcomontebello gravatar image

updated 2015-04-04 08:30:28 -0700

Hello everyone! I'm sorry for my english but I need your help for some of my doubts.... I'm developing a system for my thesis's work at university: A smart Mall based on the alljoyn environment .... The first doubt is about the implementation of the client. I explain it with an example: -I'm in a shopping mall and all the shops offer an alljoyn service as the function to search a product in their DB. All of them offer services and advertises their interfaces...If i want to create a session with a particular store I need to implement its interfaces and create a proxy object to call the store methods and properties, do you agree? So if i want to be able to communicate and use all the services in the mall i need to implement all the interfaces of all the shops in my client app (android app maybe) ??? There is a way to do this dynamically?

And the second doubt is - There is a way to use dynamic fields in the About Announce? Another example: If I want to choose the store whit the lowest number of clients in that moment because i need to be quick I can use a simple counter that count the number of sessionjoiner of the session where the session host is a store service. Can I use this counter value like a field of the AboutAnnouncement?

Thank you in advance for your patience and excuse me for my poor experience with english and with Alljoyn!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-02 01:55:48 -0700

praveenb gravatar image

Let me answer your second doubt first. Yes, it is possible to have developer-defined fields as part of About metadata in an About announcement. The signature of About metadata is a{sv} which means it is a dictionary where string is a key and variant (also a developer-defined value) is the value. One can add any number of developer-defined fields to About metadata. For an example code of adding developer-defined field to the About metadata, see: https://git.allseenalliance.org/cgit/core/alljoyn.git/tree/alljoyn_core/unit_test/AboutDataTest.cc#n982

Having said that, the choice of using About announcement to convey a transient value viz. number of clients currently in session with host is very unnatural. About announcement is expected to be used for the specific purpose of host discovery by clients. It is unusual to keep on updating About announcement with About metadata that contains the transient field, as and when the value changes. A different course would be use to a store-and-forward signal from a different interface altogether that conveys the current number of clients in session with host. The application that chooses a store can subscribe to this signal and can know the value(s) it is interested in.

Coming to the first question, here are a couple of Q&As:

  • What is necessary for a client to join a host? All a client requires is to have received the About announcement which contains the unique name and the AllJoyn port number of the host. Unique name and AllJoyn port number are the only two items that are needed to join a session with the host. Upon the successful session formation, both ends will get the id of session formed.
  • What is a proxy bus object and how can a client use it? A proxy bus object can be created with the object path and the specific interfaces the client wishes to use. Client need not create all the interfaces that service implements. In your scenario, you can create a proxy bus object with just the interface containing members (methods, signals and properties) that allow you to search a store's product in their database. Proxy bus object requires a session id to be passed as a parameter for creation.

One course that you can take, is by having all stores implement a developer-defined standard interface, sample.alljoyn.mall.store.search. Then your client app can do a discovery of WhoImplements sample.alljoyn.mall.store.search. As and when stores are discovered, your client app can form sessions with them and perform the search.

In addition to this, you can also have all stores implement a developer-defined standard interface, sample.alljoyn.mall.store.info that contains a store-and-forward signal member NumCurrentClientConnections. The stores update this store-and-forward signal member as and when clients join and leave. Your client app can register for the specific store-and-forward signal emitted from sample.alljoyn.mall.store.info to keep track of stores that are busy.

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

Question Tools

Follow
1 follower

Stats

Asked: 2015-04-02 11:51:47 -0700

Seen: 130 times

Last updated: May 02 '15