From 441fb84ecde637123650006096c468ae8e07de94 Mon Sep 17 00:00:00 2001 From: alphayax Date: Sun, 5 Jun 2016 21:46:41 +0200 Subject: [PATCH] Add Wifi AccessPoint API --- exemple/config/WiFi.php | 9 +- freebox/api/v3/models/WiFi/AccessPoint/AP.php | 79 +++++++++++ .../WiFi/AccessPoint/APCapabilities.php | 51 +++++++ .../v3/models/WiFi/AccessPoint/APConfig.php | 125 ++++++++++++++++++ .../v3/models/WiFi/AccessPoint/APHtConfig.php | 45 +++++++ .../v3/models/WiFi/AccessPoint/APStatus.php | 65 +++++++++ .../v3/services/config/WiFi/AccessPoint.php | 46 +++++++ freebox/api/v3/symbols/WiFi/APConfig/Band.php | 19 +++ .../api/v3/symbols/WiFi/APStatus/State.php | 46 +++++++ 9 files changed, 484 insertions(+), 1 deletion(-) create mode 100644 freebox/api/v3/models/WiFi/AccessPoint/AP.php create mode 100644 freebox/api/v3/models/WiFi/AccessPoint/APCapabilities.php create mode 100644 freebox/api/v3/models/WiFi/AccessPoint/APConfig.php create mode 100644 freebox/api/v3/models/WiFi/AccessPoint/APHtConfig.php create mode 100644 freebox/api/v3/models/WiFi/AccessPoint/APStatus.php create mode 100644 freebox/api/v3/services/config/WiFi/AccessPoint.php create mode 100644 freebox/api/v3/symbols/WiFi/APConfig/Band.php create mode 100644 freebox/api/v3/symbols/WiFi/APStatus/State.php diff --git a/exemple/config/WiFi.php b/exemple/config/WiFi.php index 1c96d31..d954a8b 100644 --- a/exemple/config/WiFi.php +++ b/exemple/config/WiFi.php @@ -8,6 +8,13 @@ $App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.config', ' $App->authorize(); $App->openSession(); +/* $WiFiConfigService = new \alphayax\freebox\api\v3\services\config\WiFi\Config( $App); $a = $WiFiConfigService->getConfiguration(); -print_r( $a); \ No newline at end of file +print_r( $a); +*/ + +$WiFiAccessPointService = new \alphayax\freebox\api\v3\services\config\WiFi\AccessPoint( $App); +$AccessPoints = $WiFiAccessPointService->getAll(); +print_r( $AccessPoints); + diff --git a/freebox/api/v3/models/WiFi/AccessPoint/AP.php b/freebox/api/v3/models/WiFi/AccessPoint/AP.php new file mode 100644 index 0000000..5a12f77 --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/AP.php @@ -0,0 +1,79 @@ +initProperty( 'status' , APStatus::class); + $this->initProperty( 'capabilities' , APCapabilities::class); + $this->initProperty( 'config' , APConfig::class); + } + + /** + * @return int + */ + public function getId() { + return $this->id; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\APStatus + */ + public function getStatus() { + return $this->status; + } + + /** + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\ApCapabilities + */ + public function getCapabilites() { + return $this->capabilites; + } + + /** + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\APConfig + */ + public function getConfig() { + return $this->config; + } + + /** + * @param \alphayax\freebox\api\v3\models\WiFi\AccessPoint\APConfig $config + */ + public function setConfig( $config) { + $this->config = $config; + } + +} diff --git a/freebox/api/v3/models/WiFi/AccessPoint/APCapabilities.php b/freebox/api/v3/models/WiFi/AccessPoint/APCapabilities.php new file mode 100644 index 0000000..5cd8c71 --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/APCapabilities.php @@ -0,0 +1,51 @@ +_2d4g = @$properties_x['2d4g']; + $this->_5g = @$properties_x['5g']; + $this->_60g = @$properties_x['60g']; + } + + /** + * @return int + */ + public function get2d4g() { + return $this->_2d4g; + } + + /** + * @return int + */ + public function get5g() { + return $this->_5g; + } + + /** + * @return int + */ + public function get60g() { + return $this->_60g; + } + +} diff --git a/freebox/api/v3/models/WiFi/AccessPoint/APConfig.php b/freebox/api/v3/models/WiFi/AccessPoint/APConfig.php new file mode 100644 index 0000000..33e5666 --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/APConfig.php @@ -0,0 +1,125 @@ +initProperty( 'ht', APHtConfig::class); + } + + /** + * @return string + */ + public function getBand() { + return $this->band; + } + + /** + * @param string $band + */ + public function setBand($band) { + $this->band = $band; + } + + /** + * @return int + */ + public function getChannelWidth() { + return $this->channel_width; + } + + /** + * @param int $channel_width + */ + public function setChannelWidth($channel_width) { + $this->channel_width = $channel_width; + } + + /** + * @return int + */ + public function getPrimaryChannel() { + return $this->primary_channel; + } + + /** + * @param int $primary_channel + */ + public function setPrimaryChannel($primary_channel) { + $this->primary_channel = $primary_channel; + } + + /** + * @return int + */ + public function getSecondaryChannel() { + return $this->secondary_channel; + } + + /** + * @param int $secondary_channel + */ + public function setSecondaryChannel($secondary_channel) { + $this->secondary_channel = $secondary_channel; + } + + /** + * @return boolean + */ + public function isDfsEnabled() { + return $this->dfs_enabled; + } + + /** + * @param boolean $dfs_enabled + */ + public function setDfsEnabled($dfs_enabled) { + $this->dfs_enabled = $dfs_enabled; + } + + /** + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\APHtConfig + */ + public function getHt() { + return $this->ht; + } + + /** + * @param \alphayax\freebox\api\v3\models\WiFi\AccessPoint\APHtConfig $ht + */ + public function setHt($ht) { + $this->ht = $ht; + } + +} diff --git a/freebox/api/v3/models/WiFi/AccessPoint/APHtConfig.php b/freebox/api/v3/models/WiFi/AccessPoint/APHtConfig.php new file mode 100644 index 0000000..0bf1b93 --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/APHtConfig.php @@ -0,0 +1,45 @@ +ac_enabled; + } + + /** + * @param boolean $ac_enabled + */ + public function setAcEnabled($ac_enabled) { + $this->ac_enabled = $ac_enabled; + } + + /** + * @return boolean + */ + public function isHtEnabled() { + return $this->ht_enabled; + } + + /** + * @param boolean $ht_enabled + */ + public function setHtEnabled($ht_enabled) { + $this->ht_enabled = $ht_enabled; + } + +} diff --git a/freebox/api/v3/models/WiFi/AccessPoint/APStatus.php b/freebox/api/v3/models/WiFi/AccessPoint/APStatus.php new file mode 100644 index 0000000..bdc0ace --- /dev/null +++ b/freebox/api/v3/models/WiFi/AccessPoint/APStatus.php @@ -0,0 +1,65 @@ +state; + } + + /** + * @return int + */ + public function getChannelWidth() { + return $this->channel_width; + } + + /** + * @return int + */ + public function getPrimaryChannel() { + return $this->primary_channel; + } + + /** + * @return int + */ + public function getSecondaryChannel() { + return $this->secondary_channel; + } + + /** + * @return int + */ + public function getDfsCacRemainingTime() { + return $this->dfs_cac_remaining_time; + } + +} diff --git a/freebox/api/v3/services/config/WiFi/AccessPoint.php b/freebox/api/v3/services/config/WiFi/AccessPoint.php new file mode 100644 index 0000000..48e6827 --- /dev/null +++ b/freebox/api/v3/services/config/WiFi/AccessPoint.php @@ -0,0 +1,46 @@ +getAuthService( self::API_WIFI_AP); + $rest->GET(); + + return $rest->getResultAsArray( models\WiFi\AccessPoint\AP::class); + } + + /** + * @param $accessPointId + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP + */ + public function getFromId( $accessPointId){ + $rest = $this->getAuthService( self::API_WIFI_AP . $accessPointId); + $rest->GET(); + + return $rest->getResult( models\WiFi\AccessPoint\AP::class); + } + + /** + * @param $accessPoint + * @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP + */ + public function update( models\WiFi\AccessPoint\AP $accessPoint){ + $rest = $this->getAuthService( self::API_WIFI_AP . $accessPoint->getId()); + $rest->PUT( $accessPoint); + + return $rest->getResult( models\WiFi\AccessPoint\AP::class); + } + +} diff --git a/freebox/api/v3/symbols/WiFi/APConfig/Band.php b/freebox/api/v3/symbols/WiFi/APConfig/Band.php new file mode 100644 index 0000000..892d9a3 --- /dev/null +++ b/freebox/api/v3/symbols/WiFi/APConfig/Band.php @@ -0,0 +1,19 @@ +