Add UPnPAV API
This commit is contained in:
parent
804eeab549
commit
5411b21a74
|
@ -48,6 +48,8 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
|
||||||
- Dmz
|
- Dmz
|
||||||
- Port Forwarding
|
- Port Forwarding
|
||||||
- Incoming Port
|
- Incoming Port
|
||||||
|
- UPnP
|
||||||
|
- AV
|
||||||
|
|
||||||
|
|
||||||
## Utilisation
|
## Utilisation
|
||||||
|
|
2
TODO.md
2
TODO.md
|
@ -31,7 +31,7 @@
|
||||||
- UPnP IGD
|
- UPnP IGD
|
||||||
- ~~LCD~~
|
- ~~LCD~~
|
||||||
- Network Share
|
- Network Share
|
||||||
- UPnP AV
|
- ~~UPnP AV~~
|
||||||
- Switch
|
- Switch
|
||||||
- Wi-Fi
|
- Wi-Fi
|
||||||
- ~~System~~
|
- ~~System~~
|
||||||
|
|
|
@ -8,7 +8,7 @@ $App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.config', '
|
||||||
$App->authorize();
|
$App->authorize();
|
||||||
$App->openSession();
|
$App->openSession();
|
||||||
|
|
||||||
// DMZ
|
// LCD Configuration
|
||||||
$LCDService = new \alphayax\freebox\api\v3\services\config\LCD( $App);
|
$LCDService = new \alphayax\freebox\api\v3\services\config\LCD( $App);
|
||||||
$a = $LCDService->getConfiguration();
|
$a = $LCDService->getConfiguration();
|
||||||
var_dump( $a);
|
var_dump( $a);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/// Require Composer AutoLoader
|
||||||
|
require_once '../../vendor/autoload.php';
|
||||||
|
|
||||||
|
/// Define our application
|
||||||
|
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.config', 'PHP API Example (Config)', '1.0.0');
|
||||||
|
$App->authorize();
|
||||||
|
$App->openSession();
|
||||||
|
|
||||||
|
// UPnP AV
|
||||||
|
$UPnPAvService = new \alphayax\freebox\api\v3\services\config\UPnP\AV( $App);
|
||||||
|
$UPnPAvConfig = $UPnPAvService->getConfiguration();
|
||||||
|
print_r( $UPnPAvConfig);
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\models\UPnP;
|
||||||
|
use alphayax\freebox\api\v3\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UpnpAvConfig
|
||||||
|
* @package alphayax\freebox\api\v3\models\UPnP
|
||||||
|
*/
|
||||||
|
class UpnpAvConfig extends Model {
|
||||||
|
|
||||||
|
/** @var bool : is the UPnP AV service enabled */
|
||||||
|
protected $enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isEnabled() {
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $enabled
|
||||||
|
*/
|
||||||
|
public function setEnabled( $enabled) {
|
||||||
|
$this->enabled = $enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\services\config\UPnP;
|
||||||
|
use alphayax\freebox\api\v3\models\UPnP\UpnpAvConfig;
|
||||||
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AV
|
||||||
|
* @package alphayax\freebox\api\v3\services\config\UPnP
|
||||||
|
*/
|
||||||
|
class AV extends Service {
|
||||||
|
|
||||||
|
const API_UPNP_AV_CONFIG = '/api/v3/upnpav/config/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current UPnP AV configuration
|
||||||
|
* @return UpnpAvConfig
|
||||||
|
*/
|
||||||
|
public function getConfiguration(){
|
||||||
|
$rest = $this->getAuthService( self::API_UPNP_AV_CONFIG);
|
||||||
|
$rest->GET();
|
||||||
|
|
||||||
|
return new UpnpAvConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the UPnP AV configuration
|
||||||
|
* @param UpnpAvConfig $new_UpnpAvConfig
|
||||||
|
* @return UpnpAvConfig
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function setConfiguration( UpnpAvConfig $new_UpnpAvConfig){
|
||||||
|
$rest = $this->getAuthService( self::API_UPNP_AV_CONFIG);
|
||||||
|
$rest->PUT( $new_UpnpAvConfig->toArray());
|
||||||
|
|
||||||
|
return new UpnpAvConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue