Add WiFi Radar API

This commit is contained in:
alphayax 2016-06-08 13:19:13 +02:00
parent 27e1fd35cd
commit 1b085e80dd
5 changed files with 164 additions and 3 deletions

View File

@ -85,7 +85,8 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
- AP (core)
- Allowed Comb
- Stations
- BSS
- Radar
- BSS
## Utilisation

View File

@ -14,9 +14,10 @@ $a = $WiFiConfigService->getConfiguration();
print_r( $a);
*/
/*
$WiFiAccessPointService = new \alphayax\freebox\api\v3\services\config\WiFi\AccessPoint( $App);
$AccessPoints = $WiFiAccessPointService->getAll();
/*
print_r( $AccessPoints);
$AllowedComb = $WiFiAccessPointService->getAllowedCombFromId( $AccessPoints[0]->getId());
@ -26,10 +27,15 @@ $Stations = $WiFiAccessPointService->getStationsFromId( $AccessPoints[1]->getId(
print_r( $Stations);
*/
$Neighbors = $WiFiAccessPointService->getNeighborsFromId( $AccessPoints[1]->getId());
print_r( $Neighbors);
/*
$WiFiBssService = new \alphayax\freebox\api\v3\services\config\WiFi\Bss( $App);
$Bsss = $WiFiBssService->getAll();
print_r( $Bsss);
$Bss = $WiFiBssService->getFromId( $Bsss[0]->getId());
print_r( $Bss);
*/

View File

@ -0,0 +1,96 @@
<?php
namespace alphayax\freebox\api\v3\models\WiFi\Radar;
use alphayax\freebox\api\v3\Model;
/**
* Class Neighbor
* @package alphayax\freebox\api\v3\models\WiFi
*/
class Neighbor extends Model {
/** @var string (Read-only) : neighbor bssid */
protected $bssid;
/** @var string (Read-only) : neighbor ssid */
protected $ssid;
/**
* @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 int (Read-only) : neighbor channel_width */
protected $channel_width;
/** @var int (Read-only) : neighbor primary channel */
protected $channel;
/** @var int (Read-only) : neighbor secondary channel (0 for unused) */
protected $secondary_channel;
/** @var int (Read-only) : signal attenuation in dB */
protected $signal;
/** @var NeighborCap (Read-only) : neighbor capabilities */
protected $capabilities;
/**
* @return string
*/
public function getBssid() {
return $this->bssid;
}
/**
* @return string
*/
public function getSsid() {
return $this->ssid;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band
*/
public function getBand() {
return $this->band;
}
/**
* @return int
*/
public function getChannelWidth() {
return $this->channel_width;
}
/**
* @return int
*/
public function getChannel() {
return $this->channel;
}
/**
* @return int
*/
public function getSecondaryChannel() {
return $this->secondary_channel;
}
/**
* @return int
*/
public function getSignal() {
return $this->signal;
}
/**
* @return NeighborCap
*/
public function getCapabilities() {
return $this->capabilities;
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace alphayax\freebox\api\v3\models\WiFi\Radar;
use alphayax\freebox\api\v3\Model;
/**
* Class NeighborCap
* @package alphayax\freebox\api\v3\models\WiFi\Radar
*/
class NeighborCap extends Model {
/** @var bool (Read-only) : neighbor uses legacy wifi (802.11a, 802.11b) */
protected $legacy;
/** @var bool (Read-only) : neighbor supports ht (802.11n) */
protected $ht;
/** @var bool (Read-only) : neighbor supports vht (802.11ac) */
protected $vht;
/**
* neighbor uses legacy wifi (802.11a, 802.11b)
* @return boolean
*/
public function isLegacy() {
return $this->legacy;
}
/**
* neighbor supports ht (802.11n)
* @return boolean
*/
public function isHt() {
return $this->ht;
}
/**
* neighbor supports vht (802.11ac)
* @return boolean
*/
public function isVht() {
return $this->vht;
}
}

View File

@ -12,6 +12,7 @@ class AccessPoint extends Service {
const API_WIFI_AP = '/api/v3/wifi/ap/';
const API_WIFI_AP_ALLOWED_COMB = '/api/v3/wifi/ap/%u/allowed_channel_comb';
const API_WIFI_AP_STATIONS = '/api/v3/wifi/ap/%u/stations/';
const API_WIFI_AP_NEIGHBORS = '/api/v3/wifi/ap/%u/neighbors/';
/**
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[]
@ -71,4 +72,17 @@ class AccessPoint extends Service {
return $rest->getResult( models\WiFi\AccessPoint\AP::class);
}
/**
* Get the list of Neighbor seen by the AP
* @param int $accessPointId
* @return models\WiFi\Radar\Neighbor[]
*/
public function getNeighborsFromId( $accessPointId) {
$service = sprintf( self::API_WIFI_AP_NEIGHBORS, $accessPointId);
$rest = $this->getAuthService( $service);
$rest->GET();
return $rest->getResultAsArray( models\WiFi\Radar\Neighbor::class);
}
}