Add Wifi MacFilter API

Finalize Wifi API
This commit is contained in:
alphayax 2016-06-08 19:53:41 +02:00
parent 93bb59165d
commit 705099d77a
5 changed files with 198 additions and 2 deletions

View File

@ -89,6 +89,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
- Channel Usage
- BSS
- Planning
- Mac Filter
## Utilisation

View File

@ -18,7 +18,7 @@
- ~~Calls / Contacts~~
- ~~Call~~
- ~~Contacts~~
- Configuration
- ~~Configuration~~
- ~~Connection API~~
- ~~Lan~~
- ~~Lan Browser~~
@ -33,7 +33,7 @@
- ~~Network Share~~
- ~~UPnP AV~~
- ~~Switch~~
- Wi-Fi
- ~~Wi-Fi~~
- ~~System~~
- ~~VPN Server [UNSTABLE]~~
- ~~VPN Client [UNSTABLE]~~

View File

@ -0,0 +1,100 @@
<?php
namespace alphayax\freebox\api\v3\models\WiFi;
use alphayax\freebox\api\v3\Model;
use alphayax\freebox\api\v3\models;
/**
* Class MacFilter
* @package alphayax\freebox\api\v3\models\WiFi
*/
class MacFilter extends Model {
/** @var string (Read-only) : filter id */
protected $id;
/** @var string (Read-only) : MAC address to filter */
protected $mac;
/** @var string : comment */
protected $comment;
/**
* @var string
* @see alphayax\freebox\api\v3\symbols\WiFi\MacFilter\Type
*/
protected $type;
/** @var string (Read-only) : host name when available */
protected $hostname;
/** @var models\LAN\LanHost : host information when available */
protected $host;
/**
* FreeplugNetwork constructor.
* @param array $properties_x
*/
public function __construct( array $properties_x){
parent::__construct( $properties_x);
$this->initProperty( 'host', models\LAN\LanHost::class);
}
/**
* @return string
*/
public function getId() {
return $this->id;
}
/**
* @return string
*/
public function getMac() {
return $this->mac;
}
/**
* @return string
*/
public function getComment() {
return $this->comment;
}
/**
* @param string $comment
*/
public function setComment($comment) {
$this->comment = $comment;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\WiFi\MacFilter\Type
*/
public function getType() {
return $this->type;
}
/**
* @param string $type
* @see alphayax\freebox\api\v3\symbols\WiFi\MacFilter\Type
*/
public function setType($type) {
$this->type = $type;
}
/**
* @return string
*/
public function getHostname() {
return $this->hostname;
}
/**
* @return models\LAN\LanHost
*/
public function getHost() {
return $this->host;
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace alphayax\freebox\api\v3\services\config\WiFi;
use alphayax\freebox\api\v3\Service;
use alphayax\freebox\api\v3\models;
/**
* Class MacFilter
* @package alphayax\freebox\api\v3\services\config\WiFi
*/
class MacFilter extends Service {
const API_WIFI_MAC_FILTER = '/api/v3/wifi/mac_filter/';
/**
* @return models\WiFi\MacFilter[]
*/
public function getAll(){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER);
$rest->GET();
return $rest->getResultAsArray( models\WiFi\MacFilter::class);
}
/**
* @param $MacFilterId
* @return models\WiFi\MacFilter
*/
public function getFromId( $MacFilterId){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->GET();
return $rest->getResult( models\WiFi\MacFilter::class);
}
/**
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
*/
public function update( models\WiFi\MacFilter $MacFilter){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilter->getId());
$rest->PUT( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
/**
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
*/
public function delete( models\WiFi\MacFilter $MacFilter){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilter->getId());
$rest->PUT( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
/**
* @param $MacFilterId
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
*/
public function deleteFromId( $MacFilterId){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilterId);
$rest->DELETE();
return $rest->getSuccess();
}
/**
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
*/
public function add( models\WiFi\MacFilter $MacFilter){
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER);
$rest->POST( $MacFilter);
return $rest->getResult( models\WiFi\MacFilter::class);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace alphayax\freebox\api\v3\symbols\WiFi\MacFilter;
/**
* Symbol Type
* @package alphayax\freebox\api\v3\symbols\WiFi\MacFilter
* @see alphayax\freebox\api\v3\models\WiFi\MacFilter
*/
interface Type {
/** if mac_filter is set to whitelist this station will be allowed */
const WHITELIST = 'whitelist';
/** if mac_filter is set to blacklist this station will be rejected */
const BLACKLIST = 'blacklist';
}