Skip to content

Commit

Permalink
Merge pull request #3 from industrial-edge/dev-branch
Browse files Browse the repository at this point in the history
Updates for V1.2 and bugfix
  • Loading branch information
EvaKaul authored May 19, 2021
2 parents fec9cb6 + 69c0715 commit 651a727
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 18 deletions.
68 changes: 51 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,80 @@
# Databus Ping Pong implementation in C
# Databus Ping Pong C

This application example contains the source files to build a Databus Ping Pong application implemented in C.




- [Databus Ping Pong implementation in C](#databus-ping-pong-implementation-in-c)
- [Databus Ping Pong C](#databus-ping-pong-c)
- [Description](#description)
- [Overview](#overview)
- [General task](#general-task)
- [Requirements](#requirements)
- [Used components](#used-components)
- [Further requirements](#further-requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Contribution](#contribution)
- [Licence and Legal Information](#licence-and-legal-information)

## Description
This repository contains the source files to build the Databus Ping Pong application example implemented in C. Please refer to the [main repository](https://github.com/industrial-edge/pingpong-python) for more information about this application example.

This repository contains the source files to build the Databus Ping Pong application example implemented in C. Please refer to the [Ping Pong in Python repository](https://github.com/industrial-edge/pingpong-python) for more information about this application example.

### Overview
This example uses the [Eclipse Paho MQTT C library](https://github.com/eclipse/paho.mqtt.c) to enable it to connect to the IE Databus.
This implementation of the Databus Ping Pong application example uses a multi-stage process for building the docker image to keep the image size as small as possible. The two ``FROM`` Statements in the [Dockerfile](src/Dockerfile) separate the build process into two stages.
The fist stage is compiling the source code of the application and the paho library which then get copied to the second stage which will be the final image for the application. Please refer to the the [docker documentation](https://docs.docker.com/develop/develop-images/multistage-build/) for more information regarding multi-stage builds.

This application example shows how to connect to the IE Databus via MQTT and how to publish and subscribe data using an implementation in C. The IE Flow Creator is used to exchange data between different topics within the IE Databus. This example uses the [Eclipse Paho MQTT C library](https://github.com/eclipse/paho.mqtt.c) to enable the connection to the IE Databus.

It also uses a multi-stage process for building the docker image to keep the image size as small as possible. The two ``FROM`` Statements in the [Dockerfile](src/Dockerfile) separate the build process into two stages. The fist stage is compiling the source code of the application and the paho library which then get copied to the second stage which will be the final image for the application. Please refer to the the [docker documentation](https://docs.docker.com/develop/develop-images/multistage-build/) for more information regarding multi-stage builds.

![Use Case](docs/DataFlow.png)

### General task

The application includes a MQTT client to subscribe to one topic of the IE Databus and waits to receive data. When data arrives, it publishes a corresponding answer to a second topic of the IE Databus. If it receives the string "Ping", it will answer with "Pong" and the other way around.

![Use Case](docs/Usecase.png)

The names of the IE Databus topics as well as the credentials used by the application can be configured, otherwise environmental variables included in the docker-compose file are used.

## Requirements

### Used components

- Industrial Edge Management V1.2.0-36 / V1.2.14
- IE Databus V1.2.16
- IE Databus Configurator V1.2.23
- IE Flow Creator V1.1.2
- Industrial Edge Device V1.2.0-56
- Industrial Edge App Publisher V1.2.7
- Docker Engine V20.10.3
- Docker Compose V1.28.5

### Further requirements

- IE Device is onboarded to a IE Management
- IE Databus Configurator is deployed to the IE Management
- IE Databus is deployed to the IE Device
- IE Flow Creator is deployed to the IE Device

## Installation

Please refer to the [Installation](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md) section of the main repository on how to build and deploy the application to a Industrial Edge Device.
Please refer to the [Installation](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md) section of the *Ping Pong in Python* repository on how to build and deploy the application to a Industrial Edge Device.
When creating a configuration for the application in the Industrial Edge Management System, you can use the the [mqtt-config.json](cfg-data/mqtt-config.json) file from this repository.

## Usage

Please refer to the [Testing](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md#testing-the-application-using-simatic-flow-creator) section of the main repository on how to build and deploy the application to a Industrial Edge Device.
Once the application is successfully deployed, it can be tested using the IE Flow Creator.

Please refer to the [Testing](https://github.com/industrial-edge/pingpong-python/blob/main/docs/Installation.md#testing-the-application-using-simatic-flow-creator) section of the *Ping Pong in Python* repository on how to use it.

## Documentation


You can find further documentation and help in the following links
- [Industrial Edge Hub](https://iehub.eu1.edge.siemens.cloud/#/documentation)
- [Industrial Edge Forum](https://www.siemens.com/industrial-edge-forum)
- [Industrial Edge landing page](https://new.siemens.com/global/en/products/automation/topic-areas/industrial-edge/simatic-edge.html)
- [Industrial Edge GitHub page](https://github.com/industrial-edge)


- [Industrial Edge Hub](https://iehub.eu1.edge.siemens.cloud/#/documentation)
- [Industrial Edge Forum](https://www.siemens.com/industrial-edge-forum)
- [Industrial Edge landing page](https://new.siemens.com/global/en/products/automation/topic-areas/industrial-edge/simatic-edge.html)
- [Industrial Edge GitHub page](https://github.com/industrial-edge)

## Contribution

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.
Expand Down
Binary file added docs/DataFlow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Usecase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/paho_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ int main(int argc, char *argv[])
strcat(address2, port);

username = json_object_get_string(j_username);
password = json_object_get_string(j_username);
password = json_object_get_string(j_password);
topic1 = json_object_get_string(j_topic1);
topic2 = json_object_get_string(j_topic2);
address = address2;
Expand Down

0 comments on commit 651a727

Please sign in to comment.