canonical / nm.dart

Native Dart client library to access NetworkManager on Linux.
https://pub.dev/packages/nm
Mozilla Public License 2.0
29 stars 11 forks source link

Unable to connect to password protected access point #67

Closed alexrabin closed 2 years ago

alexrabin commented 2 years ago

I have been looking everywhere on how I can connect to a wifi network but I can't find anything.

The connection parameter is of type Map<String, Map<String, DBusValue>> but I can't access the DbusValue from the library. Even if I got the DBusValue I wouldn't know how to supply a password.

client.addAndActivateConnection(
          device: _device, accessPoint: accessPoint);

I think this library needs more examples for beginners to NetworkManager

alexrabin commented 2 years ago

I had to add the dbus package and connect to a wifi network with a password like this:

await _manager.addAndActivateConnection(
              device: _device,
              accessPoint: accessPoint,
              connection: {
                "802-11-wireless-security": {
                  "key-mgmt": DBusString('wpa-psk'),
                  "psk": DBusString('password-value-here')
                }
              });

Used this link as a reference https://stackoverflow.com/a/15022137/6127000