To show the use of the MxMessageSystem SDK, a small sample program was developed, which is contained as source code. The sample program can send and receive MxMessages. This README
file serves as an guide for compiling and using the sample program.
The MxMessageSystem SDK can be compiled and used on Windows, Linux and OS X computers.
Make sure that the following programs have been installed on Ubuntu 16.4 Linux x86_64:
sudo apt-get install build-essential openssl libssl-dev cmake
Make sure that the program versions are current:
cmake >= 3.2
: https://cmake.org/GCC >= 4.8
: https://gcc.gnu.orgOpenSSL
: https://www.openssl.org/To compile the sdk-demo
program, execute:
cmake .make
OS X 10.9 or higher must be used.
To compile the sdk-demo
program, execute:
cmake .make
It is also possible to generate an Xcode project:
cmake -G Xcode .
Make sure that the program versions are current:
cmake >= 3.2
: https://cmake.org/Visual Studio 14 2015
: https://www.visualstudio.com/To compile the sdk-demo
program, execute:
cmake -G "Visual Studio 14 2015"cmake --build . --target ALL_BUILD --config Release
The MxMessageSystem SDK has two configurations that are controlled by one JSON file each in our sample program:
system_config.json
user_config.json
broadcast.port
and broadcast.passphrase
below under "User Configuration").broadcast.max_time_offset
below under "User Configuration").This configuration does not change while the process is running. It is used for static adaptation to different platforms. The system configuration of the sample program can be found in the system_config.json
file.
log_list_max
(integer, optional)
Max. number of entries in the status output ("Publication") of the distributor.
broadcast.interfaces
(array of strings, mandatory)
Lists the Ethernet interfaces on which usable broadcast addresses will be searched. The interfaces are searched in the given order. The first found IPv4 broadcast address will be used. This list basically sets the default values for the user configuration.
This configuration can be changed by the user while the process is running. In this case, you need to call the DistributorBroadcastCore::init()
function with the new configuration. If something goes wrong with the (re-) initialization (e.g., no IPv4 broadcast address can be found) the function will return the boolean false
value. The distributor is then inactive. The user configuration of the sample program is stored in the user_config.json
file.
broadcast.iface
(string, optional)
Name of the interface whose IPv4 broadcast address should be used.system_config.json
)broadcast.max_time_offset
(integer, optional)
Max. difference between package timestamps. If the difference between the timestamps and the local system time is too large, the packages are discarded.resend * 10 / poll_freq
broadcast.passphrase
(string, optional)
The AES key is generated from this phrase. If the option is not available or is an empty string, encryption will be turned off! You should only work without encryption for debugging purposes!meinsm
"broadcast.poll_freq
(integer, optional)
Number of sent/received packages per second.
The value 0
sets the polling frequency to 0.1 Hz. This value is only to be used for debugging purposes!100
4
broadcast.port
(integer, optional)
UDP port to be used.19800
broadcast.resend
(integer, optional)
Number of sending attempts of an MxMessage.16
3
Usually, the program will be started as follows:
./sdk-demo -s system_config.json -u user_config.json
-d 1
: Sets the debug level between 0..3
.-s system_config.json
: Specifies the system configuration JSON file.-u user_config.json
: Specifies the user configuration JSON file.-v
: Verbose mode; the sample program writes status information to the console.Once the program is running, the received MxMessages are displayed in the following form:
Messages can be sent from the program by first specifying the path of the message and then its value, for example.
Example:
The output shows the following:
Entering a question mark returns statistical information as follows:
put_publication =
Entering an exclamation mark terminates the program.
In the beginning, it is recommended to build a local test system. If this works without errors, a camera can be added. Next, MxBus modules can be connected.
You can simply run the sample program twice to test the MxMessageSystem on one computer.
./sdk-demo -s system_config.json -u user_config.json
Then simply send an MxMessage:
... and watch the output of the other program.
To build a test system with a MOBOTIX camera, you should read the "Technical Note: MxMessageSystem" under "https://www.mobotix.com/other/Support/MX-Media-Library/Compact-Guides". It describes how to configure the camera so it can receive and transmit MxMessages. The document also contains an introduction to the MxBus modules.