From 75c18287c9fe7efca5e77950a19956db0000b2d8 Mon Sep 17 00:00:00 2001 From: alphayax Date: Wed, 8 Jun 2016 13:22:48 +0200 Subject: [PATCH] Add WiFi Channel Usage API --- README.md | 1 + exemple/config/WiFi.php | 4 +- .../api/v3/models/WiFi/Radar/ChannelUsage.php | 55 +++++++++++++++++++ .../v3/services/config/WiFi/AccessPoint.php | 14 +++++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 freebox/api/v3/models/WiFi/Radar/ChannelUsage.php diff --git a/README.md b/README.md index b99482d..9b1bb51 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées : - Allowed Comb - Stations - Radar + - Channel Usage - BSS diff --git a/exemple/config/WiFi.php b/exemple/config/WiFi.php index 216675d..2e196c6 100644 --- a/exemple/config/WiFi.php +++ b/exemple/config/WiFi.php @@ -25,11 +25,13 @@ print_r( $AllowedComb); $Stations = $WiFiAccessPointService->getStationsFromId( $AccessPoints[1]->getId()); print_r( $Stations); -*/ $Neighbors = $WiFiAccessPointService->getNeighborsFromId( $AccessPoints[1]->getId()); print_r( $Neighbors); +*/ +$ChannelUsages = $WiFiAccessPointService->getChannelUsageFromId( $AccessPoints[1]->getId()); +print_r( $ChannelUsages); /* $WiFiBssService = new \alphayax\freebox\api\v3\services\config\WiFi\Bss( $App); diff --git a/freebox/api/v3/models/WiFi/Radar/ChannelUsage.php b/freebox/api/v3/models/WiFi/Radar/ChannelUsage.php new file mode 100644 index 0000000..b935853 --- /dev/null +++ b/freebox/api/v3/models/WiFi/Radar/ChannelUsage.php @@ -0,0 +1,55 @@ +channel; + } + + /** + * @return string + * @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band + */ + public function getBand() { + return $this->band; + } + + /** + * @return int + */ + public function getNoiseLevel() { + return $this->noise_level; + } + + /** + * @return int + */ + public function getRxBusyPercent() { + return $this->rx_busy_percent; + } + +} diff --git a/freebox/api/v3/services/config/WiFi/AccessPoint.php b/freebox/api/v3/services/config/WiFi/AccessPoint.php index e540a5b..b1d7f59 100644 --- a/freebox/api/v3/services/config/WiFi/AccessPoint.php +++ b/freebox/api/v3/services/config/WiFi/AccessPoint.php @@ -13,6 +13,7 @@ class AccessPoint extends Service { 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/'; const API_WIFI_AP_NEIGHBORS = '/api/v3/wifi/ap/%u/neighbors/'; + const API_WIFI_AP_CHANNEL_USAGE = '/api/v3/wifi/ap/%u/channel_usage/'; /** * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[] @@ -85,4 +86,17 @@ class AccessPoint extends Service { return $rest->getResultAsArray( models\WiFi\Radar\Neighbor::class); } + /** + * @param int $accessPointId + * @return models\WiFi\Radar\Neighbor[] + */ + public function getChannelUsageFromId( $accessPointId) { + $service = sprintf( self::API_WIFI_AP_CHANNEL_USAGE, $accessPointId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + return $rest->getResultAsArray( models\WiFi\Radar\ChannelUsage::class); + } + + }