parent
d021a3e2ab
commit
f23cff48b1
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\models;
|
||||||
|
use alphayax\freebox\api\v3\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SystemConfig
|
||||||
|
* @package alphayax\freebox\api\v3\models
|
||||||
|
*/
|
||||||
|
class SystemConfig extends Model {
|
||||||
|
|
||||||
|
/** @var string (Read-only) freebox firmware version */
|
||||||
|
protected $firmware_version;
|
||||||
|
|
||||||
|
/** @var string (Read-only) freebox mac address */
|
||||||
|
protected $mac;
|
||||||
|
|
||||||
|
/** @var string (Read-only) freebox serial number */
|
||||||
|
protected $serial;
|
||||||
|
|
||||||
|
/** @var string (Read-only) readable freebox uptime */
|
||||||
|
protected $uptime;
|
||||||
|
|
||||||
|
/** @var int (Read-only) freebox uptime (in seconds) */
|
||||||
|
protected $uptime_val;
|
||||||
|
|
||||||
|
/** @var string (Read-only) freebox hardware revision */
|
||||||
|
protected $board_name;
|
||||||
|
|
||||||
|
/** @var int (Read-only) temp cpum (°C) */
|
||||||
|
protected $temp_cpum;
|
||||||
|
|
||||||
|
/** @var int (Read-only) temp sw (°C) */
|
||||||
|
protected $temp_sw;
|
||||||
|
|
||||||
|
/** @var int (Read-only) temp cpub (°C) */
|
||||||
|
protected $temp_cpub;
|
||||||
|
|
||||||
|
/** @var int (Read-only) fan rpm */
|
||||||
|
protected $fan_rpm;
|
||||||
|
|
||||||
|
/** @var bool (Read-only) is the box authenticated (“étape 6”) */
|
||||||
|
protected $box_authenticated;
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\api\v3\config;
|
namespace alphayax\freebox\api\v3\services\config;
|
||||||
use alphayax\freebox\api\v3\models\DhcpConfig;
|
use alphayax\freebox\api\v3\models\DhcpConfig;
|
||||||
use alphayax\freebox\api\v3\Service;
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\api\v3\config;
|
namespace alphayax\freebox\api\v3\services\config;
|
||||||
use alphayax\freebox\api\v3\Service;
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\api\v3\config;
|
namespace alphayax\freebox\api\v3\services\config;
|
||||||
|
use alphayax\freebox\api\v3\models\SystemConfig;
|
||||||
use alphayax\freebox\api\v3\Service;
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,22 +15,24 @@ class System extends Service {
|
||||||
const API_SYSTEM_REBOOT = '/api/v3/system/reboot/';
|
const API_SYSTEM_REBOOT = '/api/v3/system/reboot/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the current system info
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function getConfiguration(){
|
public function getConfiguration(){
|
||||||
$rest = $this->getAuthService( self::API_SYSTEM);
|
$rest = $this->getAuthService( self::API_SYSTEM);
|
||||||
$rest->GET();
|
$rest->GET();
|
||||||
|
|
||||||
return $rest->getCurlResponse();
|
return new SystemConfig( $rest->getCurlResponse()['result']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Reboot the Freebox
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function reboot( ){
|
public function reboot(){
|
||||||
$rest = $this->getAuthService( self::API_SYSTEM_REBOOT);
|
$rest = $this->getAuthService( self::API_SYSTEM_REBOOT);
|
||||||
$rest->POST( );
|
$rest->POST();
|
||||||
|
|
||||||
return $rest->getCurlResponse();
|
return $rest->getCurlResponse();
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\api\v3\login;
|
namespace alphayax\freebox\api\v3\services\login;
|
||||||
use alphayax\freebox\api\v3\Service;
|
use alphayax\freebox\api\v3\Service;
|
||||||
use alphayax\freebox\utils\Application;
|
use alphayax\freebox\utils\Application;
|
||||||
use alphayax\utils\cli\IO;
|
use alphayax\utils\cli\IO;
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\api\v3\login;
|
namespace alphayax\freebox\api\v3\services\login;
|
||||||
use alphayax\freebox\api\v3\Service;
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use alphayax\freebox\api\v3\Service;
|
||||||
* @package alphayax\freebox\api\v3
|
* @package alphayax\freebox\api\v3
|
||||||
* @author <alphayax@gmail.com>
|
* @author <alphayax@gmail.com>
|
||||||
*/
|
*/
|
||||||
class Login extends Service {
|
class Session extends Service {
|
||||||
|
|
||||||
/// APIs services
|
/// APIs services
|
||||||
const API_LOGIN = '/api/v3/login/';
|
const API_LOGIN = '/api/v3/login/';
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace alphayax\freebox\utils;
|
namespace alphayax\freebox\utils;
|
||||||
use alphayax\freebox\api;
|
use alphayax\freebox\api\v3\services;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Application
|
* Class Application
|
||||||
|
@ -39,7 +39,7 @@ class Application {
|
||||||
* Ask authorization to the freebox and save the app token
|
* Ask authorization to the freebox and save the app token
|
||||||
*/
|
*/
|
||||||
public function authorize(){
|
public function authorize(){
|
||||||
new api\v3\login\Authorize( $this);
|
new services\login\Authorize( $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +47,7 @@ class Application {
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function openSession(){
|
public function openSession(){
|
||||||
$Login = new api\v3\login\Login( $this);
|
$Login = new services\login\Session( $this);
|
||||||
$Login->ask_login_status();
|
$Login->ask_login_status();
|
||||||
$Login->create_session();
|
$Login->create_session();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue