Add WiFi Channel Usage API

This commit is contained in:
alphayax 2016-06-08 13:22:48 +02:00
parent 1b085e80dd
commit 75c18287c9
4 changed files with 73 additions and 1 deletions

View File

@ -86,6 +86,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
- Allowed Comb
- Stations
- Radar
- Channel Usage
- BSS

View File

@ -25,11 +25,13 @@ print_r( $AllowedComb);
$Stations = $WiFiAccessPointService->getStationsFromId( $AccessPoints[1]->getId());
print_r( $Stations);
*/
$Neighbors = $WiFiAccessPointService->getNeighborsFromId( $AccessPoints[1]->getId());
print_r( $Neighbors);
*/
$ChannelUsages = $WiFiAccessPointService->getChannelUsageFromId( $AccessPoints[1]->getId());
print_r( $ChannelUsages);
/*
$WiFiBssService = new \alphayax\freebox\api\v3\services\config\WiFi\Bss( $App);

View File

@ -0,0 +1,55 @@
<?php
namespace alphayax\freebox\api\v3\models\WiFi\Radar;
use alphayax\freebox\api\v3\Model;
/**
* Class ChannelUsage
* @package alphayax\freebox\api\v3\models\WiFi\Radar
*/
class ChannelUsage extends Model {
/** @var int (Read-only) : channel number */
protected $channel;
/**
* @var string (Read-only)
* @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band
*/
protected $band;
/** @var int (Read-only) : noise level on channel in dB */
protected $noise_level;
/** @var int (Read-only) : rx channel busy time percentage */
protected $rx_busy_percent;
/**
* @return int
*/
public function getChannel() {
return $this->channel;
}
/**
* @return string
* @see alphayax\freebox\api\v3\symbols\WiFi\APConfig\Band
*/
public function getBand() {
return $this->band;
}
/**
* @return int
*/
public function getNoiseLevel() {
return $this->noise_level;
}
/**
* @return int
*/
public function getRxBusyPercent() {
return $this->rx_busy_percent;
}
}

View File

@ -13,6 +13,7 @@ class AccessPoint extends Service {
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/';
const API_WIFI_AP_CHANNEL_USAGE = '/api/v3/wifi/ap/%u/channel_usage/';
/**
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[]
@ -85,4 +86,17 @@ class AccessPoint extends Service {
return $rest->getResultAsArray( models\WiFi\Radar\Neighbor::class);
}
/**
* @param int $accessPointId
* @return models\WiFi\Radar\Neighbor[]
*/
public function getChannelUsageFromId( $accessPointId) {
$service = sprintf( self::API_WIFI_AP_CHANNEL_USAGE, $accessPointId);
$rest = $this->getAuthService( $service);
$rest->GET();
return $rest->getResultAsArray( models\WiFi\Radar\ChannelUsage::class);
}
}