The Internet of Things (IoT) is all about connectivity and scalability. A lot of great technology exists on the cloud side of the IoT which enables fast prototyping, yet scales as the amount of data and number of devices increases. However, the things (embedded, connected sensor devices such as the Bosch Cross Domain Development Kit - XDK) in IoT remain elusive to a lot of developers.

Example

Let's have a look at an example and use the Bosch XDK to build a shock detector connected using MQTT over WLAN:

// Mita has packages which are the main unit of isolationpackagemain;
// Every Mita program must import a platform, here we use the XDKimportplatforms.xdk110;
// System resources are configured using the setup keyword.// Here, we configure the WLAN connectivity of the XDK.
setup devnet :WLAN {
ssid ="MyWifiName";
psk ="supersecretkey";
}
// Software resources are resources nonetheless and thus are set up// using the setup keyword. Notice how we refer to the devnet WLAN setup// as means of transport, and instantiate a signal to the /events topic.
setup backend :MQTT {
transport = devnet;
url ="mqtt://iot.eclipse.org:1883";
clientId ="shockDetector42";
var events = topic(name="/events");
}
// Functions use the fn or function keyword. If the return type were omitted// the Mita compiler would infer it automatically. Also, notice the type// parameter of the array.
fn mean(x : array<uint32>) : uint32 {
...
}
// Variables can be immutable (let) or mutable (var).// For arrayPosition we do not have to explicitely give a type as our// type inference infers it from the initialization.
let acceleration =new array<uint32>(size=10);
var arrayPosition =0;
// The every keyword handles events. Here we use time as an event source and// run at a regular interval.
every 10 milliseconds {
// Sensor data (and other modalities) are available due to the platform import above.// One can use some resources even if they were not configured beforehand.
acceleration[arrayPosition] = accelerometer.magnitude.read();
arrayPosition = (arrayPosition +1) % acceleration.length();
// The mean() function can be called using the familiar OO-style notation.// The expression on the left side of the dot becomes the first argument// of the function call.if(acceleration.mean() >5000) {
// Writing to the signal instance we've created in the signal block// above sends out the MQTT message (backend is an MQTT resource// after all). Using backticks we can use string interpolation.// Here we construct a JSON string inline to the function call.
backend.events.write(`{ "type":"shock", "mag": ${acceleration.mean()} }`);
}
}
// Events are described and offered by the platforms.// This pressed event exists because the xdk110 platform imported// above declares it.
every button_one.pressed {
for(var i =0; i < acceleration.length(); i++) {
acceleration[i] =0;
}
arrayPosition =0;
}

However, not so many examples in Mita, like Bluetooth connection and data exchange with android code, read Analog and digital signal from extension bus, A/D conversion, write to digital output, I2C, internet connection and communication via https/http, UDP etc. XDK Live in the Help of Workbench does not provide full example source code or no sample soource code for the above cases.

Unfortunately, XDK-Live is still in development and as such, not all features from the SDK of the XDK are included, yet. Specifically, the features you asked for are not yet available, but more features will be added continuously. Since Eclipse Mita is an open source project, you can view any progress in that regard in the Eclipse/Mita Repository .

The following modules are currently supported:

Sensors: Accelerometer, Environmental sensor and Light sensor

Utility: Buttons and LEDs

Connectivity: BLE and Wi-Fi

Protocols: MQTT and HTTP (REST)

Currently, the only way to add platform functionality, other than by waiting for XDK-Workbench updates, is the Foreign Function Interface. It allows integrating C interfaces and calling their functions in your XDK-Live application. For more information, I recommend taking a look at the corresponding section in the XDK Live Documentation .

Please let me know, if that was helpful and feel free to ask if you have further questions.

the easiest way to integrate the latest mita updates and use them in the XDK-Workbench would be to download the latest stable jenkins artifact of the Mita Repository. This link here will immediately start a download for the latest artifact file.

Once you downloaded the artifact, extract it and you will find the directory target containing a few files. One of these files is a zip archive prefixed with org.eclipse.mita.repository . This can be installed in the XDK-Workbench.

Before installing Mita, XDK Live must be removed from the XDK-Workbench, otherwise there will be conflicts between the two plugins.

To delete XDK Live, go to your Workbench and select Help > About XDK Workbench in the top menu bar. In the new window, press the Installation Details button. This will open a new window with a list of all currently installed Plugins. In that list, you will find a plugin caled XDK LIVE Language Feature . Select it and press Uninstall . Review and Confirm the Process, and the XDK Live Language Feature will be removed from the XDK-Workbench.

Note: the plugin also integrates the XDK Live documentation into the XDK-Workbench, which will thus be unavailable. But, the documentation is hosted separately here .

Now that XDK Live ist removed, MITA can be installed. For this, select Help > Install New Software... , then press the button Add... at the top on the right-hand side. Select Archive... in the new popup window, and locate the aforementioned zip file with the prefix org.eclipse.mita.repository from the unpacked target-directory.

Press Ok and select Mita Runtime and Platforms for installation and then go through the Installation Process.

Now that Mita is installed, you will have to use the filetype extension .mita instead of .x for your new XDK Live applications.

Please tell me if this was helpful, and do not hesitate to ask further questions.

I updated the mita packages as you have described. I have got the following error at the end of the installation:

An error occurred while collecting items to be installed session context was:(profile=DefaultProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.eclipse.mita.library.stdlib,0.1.0.201807110642 No repository found containing: osgi.bundle,org.eclipse.mita.program,0.1.0.201807110642 No repository found containing: osgi.bundle,org.eclipse.mita.program.ide,0.1.0.201807110642 No repository found containing: osgi.bundle,org.eclipse.mita.program.ui,0.1.0.201807110642