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

Add more functionalities to network service #566

Closed
wants to merge 16 commits into from

Conversation

AhmedSaadi0
Copy link
Contributor

@AhmedSaadi0 AhmedSaadi0 commented Sep 13, 2024

  • Add connectToAP(ssid: string, password?: string) that connects to access point
  • Add extra fields to access-points
{
  "saved": true,
  "uuid": "682fb234-4373-41cb-9dc6-df813a30hwl0",
  "hidden": false,
  "requiresPassword": true
}

full fileds

{
  "bssid": "00:00:00:00:00:00",
  "address": "00:00:00:00:00:00",
  "lastSeen": 109321,
  "ssid": "SSID",
  "active": true,
  "strength": 75,
  "frequency": 2427,
  "iconName": "network-wireless-signal-good-symbolic",
  "saved": true,
  "uuid": "682fb234-4373-41cb-9dc6-df813a30hwl0",
  "hidden": false,
  "requiresPassword": true
}

usage

network.wifi.connectToAP(ssid, password);

@AhmedSaadi0
Copy link
Contributor Author

Edit : Throws error when connection fail

try {
       network.wifi.connectToAP(ssid, password);
} catch (error) {
       console.error('Connection error:', error.message);
}

@AhmedSaadi0
Copy link
Contributor Author

  • add forgetAP(uuid: string)

@AhmedSaadi0
Copy link
Contributor Author

network.wifi
    .connectToAP(ssid, password)
    .then((val) => {
        console.log(val); // resolve(activeConnection.state); -> NM.ActiveConnectionState.ACTIVATED)
    })
    .catch((val) => {
        console.log('Failed');
        console.log(val);
    });
// ---
network.wifi
    .forgetAP(uuid)
    .then((val) => {
        console.log(val); // resolve(result);
    })
    .catch((val) => {
        console.log(val);
    });

@Aylur Aylur mentioned this pull request Sep 25, 2024
Merged
@Aylur Aylur closed this Nov 13, 2024
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.

2 participants