This tutorial will guide you through a simple node joynr radio application, explaining three essential joynr concepts:
- A simple radio communication interface
- A consumer interested in knowing about radio information
- A provider, that provides the radio information
If you haven't built joynr yet, please do so first:
This will install the necessary dependencies to your local Maven repository and generate the radio application source files.
The joynr JS binding is build using Maven:
<JOYNR>/javascript$ mvn clean install
The node JavasciptRadioApp demo is located in <JOYNR>/examples/radio-node
. We refer to this
location as RADIO_HOME
.
Have a look into the Radio Tutorial to get an understading of the communication interface and the basic joynr concepts.
The generated source code from the Radio model is located in <RADIO_HOME>/src/main/generated
.
Have a look into <RADIO_HOME>/src/main/js/radioProvider.js and <RADIO_HOME>/src/main/js/MyRadioProvider.js for provider implementation and registration details.
Have a look into <RADIO_HOME>/src/main/js/radioConsumer.js for consumer implementation details.
You need to have Maven installed.
For both, consumer and provider, the backend (MQTT broker, Global Discovery Service) and a local standalone cluster-controller need to be started first.
Please refer to the starting joynr backend instructions
In order to be able to start a standalone C++ cluster controller, the C++ environment must have been built previously.
Start the standalone cluster controller as follows:
cd <JOYNR>/cpp/build/joynr/bin
./cluster_controller
The node environment has to be prepared once prior to starting applications.
<RADIO_HOME>$ mvn install
<RADIO_HOME>$ npm install
Run the provider application in a terminal
<RADIO_HOME>$ npm run startprovider
Run the consumer in another terminal
<RADIO_HOME>$ npm run startconsumer
The provisioning is partially done in the files <RADIO_HOME>/package.json and <RADIO_HOME>/src/main/js/provisioning_common.js.
This example uses the UDS libjoynr runtime which communicates via unix domain socket with a preexisting
cluster controller.
For different runtimes (e.g. WebSocket runtime) and further options, see radio-node README.
See JavaScript Configuration Reference for details on the possible provisioning settings.