The agrirouter is a universal data exchange platform for farmers and agricultural contractors that makes it possible to connect machinery and agricultural software, regardless of vendor or manufacturer. Agrirouter does not save data; it transfers data. As a universal data exchange platform, agrirouter fills a gap on the way to Farming 4.0. Its underlying concept unites cross-vendor and discrimination-free data transfer. You retain full control over your data. Even data exchange with service providers (e.g. agricultural contractors) and other partners is uncomplicated: Data are very rapidly transferred via the online connection, and if you wish, is intelligently connected to other datasets.
This project contains the C++ API for the communication with the agrirouter. Everything you need for the onboarding process, communication and much more.
The following packages have to be installed on your device
- protobuf:
protobuf installation guide - curl:
sudo apt-get install curl
- uuid and uuid-dev:
sudo apt-get install uuid uuid-dev
- Create build directory
mkdir build
- Go to build directory
cd build
- Create Makefiles
cmake ..
- Build lib and tester
make
The configuration file AgrirouterClientTesterConfig.json
looks like this
{
"applicationSettings": {
"applicationId": "SOME_APPLICATION_ID",
"certificationVersionId": "SOME_CERTIFICATION_VERSION_ID",
"externalId": "SOME_EXTERNAL_ID",
"locationCertsAndIds": "THE_LOCATION_WHERE_THE_KEY_AND_CERT_ARE_STORED",
"teamsetContextId": "SOME_TEAMSET_CONTEXT_ID",
"connectionType": "HTTP"
},
"agrirouterSettings": {
"registrationServicePath" : "onboard.my",
"landscape" : "agrirouter",
"cfHost" : "com",
"apiPrefix" : "api/v1.0"
}
}
- To use the tool change the applicationSettings in the configuration file.
- Show help of the agrirouter client tester
./AgrirouterClientTest --help
- For e.g. onboarding to get certificates
./AgrirouterClientTest --onboard=123456789
The project is devided into 2 parts: the lib and an example application that is using the compiled lib.
Before creating a pull request, please build the application and remove all occuring errors.
The following instructions are based on the Google Protobuf installation guide and are optimized for Unix based systems. For Windows it is recommended to install Cygwin and do the same steps as if you were on a Unix based system.
For example Debian/Ubuntu
- Update sources
sudo apt update
- Install protoc and protobuf
sudo apt install protobuf-compiler libprotobuf-dev libprotoc-dev
You can download protoc and protobuf packages from Google Protobuf Releases. Make sure you download the same versions of protoc and protobuf otherwise the installation won't work.
E.g. protoc-21.11-linux-x86_64.zip and protobuf-cpp-3.21.11.zip
- Unzip package
unzip protoc-3.* -d protoc3
- Move protoc to /usr/bin/
sudo mv protoc3/bin/protoc /usr/bin/
- Move included packages to /usr/include/
sudo mv protoc3/include/* /usr/include/
- Optional: make protoc executable for everyone
sudo chmod +x /usr/bin/protoc
- Optional: make includes readable for everyone
sudo chmod +r /usr/include/google/*
- Unzip package
unzip protobuf-cpp-3.* -d protobuf3
- Go to folder profobuf3 and make file configure executable
chmod +x configure
- Execute following commands
./configure
make
make check
sudo make install
sudo ldconfig
Note: If "make check" fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.
If you want to compile some proto files use protoc [OPTIONS] PROTO_FILES
The [OPTIONS]
part indicates the destination of compiled file. You can use relative and absolute paths.
In the PROTO_FILES
part you can define which protobuf files will be compiled.
E.g. the command protoc --cpp_out=. ./*.proto
compiles every every proto file in this folder and places the compiled ones within this folder.
The files are generally generated with the build system. If it is necessary to compile them without the build system, perform the following steps:
- Go to protobuf folder
cd ./lib/AgrirouterClient/src/Protobuf/
- Execute the compile protobuf script
. ./compileProtos.sh
The generate files can be found under ./lib/AgrirouterClient/inc/Protobuf/
If you want to use cross compiling you have to use --host
option when executing ./configure
.
E.g. ./configure --host=powerpc-linux CC=powerpc-linux-gnu-gcc CXX=powerpc-linux-gnu-g++ --with-protoc=/usr/bin/protoc
Also see Cross-compiling hints.