Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add functions to accesspoint.vala #13

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

AhmedSaadi0
Copy link

@AhmedSaadi0 AhmedSaadi0 commented Sep 18, 2024

Try adding to accesspoint.vala

  • connect_to_ap(string? password = null)
  • forget_ap(string uuid)
{
  "saved": true,
  "uuid": "682fb234-4373-41cb-9dc6-df813a30hwl0",
  "hidden": false,
  "requiresPassword": true
}

@AhmedSaadi0
Copy link
Author

  • Add disconnect_from_ap()

@Aylur
Copy link
Owner

Aylur commented Sep 21, 2024

Thanks for the PR!
I still really don't understand much about network manager, whats a uuid used for and why does the forget_ap method requires it as a parameter?

@AhmedSaadi0
Copy link
Author

The UUID (Universally Unique Identifier) is used to uniquely identify a connection profile in NetworkManager's system, differentiating it from all other network profiles, regardless of network type (Wi-Fi, Ethernet, VPN, etc.).

The forget_ap method requires the UUID to ensure it correctly targets and removes the specific Wi-Fi network profile, even if there are multiple networks with the same SSID or other similar properties.

@Aylur
Copy link
Owner

Aylur commented Sep 23, 2024

But each access point has only one UUID as I understand, so why does the forget_ap method requires it as a paramater? shouldnt it use the instance's uuid?

@AhmedSaadi0
Copy link
Author

You're right, the current implementation only supports one connection profile per access point. However, each profile corresponds to a unique network configuration, and NetworkManager allows you to create and store multiple profiles for the same Wi-Fi access point (or network). Which means, we need to create a connection_profile.vala file to manage the profiles associated with each access point, and move forget_ap() into it.

Right now I just used the instance's uuid until I get some extra time to create connection_profile.vala.

@AhmedSaadi0
Copy link
Author

accesspoint.vala

  • public List<weak ConnectionProfile> profiles
  • public ConnectionProfile? active_profile
  • public async void deactivate_connection()
public async void create_new_connection(
        string? password = null,
        string? ssid = this.ssid,
        string? bssid = this.bssid,
        string mode = "infrastructure",
        string? band = null,
        uint channel = 0,
        string? mac_address = null,
        bool powersave = true,
        string security_type = "wpa-psk",
        string auth_alg = "open",
        string ip4_method = "auto",
        string[]? ip4_dns = null,
        string ip6_method = "auto",
        bool autoconnect = false,
        bool read_only = false
    )

accesspoint_profile.vala

  • password
  • uuid
  • is_active
  • activate_connection()
  • deactivate_connection()
  • delete_profile()

TODO: update_profile(args...)

@AhmedSaadi0
Copy link
Author

I think everything is ready now

accesspoint.vala

  • hidden
  • requires_password
  • active_profile
  • create_full_connection(...full_profile_args)
  • create_new_connection(string? password = null)
  • deactivate_connection()

accesspoint_profile.vala

  • uuid
  • is_active
  • id
  • autoconnect_priority
  • autoconnect
  • visible
  • ip4_method
  • ip6_method
  • mode
  • channel
  • mac_address
  • powersave
  • get_psk()
  • get_key()
  • auth_algo()
  • get_dns()
  • activate_connection()
  • deactivate_connection()
  • delete_profile()
  • update_profile(...full_args)

@gitmeED331
Copy link

Will be awesome to have these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants