Set up WiFi connection using Netplan over DBus


I am creating an IoT application for Ubuntu Core 20 that will run on the Raspberry Pi 3B or later. Part of the functionality of the application is that it will allow the user to connect the device to WiFi by scanning a QR code. The QR code will contain the SSID and authentication details.

Once the application has received the WiFi details from a scanned QR code, I would like to use the Netplan DBus interface in order to set up the WiFi connection. The Netplan file can be directly modified, but in order to call netplan apply, it is necessary to use the DBus interface.

I have read the documentation for the dbus interface, and it says that in order for a snap to communicate over DBus, the snap you are communicating with needs to define a slot for a specific DBus interface, e.g. io.netplan.Netplan.

So my question is which slot should my snap be connected to in order to allow it to communicate with Netplan over DBus?

If I am barking up the wrong tree here, and there is an easier way to set up a WiFi connection, please let me know. Bear in mind, the user will not have a keyboard or monitor connected to the device, and therefore, we cannot use terminal commands to set up the connection. It must be done by the application on receiving a QR code.

Many thanks


you do not need to define any dbus slots anywhere, just using the network-setup-control interface plug will give you access to send to io.netplan.Netplan …