We are implementing something similar to WiFi-Connect but using .NET and in a multi-container application. I’ve been able to send a few DBus queries using Tmds.DBus.
Unfortunately when I try to send an “AddAndActivateConnection” (similar to what WiFi-Connect does) I get the following error:
org.freedesktop.NetworkManager.Device.InvalidConnection:
A 'wireless' setting is required if no AP path was given.
Am I missing something in the request or is there any prerequisite I haven’t figured out yet?
I know, this is probably not directly related to Balena, but I was hoping you could help as all of the Rust code related to WiFi-Connect seems to come from you.
My call to AddAndActivateConnection looks as follows:
var wireless = new Dictionary<string, object>();
wireless["ssid"] = Encoding.ASCII.GetBytes(ssid);
wireless["band"] = "bg";
wireless["hidden"] = false;
wireless["mode"] = "ap";
var connection = new Dictionary<string, object>();
connection["autoconnect"] = false;
connection["id"] = ssid;
connection["interface-name"] = "wlan0";
connection["type"] = "802-11-wireless";
var addressData = new Dictionary<string, object>();
addressData["address"] = "192.168.111.1";
addressData["prefix"] = 24u;
var ipv4 = new Dictionary<string, object>();
ipv4["method"] = "manual";
ipv4["address-data"] = addressData;
var settings = new Dictionary<string, IDictionary<string, object>>();
settings["802-11-wireless"] = wireless;
settings["connection"] = connection;
settings["ipv4"] = ipv4;
await this.networkManager.AddAndActivateConnectionAsync(settings, device.ObjectPath, "/");