Add Wifi AccessPoint API
This commit is contained in:
parent
be71cccfa2
commit
441fb84ecd
|
@ -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);
|
||||
print_r( $a);
|
||||
*/
|
||||
|
||||
$WiFiAccessPointService = new \alphayax\freebox\api\v3\services\config\WiFi\AccessPoint( $App);
|
||||
$AccessPoints = $WiFiAccessPointService->getAll();
|
||||
print_r( $AccessPoints);
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class AP
|
||||
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
|
||||
*/
|
||||
class AP extends Model {
|
||||
|
||||
/** @var int (Read-only) : wifi ap id */
|
||||
protected $id;
|
||||
|
||||
/** @var string (Read-only) : wifi ap name */
|
||||
protected $name;
|
||||
|
||||
/** @var APStatus (Read-only) : ap status */
|
||||
protected $status;
|
||||
|
||||
/** @var APCapabilities (Read-only) : ap capabilities */
|
||||
protected $capabilities;
|
||||
|
||||
/** @var APConfig : ap configuration */
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* AP constructor.
|
||||
* @param array $properties_x
|
||||
*/
|
||||
public function __construct( array $properties_x){
|
||||
parent::__construct( $properties_x);
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class ApCapabilities
|
||||
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
|
||||
*/
|
||||
class APCapabilities extends Model {
|
||||
|
||||
/** @var int (Read-only) : array map of capabilities in 2.4 GHz band */
|
||||
protected $_2d4g;
|
||||
|
||||
/** @var int (Read-only) : array map of capabilities in 5 GHz band */
|
||||
protected $_5g;
|
||||
|
||||
/** @var int (Read-only) : array map of capabilities in 60 GHz band */
|
||||
protected $_60g;
|
||||
|
||||
/**
|
||||
* APCapabilities constructor.
|
||||
* @param array $properties_x
|
||||
*/
|
||||
public function __construct( $properties_x = []){
|
||||
$this->_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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class APConfig
|
||||
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
|
||||
*/
|
||||
class APConfig extends Model {
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band
|
||||
*/
|
||||
protected $band;
|
||||
|
||||
/** @var int : wanted channel width (in MHz) (20, 40, 80, 160) */
|
||||
protected $channel_width;
|
||||
|
||||
/** @var int : wanted primary channel, value of 0 means automatic selection */
|
||||
protected $primary_channel;
|
||||
|
||||
/** @var int : wanted secondary channel, value of 0 means automatic selection */
|
||||
protected $secondary_channel;
|
||||
|
||||
/** @var bool : enable channels that require DFS */
|
||||
protected $dfs_enabled;
|
||||
|
||||
/** @var APHtConfig : wifi ht config */
|
||||
protected $ht;
|
||||
|
||||
/**
|
||||
* AP constructor.
|
||||
* @param array $properties_x
|
||||
*/
|
||||
public function __construct( array $properties_x){
|
||||
parent::__construct( $properties_x);
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class ApHtConfig
|
||||
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
|
||||
*/
|
||||
class APHtConfig extends Model {
|
||||
|
||||
/** @var bool : enable 802.11ac */
|
||||
protected $ac_enabled;
|
||||
|
||||
/** @var bool : enable 802.11n */
|
||||
protected $ht_enabled;
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAcEnabled() {
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models\WiFi\AccessPoint;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class APStatus
|
||||
* @package alphayax\freebox\api\v3\models\WiFi\AccessPoint
|
||||
*/
|
||||
class APStatus extends Model {
|
||||
|
||||
/**
|
||||
* @var string (Read-only)
|
||||
* @see alphayax\freebox\api\v3\symbols\WiFi\APStatus\Status
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/** @var int (Read-only) : effective channel width (in MHz) */
|
||||
protected $channel_width;
|
||||
|
||||
/** @var int (Read-only) : effective primary channel */
|
||||
protected $primary_channel;
|
||||
|
||||
/** @var int (Read-only) : effective secondary channel */
|
||||
protected $secondary_channel;
|
||||
|
||||
/** @var int (Read-only) : time left in dfs state */
|
||||
protected $dfs_cac_remaining_time;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @see alphayax\freebox\api\v3\symbols\WiFi\APStatus\Status
|
||||
*/
|
||||
public function getState() {
|
||||
return $this->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;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\WiFi;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
/**
|
||||
* Class AccessPoint
|
||||
* @package alphayax\freebox\api\v3\services\config\WiFi
|
||||
*/
|
||||
class AccessPoint extends Service {
|
||||
|
||||
const API_WIFI_AP = '/api/v3/wifi/ap/';
|
||||
|
||||
/**
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[]
|
||||
*/
|
||||
public function getAll(){
|
||||
$rest = $this->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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\symbols\WiFi\APConfig;
|
||||
|
||||
/**
|
||||
* Symbol Band
|
||||
* @package alphayax\freebox\api\v3\symbols\WiFi\APConfig
|
||||
* @see alphayax\freebox\api\v3\models\WiFi\AccessPoint\APConfig
|
||||
*/
|
||||
interface Band {
|
||||
|
||||
/** 2.4 GHz */
|
||||
const BAND_2D4G = '2d4g';
|
||||
|
||||
/** 5 GHz */
|
||||
const BAND_5G = '5g';
|
||||
|
||||
/** 60 GHz */
|
||||
const BAND_60 = '60g';
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\symbols\WiFi\APStatus;
|
||||
|
||||
/**
|
||||
* Symbol State
|
||||
* @package alphayax\freebox\api\v3\symbols\WiFi\APStatus
|
||||
* @see alphayax\freebox\api\v3\models\WiFi\AccessPoint\APStatus
|
||||
*/
|
||||
interface State {
|
||||
|
||||
/** Ap is probing wifi channels */
|
||||
const SCANNING = 'scanning';
|
||||
|
||||
/** Ap is not configured */
|
||||
const NO_PARAM = 'no_param';
|
||||
|
||||
/** Ap has an invalid configuration */
|
||||
const BAD_PARAM = 'bad_param';
|
||||
|
||||
/** Ap is permanently disabled */
|
||||
const DISABLED = 'disabled';
|
||||
|
||||
/** Ap is currently disabled according to planning */
|
||||
const DISABLED_PLANNING = 'disabled_planning';
|
||||
|
||||
/** Ap has no active BSS */
|
||||
const NO_ACTIVE_BSS = 'no_active_bss';
|
||||
|
||||
/** Ap is starting */
|
||||
const STARTING = 'starting';
|
||||
|
||||
/** Ap is selecting the best available channel */
|
||||
const ACS = 'acs';
|
||||
|
||||
/** Ap is scanning for other access point */
|
||||
const HT_SCAN = 'ht_scan';
|
||||
|
||||
/** Ap is performing dynamic frequency selection */
|
||||
const DFS = 'dfs';
|
||||
|
||||
/** Ap is active */
|
||||
const ACTIVE = 'active';
|
||||
|
||||
/** Ap has failed to start */
|
||||
const FAILED = 'failed';
|
||||
}
|
Loading…
Reference in New Issue