Skip to content

NetworkManager dbus-java integration

License

Notifications You must be signed in to change notification settings

mattdibi/NMTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test app for NetworkManager dbus-java integration

Requirements

Prerequisites

Before installing Kura, you need to have the following programs installed in your system

  • JDK 1.8
  • Maven 3.5.x

Installing Prerequisites in Mac OS

To install Java 8, download the JDK tar archive from the Adoptium Project Repository.

Once downloaded, copy the tar archive in /Library/Java/JavaVirtualMachines/ and cd into it. Unpack the archive with the following command:

sudo tar -xzf <archive-name>.tar.gz

The tar archive can be deleted afterwards.

Depending on which terminal you are using, edit the profiles (.zshrc, .profile, .bash_profile) to contain:

# Adoptium JDK 8
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/<archive-name>/Contents/Home
alias java8='export JAVA_HOME=$JAVA_8_HOME'
java8 

Reload the terminal and run java -version to make sure it is installed correctly.

Using Brew you can easily install Maven from the command line:

brew install [email protected]

Run mvn -version to ensure that Maven has been added to the PATH. If Maven cannot be found, try running brew link [email protected] --force or manually add it to your path with:

export PATH="/usr/local/opt/[email protected]/bin:$PATH"

Installing Prerequisites in Linux

For Java

sudo apt install openjdk-8-jdk

For Maven you can follow the tutorial from the official Maven site. Remember that you need to install the 3.5.x version.

Building

mvn clean package

Running

Note: Administration privileges might be required to apply changes on the network configuration. If so, run the following code from the root user.

mvn exec:java -Dexec.mainClass="org.eclipse.kura.NMTest.App"

For testing I’m currently running this code on a Raspberry Pi 4 with Raspberry Pi OS 32 bit using NetworkManager.

Note: The latest release of Raspberry Pi OS now offers Network Manager as an option.

To switch to NetworkManager, just open a terminal window and type:

sudo raspi-config

This launches the configuration tool. Go into option 6, Advanced Options, and then into option AA, Network Config – choose option 2, NetworkManager, and then reboot when prompted.


Code generation

Note: For this generation dbus-java version 4.2.1 was used.

Follow: https://hypfvieh.github.io/dbus-java/code-generation.html

Introspection XML for NetworkManager can be found here

Command used for NetworkManager class:

mvn exec:java \
    -Dexec.mainClass="org.freedesktop.dbus.utils.generator.InterfaceCodeGenerator" \
    -Dexec.executable="java" \
    -Dexec.args="org.freedesktop.NetworkManager --inputFile /path/to/introspection/org.freedesktop.NetworkManager.xml --outputDir /tmp/classes ' '"

For generating the code of the entire directory all at once, the following script was used.

for file in /path/to/introspection/*.xml
do
        basefilename=$(basename ${file})
        filename="${basefilename%.*}"
        mvn exec:java \
                -Dexec.mainClass="org.freedesktop.dbus.utils.generator.InterfaceCodeGenerator" \
                -Dexec.executable="java" \
                -Dexec.args="${filename} --inputFile ${file} --outputDir /tmp/classes ' '"
done

About

NetworkManager dbus-java integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages