Deprecation Notice The Data-Driven API project has been terminated and this code is no longer maintained. The last released version is R15.04, tagged in this repository as v15.04.
The Data-driven API (DDAPI) for AllJoyn is an alternative API for the AllJoyn framework. It is built on top of the standard AllJoyn API and is specifically tailored to use cases for the Internet of Things. Instead of the standard framework's service-oriented paradigm, it uses the publish/subcribe paradigm.
Some conceptual knowledge of the standard AllJoyn framework is required to use the DDAPI. for application development.
To get to know the DDAPI, here are some sources of information:
-
Introduction to the DDAPI in the learn section of the AllSeen documentation website
-
Detailed API guides and tutorial in the [develop section of the AllSeen documentation website][ddapi_guide]
-
Using doxygen, you can build a reference manual in HTML format directly from the source code.
The general installation process for the DDAPI is as follows:
- Download and Install AllJoyn Core. If AllJoyn core is not installed globally on your system, set ALLJOYN_DISTDIR to the path where alljoyn is compiled. For Linux 64bit this is ${ALLJOYN_SRC_DIR}/build/linux/x86_64/debug/dist/
- [Install][cginst] the AllJoyn Code Generator. If the Code Generator is not installed globally on your system, make sure ajcodegen.py is in your PATH and PYTHONPATH point to dist/lib/python in the codegen compilation.
- Unpack the DDAPI tarball in the directory where you installed the AllJoyn Core files.
- Go to the directory
/data/datadriven_api/
and run the scons script.
Read the rest of this document for more information.
The samples have been compiled with a built-in router. Therefore, there is no need to start the AllJoyn routing daemon.
DDAPI applications depend on liballjoyn_ddapi.so
, which in turn depends on
liballjoyn.so
and liballjoyn_about.so
. You'll need to include the location
where you installed these libraries in the LD_LIBRARY_PATH
environment
variable. For example:
$ LD_LIBRARY_PATH=${ALLSEEN_INSTALL_PATH}/lib/:${LD_LIBRARY_PATH}
$ export LD_LIBRARY_PATH
There are currently two sample applications to illustrate the use of the DDAPI:
- a simple chat application (in
samples/ddchat
) - a toy home security system simulation (in
samples/door
).
Before you can use the DDAPI, the following needs to be fulfilled:
- Your compiler should at least support C++0x.
- You must make sure you downloaded and installed AllJoyn Core Framework.
- You must make sure you [installed][cginst] the AllJoyn Code Generator.
The AllJoyn Code Generator is a command line driven tool which reads AllJoyn introspection XML files and outputs both client and server code ready for compilation and running. The Code Generator creates the type support classes for all interfaces you defined using the AllJoyn Introspection XML.
The code generator is located in the devtools folder. Use the SCONS script to build it.
For detailed instructions on how to use the code generator, we refer you to the code generator's documentation.
As a quick instruction, use the following command to convert an Introspection XML file:
$ ajcodegen.py -t ddcpp your_interface_definition.xml
For each interface specified in the XML file, 3 header files and 3 source files are generated:
- One of each for the consumer side (
<intfname>Proxy.{cc|h}
). - One of each for the provider side (
<intfname>Interface.{cc|h}
). - One of each that is common to both consumer and provider and that
describes the interface type (
<intfname>TypeDescription.{cc|h}
).
To install the DDAPI, unpack the DDAPI tarball in your AllJoyn installation folder. The
DDAPI files are located in the data/datadriven/
folder. Use the SCONS script to build it.
To buiild your own Linux application with the DDAPI, you must pass two AllJoyn-related defines:
QCC_OS_LINUX
QCC_OS_GROUP_POSIX
All files pertaining to the DDAPI are found in the datadriven directory. Regarding header dependencies, you should include the individual directories found under cpp/inc in your compilation directive.
Besides these framework include directories, you still need to make sure the generated header files (based on your data model) are found.
After the compilation step of your application (make sure to also compile the generated code), you should link your application to:
- liballjoyn_ddapi.so
- liballjoyn_about.so
- liballjoyn.so
[cgdl]: [cginst]: https://wiki.allseenalliance.org/devtools/code_generator