Add LCD API
This commit is contained in:
parent
50af8afb73
commit
13467784f9
|
@ -24,6 +24,7 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
|
|||
- DHCP
|
||||
- FTP
|
||||
- System
|
||||
- LCD
|
||||
- NAT
|
||||
- Dmz
|
||||
- Port Forwarding
|
||||
|
@ -75,6 +76,7 @@ Les exemples sont disponibles dans le repertoire `exemple`. Ils sont classés pa
|
|||
- `DMZ` : Récupération de la confiugration de votre zone démilitarisée
|
||||
- `IncomingPort` : Retourne la configuration actuelle du port d'entrée HTTP
|
||||
- `PortForwarding` : Exemple d'ajout d'une redirection de port
|
||||
- `LCD` : Exemple de modification de la luminosité du cadrant LCD de la freebox server
|
||||
- `download`
|
||||
- `dl_rss` : Un script qui parse les flux RSS et qui rajoute en téléchagement les items correspondant a une expression réguliere
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
/// Require Composer AutoLoader
|
||||
require_once '../../vendor/autoload.php';
|
||||
|
||||
/// Define our application
|
||||
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.lcd', 'PHP API Example (LCD)', '1.0.0');
|
||||
$App->authorize();
|
||||
$App->openSession();
|
||||
|
||||
// DMZ
|
||||
$LCDService = new \alphayax\freebox\api\v3\services\config\LCD( $App);
|
||||
$a = $LCDService->getConfiguration();
|
||||
var_dump( $a);
|
||||
|
||||
$a->setBrightness( 10);
|
||||
$b = $LCDService->setConfiguration( $a);
|
||||
var_dump( $b);
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Model;
|
||||
|
||||
/**
|
||||
* Class LCDConfig
|
||||
* @package alphayax\freebox\api\v3\models
|
||||
*/
|
||||
class LCDConfig extends Model {
|
||||
|
||||
/** @var int : the screen brightness (range from 0 to 100) */
|
||||
protected $brightness;
|
||||
|
||||
/** @var bool : is the screen orientation forced */
|
||||
protected $orientation_forced;
|
||||
|
||||
/** @var int : the screen orientation angle */
|
||||
protected $orientation;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBrightness(){
|
||||
return $this->brightness;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $brightness
|
||||
*/
|
||||
public function setBrightness( $brightness){
|
||||
$this->brightness = $brightness;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOrientationForced(){
|
||||
return $this->orientation_forced;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $orientation_forced
|
||||
*/
|
||||
public function setOrientationForced( $orientation_forced){
|
||||
$this->orientation_forced = $orientation_forced;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getOrientation(){
|
||||
return $this->orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $orientation
|
||||
*/
|
||||
public function setOrientation( $orientation){
|
||||
$this->orientation = $orientation;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config;
|
||||
use alphayax\freebox\api\v3\models\LCDConfig;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
/**
|
||||
* Class LCD
|
||||
* @package alphayax\freebox\api\v3\services\config
|
||||
*/
|
||||
class LCD extends Service {
|
||||
|
||||
const API_LCD_CONFIG = '/api/v3/lcd/config/';
|
||||
|
||||
/**
|
||||
* @return LCDConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_LCD_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new LCDConfig( $rest->getCurlResponse()['result']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LCDConfig $lcdConfig
|
||||
* @return LCDConfig
|
||||
*/
|
||||
public function setConfiguration( LCDConfig $lcdConfig){
|
||||
$rest = $this->getAuthService( self::API_LCD_CONFIG);
|
||||
$rest->PUT( $lcdConfig->toArray());
|
||||
|
||||
return new LCDConfig( $rest->getCurlResponse()['result']);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue