Add Wifi AllowedComb API

This commit is contained in:
alphayax 2016-06-05 21:57:59 +02:00
parent d4349a2b4c
commit f0030c3b68
4 changed files with 94 additions and 2 deletions

View File

@ -79,6 +79,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
- Server
- WiFi
- Config (core)
- Access Points
## Utilisation

View File

@ -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);

View File

@ -0,0 +1,74 @@
<?php
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
use alphayax\freebox\api\v3\Model;
/**
* Class AllowedComb
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
*/
class AllowedComb extends Model {
/**
* @var string (Read-only) : the band for which the combination can be used
* @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band
*/
protected $band;
/** @var string (Read-only) : the channel_width for which the combination can be used */
protected $channel_width;
/** @var bool (Read-only) : does this combination requires DFS. You should only allow this combination if ap has allowed dfs. */
protected $need_dfs;
/** @var int (Read-only) : time required in dfs state before behing able to start the AP. */
protected $dfs_cac_time;
/** @var int (Read-only) : primary channel */
protected $primary;
/** @var int (Read-only) : secondary channel (zero means that secondary channel will not be used) */
protected $secondary;
/**
* @return string
*/
public function getBand() {
return $this->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;
}
}

View File

@ -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