Update network API docs and add reboot state to menu docs

This commit is contained in:
mycognosist
2020-06-09 08:48:30 +01:00
parent 9b75ee40a4
commit 82565f82df
2 changed files with 45 additions and 33 deletions

View File

@ -43,22 +43,23 @@ _Note: This module is a work-in-progress._
### States
```bash
Home(0), // home menu
Home(1), // networking selected
Home(2), // system stats selected
Home(3), // display off selected
Home(4), // shutdown selected
Logo, // logo splash screen
Network, // network device view
Home(0), // home menu
Home(1), // networking selected
Home(2), // system stats selected
Home(3), // display off selected
Home(4), // shutdown selected
Logo, // logo splash screen
Network, // network device view
NetworkConf(0), // network configuration menu
NetworkConf(1), // client mode selected
NetworkConf(2), // access point mode selected
NetworkMode(0), // client mode activated
NetworkMode(1), // access point mode activated
OledPower(0), // oled display off
OledPower(1), // oled display on
Shutdown, // shutting down
Stats, // system statistics view
OledPower(0), // oled display off
OledPower(1), // oled display on
Reboot, // rebooting
Shutdown, // shutting down
Stats, // system statistics view
```
### Setup

View File

@ -12,32 +12,43 @@ _Note: This module is a work-in-progress._
### JSON-RPC API
Methods for **retrieving data**:
| Method | Parameters | Description |
| --- | --- | --- |
| `available_networks` | `iface` | List SSID, flags (security), frequency and signal level for all networks in range of given interface |
| `id` | `iface`, `ssid` | Return ID of given SSID |
| `ip` | `iface` | Return IP of given network interface |
| `ping` | | Respond with `success` if microservice is running |
| `rssi` | `iface` | Return average signal strength (dBm) for given interface |
| `rssi_percent` | `iface` | Return average signal strength (%) for given interface |
| `saved_networks` | | List all networks saved in wpasupplicant config |
| `ssid` | `iface` | Return SSID of currently-connected network for given interface |
| `state` | `iface` | Return state of given interface |
| `status` | `iface` | Return status parameters for given interface |
| `traffic` | `iface` | Return network traffic for given interface |
Methods for **modifying state**:
| Method | Parameters | Description |
| --- | --- | --- |
| `activate_ap` | | Activate WiFi access point (stop `wpa_supplicant` and start `hostapd` and `dnsmasq`) |
| `activate_client` | | Activate WiFi client connection (stop `hostapd` and `dnsmasq` and start `wpa_supplicant`) |
| `add_wifi` | `ssid`, `pass` | Add WiFi credentials to `wpa_supplicant.conf` |
| `disable_wifi` | `id`, `iface` | Disable connection with AP represented by given id |
| `disconnect_wifi` | `iface` | Disconnect given interface |
| `get_id` | `iface`, `ssid` | Return ID of given SSID |
| `get_ip` | `iface` | Return IP of given network interface |
| `get_rssi` | `iface` | Return average signal strength (dBm) for given interface |
| `get_rssi_percent` | `iface` | Return average signal strength (%) for given interface |
| `get_ssid` | `iface` | Return SSID of currently-connected network for given interface |
| `get_state` | `iface` | Return state of given interface |
| `get_status` | `iface` | Return status parameters for given interface |
| `get_traffic` | `iface` | Return network traffic for given interface |
| `if_checker` | | Run AP / client-mode configuration script |
| `list_networks` | | List all networks saved in wpasupplicant config |
| `new_password` | `id`, `iface`, `password` | Set a new password for given network id and interface |
| `ping` | | Respond with `success` if microservice is running |
| `reassociate_wifi` | `iface` | Reassociate with current AP for given interface |
| `reconfigure_wifi` | | Force wpa_supplicant to re-read its configuration file |
| `reconnect_wifi` | `iface` | Disconnect and reconnect given interface |
| `remove_wifi` | `id`, `iface` | Remove WiFi credentials for given network id and interface |
| `save_config` | | Save configuration changes to `wpa_supplicant.conf` |
| `scan_networks` | `iface` | List SSID, flags (security), frequency and signal level for all networks in range of given interface |
| `select_network` | `id`, `iface` | Disable other networks and attempt connection with AP represented by given id |
| `add` | `ssid`, `pass` | Add WiFi credentials to `wpa_supplicant.conf` |
| `check_iface` | | Run AP / client-mode configuration script |
| `connect` | `id`, `iface` | Disable other networks and attempt connection with AP represented by given id |
| `delete` | `id`, `iface` | Remove WiFi credentials for given network id and interface |
| `disable` | `id`, `iface` | Disable connection with AP represented by given id |
| `disconnect` | `iface` | Disconnect given interface |
| `modify` | `id`, `iface`, `password` | Set a new password for given network id and interface |
| `reassociate` | `iface` | Reassociate with current AP for given interface |
| `reconfigure` | | Force wpa_supplicant to re-read its configuration file |
| `reconnect` | `iface` | Disconnect and reconnect given interface |
| `save` | | Save configuration changes to `wpa_supplicant.conf` |
### API Documentation
API documentation can be built and served with `cargo doc --no-deps --open`. This set of documentation is intended for developers who wish to work on the project or better understand the API of the `src/network.rs` module.
### Directory Tree