diff --git a/README.md b/README.md index bc0f4a0..daa784a 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées : - Server - WiFi - Config (core) + - Access Points ## Utilisation diff --git a/exemple/config/WiFi.php b/exemple/config/WiFi.php index d954a8b..27d596c 100644 --- a/exemple/config/WiFi.php +++ b/exemple/config/WiFi.php @@ -18,3 +18,6 @@ $WiFiAccessPointService = new \alphayax\freebox\api\v3\services\config\WiFi\Acce $AccessPoints = $WiFiAccessPointService->getAll(); print_r( $AccessPoints); +$AllowedComb = $WiFiAccessPointService->getAllowedCombFromId( $AccessPoints[0]->getId()); +print_r( $AllowedComb); + diff --git a/freebox/api/v3/models/WiFi/AccessPoint/AllowedComb.php b/freebox/api/v3/models/WiFi/AccessPoint/AllowedComb.php new file mode 100644 index 0000000..734a4b8 --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/AllowedComb.php @@ -0,0 +1,74 @@ +band; + } + + /** + * @return string + */ + public function getChannelWidth() { + return $this->channel_width; + } + + /** + * @return boolean + */ + public function isNeedDfs() { + return $this->need_dfs; + } + + /** + * @return int + */ + public function getDfsCacTime() { + return $this->dfs_cac_time; + } + + /** + * @return int + */ + public function getPrimary() { + return $this->primary; + } + + /** + * @return int + */ + public function getSecondary() { + return $this->secondary; + } + +} diff --git a/freebox/api/v3/services/config/WiFi/AccessPoint.php b/freebox/api/v3/services/config/WiFi/AccessPoint.php index 48e6827..ab44f00 100644 --- a/freebox/api/v3/services/config/WiFi/AccessPoint.php +++ b/freebox/api/v3/services/config/WiFi/AccessPoint.php @@ -9,7 +9,8 @@ use alphayax\freebox\api\v3\Service; */ class AccessPoint extends Service { - const API_WIFI_AP = '/api/v3/wifi/ap/'; + const API_WIFI_AP = '/api/v3/wifi/ap/'; + const API_WIFI_AP_ALLOWED_COMB = '/api/v3/wifi/ap/%u/allowed_channel_comb'; /** * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[] @@ -22,7 +23,7 @@ class AccessPoint extends Service { } /** - * @param $accessPointId + * @param int $accessPointId * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP */ public function getFromId( $accessPointId){ @@ -32,6 +33,19 @@ class AccessPoint extends Service { return $rest->getResult( models\WiFi\AccessPoint\AP::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 getAllowedCombFromId( $accessPointId) { + $service = sprintf( self::API_WIFI_AP_ALLOWED_COMB, $accessPointId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + return $rest->getResultAsArray( models\WiFi\AccessPoint\AllowedComb::class); + } + /** * @param $accessPoint * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP