diff --git a/README.md b/README.md index daa784a..bc2fb09 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,9 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées : - WiFi - Config (core) - Access Points + - AP (core) + - Allowed Comb + - Stations ## Utilisation diff --git a/exemple/config/WiFi.php b/exemple/config/WiFi.php index 27d596c..77bf1a3 100644 --- a/exemple/config/WiFi.php +++ b/exemple/config/WiFi.php @@ -16,8 +16,13 @@ print_r( $a); $WiFiAccessPointService = new \alphayax\freebox\api\v3\services\config\WiFi\AccessPoint( $App); $AccessPoints = $WiFiAccessPointService->getAll(); +/* print_r( $AccessPoints); $AllowedComb = $WiFiAccessPointService->getAllowedCombFromId( $AccessPoints[0]->getId()); print_r( $AllowedComb); +*/ + +$Stations = $WiFiAccessPointService->getStationsFromId( $AccessPoints[1]->getId()); +print_r( $Stations); diff --git a/freebox/api/v3/models/WiFi/APStation/Flags.php b/freebox/api/v3/models/WiFi/APStation/Flags.php new file mode 100644 index 0000000..d3ad71e --- /dev/null +++ b/freebox/api/v3/models/WiFi/APStation/Flags.php @@ -0,0 +1,51 @@ +legacy; + } + + /** + * @return boolean + */ + public function isHt() { + return $this->ht; + } + + /** + * @return boolean + */ + public function isVht() { + return $this->vht; + } + + /** + * @return boolean + */ + public function isAuthorized() { + return $this->authorized; + } + +} diff --git a/freebox/api/v3/models/WiFi/APStation/Station.php b/freebox/api/v3/models/WiFi/APStation/Station.php new file mode 100644 index 0000000..06c4f6c --- /dev/null +++ b/freebox/api/v3/models/WiFi/APStation/Station.php @@ -0,0 +1,187 @@ +initProperty( 'host' , LanHost::class); + $this->initProperty( 'flags' , Flags::class); + $this->initProperty( 'last_rx', Stats::class); + $this->initProperty( 'last_tx', Stats::class); + } + + /** + * @return string + */ + public function getId() { + return $this->id; + } + + /** + * @return string + */ + public function getMac() { + return $this->mac; + } + + /** + * @return string + */ + public function getBssid() { + return $this->bssid; + } + + /** + * @return string + */ + public function getHostname() { + return $this->hostname; + } + + /** + * @return \alphayax\freebox\api\v3\models\LAN\LanHost + */ + public function getHost() { + return $this->host; + } + + /** + * @return string + */ + public function getState() { + return $this->state; + } + + /** + * @return int + */ + public function getInactive() { + return $this->inactive; + } + + /** + * @return int + */ + public function getConnDuration() { + return $this->conn_duration; + } + + /** + * @return int + */ + public function getRxBytes() { + return $this->rx_bytes; + } + + /** + * @return int + */ + public function getTxBytes() { + return $this->tx_bytes; + } + + /** + * @return int + */ + public function getTxRate() { + return $this->tx_rate; + } + + /** + * @return int + */ + public function getRxRate() { + return $this->rx_rate; + } + + /** + * @return int + */ + public function getSignal() { + return $this->signal; + } + + /** + * @return Flags + */ + public function getFlags() { + return $this->flags; + } + + /** + * @return Stats + */ + public function getLastRx() { + return $this->last_rx; + } + + /** + * @return Stats + */ + public function getLastTx() { + return $this->last_tx; + } + +} diff --git a/freebox/api/v3/models/WiFi/APStation/Stats.php b/freebox/api/v3/models/WiFi/APStation/Stats.php new file mode 100644 index 0000000..458609f --- /dev/null +++ b/freebox/api/v3/models/WiFi/APStation/Stats.php @@ -0,0 +1,60 @@ +bitrate; + } + + /** + * @return int + */ + public function getMcs() { + return $this->mcs; + } + + /** + * @return int + */ + public function getVhtMcs() { + return $this->vht_mcs; + } + + /** + * @return string + */ + public function getWidth() { + return $this->width; + } + + /** + * @return boolean + */ + public function isShortgi() { + return $this->shortgi; + } + +} diff --git a/freebox/api/v3/services/config/WiFi/AccessPoint.php b/freebox/api/v3/services/config/WiFi/AccessPoint.php index ab44f00..5af0f64 100644 --- a/freebox/api/v3/services/config/WiFi/AccessPoint.php +++ b/freebox/api/v3/services/config/WiFi/AccessPoint.php @@ -11,6 +11,7 @@ class AccessPoint extends Service { const API_WIFI_AP = '/api/v3/wifi/ap/'; const API_WIFI_AP_ALLOWED_COMB = '/api/v3/wifi/ap/%u/allowed_channel_comb'; + const API_WIFI_AP_STATIONS = '/api/v3/wifi/ap/%u/stations/'; /** * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[] @@ -46,6 +47,19 @@ class AccessPoint extends Service { return $rest->getResultAsArray( models\WiFi\AccessPoint\AllowedComb::class); } + /** + * To be able to allow user to pick a valid channel combination for a given AP you should use the following api to retrieve the list of allowed channel combination. + * @param int $accessPointId + * @return models\WiFi\AccessPoint\AllowedComb[] + */ + public function getStationsFromId( $accessPointId) { + $service = sprintf( self::API_WIFI_AP_STATIONS, $accessPointId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + return $rest->getResultAsArray( models\WiFi\APStation\Station::class); + } + /** * @param $accessPoint * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP diff --git a/freebox/api/v3/symbols/WiFi/Station/State.php b/freebox/api/v3/symbols/WiFi/Station/State.php new file mode 100644 index 0000000..dc8a433 --- /dev/null +++ b/freebox/api/v3/symbols/WiFi/Station/State.php @@ -0,0 +1,16 @@ +