Initial Upload
This commit is contained in:
72
lib/XMR/ChangeLayoutAction.php
Normal file
72
lib/XMR/ChangeLayoutAction.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
class ChangeLayoutAction extends PlayerAction
|
||||
{
|
||||
public $layoutId;
|
||||
public $duration;
|
||||
public $downloadRequired;
|
||||
public $changeMode;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set details for this layout
|
||||
* @param int $layoutId the layoutId to change to
|
||||
* @param int $duration the duration this layout should be shown
|
||||
* @param bool|false $downloadRequired flag indicating whether a download is required before changing to the layout
|
||||
* @param string $changeMode whether to queue or replace
|
||||
* @return $this
|
||||
*/
|
||||
public function setLayoutDetails($layoutId, $duration = 0, $downloadRequired = false, $changeMode = 'queue')
|
||||
{
|
||||
if ($duration === null) {
|
||||
$duration = 0;
|
||||
}
|
||||
|
||||
$this->layoutId = $layoutId;
|
||||
$this->duration = $duration;
|
||||
$this->downloadRequired = $downloadRequired;
|
||||
$this->changeMode = $changeMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'changeLayout';
|
||||
|
||||
if ($this->layoutId == 0) {
|
||||
throw new PlayerActionException('Layout Details not provided');
|
||||
}
|
||||
|
||||
return $this->serializeToJson(['layoutId', 'duration', 'downloadRequired', 'changeMode']);
|
||||
}
|
||||
}
|
||||
43
lib/XMR/ClearStatsAndLogsAction.php
Normal file
43
lib/XMR/ClearStatsAndLogsAction.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class ClearStatsAndLogsAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class ClearStatsAndLogsAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(2);
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'clearStatsAndLogs';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
46
lib/XMR/CollectNowAction.php
Normal file
46
lib/XMR/CollectNowAction.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class CollectNowAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class CollectNowAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
$this->action = 'collectNow';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
55
lib/XMR/CommandAction.php
Normal file
55
lib/XMR/CommandAction.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
class CommandAction extends PlayerAction
|
||||
{
|
||||
protected $commandCode;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the command code
|
||||
* @param string $code
|
||||
* @return $this
|
||||
*/
|
||||
public function setCommandCode($code)
|
||||
{
|
||||
$this->commandCode = $code;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'commandAction';
|
||||
|
||||
if ($this->commandCode == '') {
|
||||
throw new PlayerActionException('Missing Command Code');
|
||||
}
|
||||
|
||||
return $this->serializeToJson(['commandCode']);
|
||||
}
|
||||
}
|
||||
48
lib/XMR/DataUpdateAction.php
Normal file
48
lib/XMR/DataUpdateAction.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class DataUpdateAction
|
||||
* Used to indicate that a widget has been recently updated and should be downloaded again
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class DataUpdateAction extends PlayerAction
|
||||
{
|
||||
/**
|
||||
* @param int $widgetId The widgetId which has been updated
|
||||
*/
|
||||
public function __construct(protected int $widgetId)
|
||||
{
|
||||
$this->setQos(5);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->setQos(1);
|
||||
$this->action = 'dataUpdate';
|
||||
|
||||
return $this->serializeToJson(['widgetId']);
|
||||
}
|
||||
}
|
||||
45
lib/XMR/LicenceCheckAction.php
Normal file
45
lib/XMR/LicenceCheckAction.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class LicenceCheckAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class LicenceCheckAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'licenceCheck';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
74
lib/XMR/OverlayLayoutAction.php
Normal file
74
lib/XMR/OverlayLayoutAction.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class OverlayLayoutAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class OverlayLayoutAction extends PlayerAction
|
||||
{
|
||||
public $layoutId;
|
||||
public $duration;
|
||||
public $downloadRequired;
|
||||
public $changeMode;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set details for this layout
|
||||
* @param int $layoutId the layoutId to change to
|
||||
* @param int $duration the duration this layout should be overlaid
|
||||
* @param bool|false $downloadRequired flag indicating whether a download is required before changing to the layout
|
||||
* @return $this
|
||||
*/
|
||||
public function setLayoutDetails($layoutId, $duration, $downloadRequired = false)
|
||||
{
|
||||
$this->layoutId = $layoutId;
|
||||
$this->duration = $duration;
|
||||
$this->downloadRequired = $downloadRequired;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'overlayLayout';
|
||||
|
||||
if ($this->layoutId == 0) {
|
||||
throw new PlayerActionException(__('Layout Details not provided'));
|
||||
}
|
||||
|
||||
if ($this->duration == 0) {
|
||||
throw new PlayerActionException(__('Duration not provided'));
|
||||
}
|
||||
|
||||
return $this->serializeToJson(['layoutId', 'duration', 'downloadRequired']);
|
||||
}
|
||||
}
|
||||
178
lib/XMR/PlayerAction.php
Normal file
178
lib/XMR/PlayerAction.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* An adstract class which implements a Player Action Interface
|
||||
* This class should be extended for each different action type
|
||||
*
|
||||
* When sending it will check that a default QOS/TTL has been configured. It is the responsibility
|
||||
* of the extending class to set this on initialisation.
|
||||
*/
|
||||
abstract class PlayerAction implements PlayerActionInterface
|
||||
{
|
||||
/** @var string The Action */
|
||||
public $action;
|
||||
|
||||
/** @var string Created Date */
|
||||
public $createdDt;
|
||||
|
||||
/** @var int TTL */
|
||||
public $ttl;
|
||||
|
||||
/** @var int QOS */
|
||||
private $qos;
|
||||
|
||||
/** @var string Channel */
|
||||
private $channel;
|
||||
|
||||
/** @var string Public Key */
|
||||
private $publicKey;
|
||||
|
||||
/** @var bool Should the message be encrypted? */
|
||||
private bool $isEncrypted;
|
||||
|
||||
/**
|
||||
* Set the identity of this Player Action
|
||||
* @param string $channel
|
||||
* @param bool $isEncrypted
|
||||
* @param string|null $key
|
||||
* @return $this
|
||||
* @throws \Xibo\XMR\PlayerActionException if the key is invalid
|
||||
*/
|
||||
final public function setIdentity(string $channel, bool $isEncrypted, ?string $key): PlayerActionInterface
|
||||
{
|
||||
$this->channel = $channel;
|
||||
$this->isEncrypted = $isEncrypted;
|
||||
|
||||
if ($isEncrypted) {
|
||||
$this->publicKey = openssl_get_publickey($key);
|
||||
if (!$this->publicKey) {
|
||||
throw new PlayerActionException('Invalid Public Key');
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message TTL
|
||||
* @param int $ttl
|
||||
* @return $this
|
||||
*/
|
||||
final public function setTtl(int $ttl = 120): PlayerAction
|
||||
{
|
||||
$this->ttl = $ttl;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the message QOS
|
||||
* @param int $qos
|
||||
* @return $this
|
||||
*/
|
||||
final public function setQos(int $qos = 1): PlayerAction
|
||||
{
|
||||
$this->qos = $qos;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this object to its JSON representation
|
||||
* @param array $include
|
||||
* @return string
|
||||
*/
|
||||
final public function serializeToJson(array $include = []): string
|
||||
{
|
||||
$include = array_merge(['action', 'createdDt', 'ttl'], $include);
|
||||
|
||||
$json = [];
|
||||
foreach (get_object_vars($this) as $key => $value) {
|
||||
if (in_array($key, $include)) {
|
||||
$json[$key] = $value;
|
||||
}
|
||||
}
|
||||
return json_encode($json);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the encrypted message and keys
|
||||
* @return array
|
||||
* @throws PlayerActionException
|
||||
*/
|
||||
private function getEncryptedMessage(): array
|
||||
{
|
||||
$message = null;
|
||||
|
||||
$seal = openssl_seal($this->getMessage(), $message, $eKeys, [$this->publicKey], 'RC4');
|
||||
if (!$seal) {
|
||||
throw new PlayerActionException('Cannot seal message');
|
||||
}
|
||||
|
||||
return [
|
||||
'key' => base64_encode($eKeys[0]),
|
||||
'message' => base64_encode($message)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalise the message to be sent
|
||||
* @throws \Xibo\XMR\PlayerActionException
|
||||
*/
|
||||
final public function finaliseMessage(): array
|
||||
{
|
||||
// Set the message create date
|
||||
$this->createdDt = date('c');
|
||||
|
||||
// Set the TTL if not already set
|
||||
if (empty($this->ttl)) {
|
||||
$this->setTtl();
|
||||
}
|
||||
|
||||
// Set the QOS if not already set
|
||||
if (empty($this->qos)) {
|
||||
$this->setQos();
|
||||
}
|
||||
|
||||
// Envelope our message
|
||||
$message = [
|
||||
'channel' => $this->channel,
|
||||
'qos' => $this->qos,
|
||||
];
|
||||
|
||||
// Encrypt the message if needed.
|
||||
if ($this->isEncrypted) {
|
||||
$encrypted = $this->getEncryptedMessage();
|
||||
$message['message'] = $encrypted['message'];
|
||||
$message['key'] = $encrypted['key'];
|
||||
$message['isWebSocket'] = false;
|
||||
} else {
|
||||
$message['message'] = $this->getMessage();
|
||||
$message['key'] = 'none';
|
||||
$message['isWebSocket'] = true;
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
15
lib/XMR/PlayerActionException.php
Normal file
15
lib/XMR/PlayerActionException.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* Spring Signage Ltd - http://www.springsignage.com
|
||||
* Copyright (C) 2015 Spring Signage Ltd
|
||||
* (PlayerActionException.php)
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
|
||||
class PlayerActionException extends \Exception
|
||||
{
|
||||
|
||||
}
|
||||
37
lib/XMR/PlayerActionInterface.php
Normal file
37
lib/XMR/PlayerActionInterface.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Interface PlayerActionInterface
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
interface PlayerActionInterface
|
||||
{
|
||||
/**
|
||||
* Get the Message
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage();
|
||||
}
|
||||
45
lib/XMR/PurgeAllAction.php
Normal file
45
lib/XMR/PurgeAllAction.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class PurgeAllAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class PurgeAllAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'purgeAll';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
40
lib/XMR/RekeyAction.php
Normal file
40
lib/XMR/RekeyAction.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
|
||||
class RekeyAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(1);
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'rekeyAction';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
38
lib/XMR/RevertToSchedule.php
Normal file
38
lib/XMR/RevertToSchedule.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
class RevertToSchedule extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(10);
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'revertToSchedule';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
67
lib/XMR/ScheduleCriteriaUpdateAction.php
Normal file
67
lib/XMR/ScheduleCriteriaUpdateAction.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2024 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Class ScheduleCriteriaUpdateAction
|
||||
* @package Xibo\XMR
|
||||
*/
|
||||
class ScheduleCriteriaUpdateAction extends PlayerAction
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $criteriaUpdates = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set criteria updates
|
||||
* @param array $criteriaUpdates an array of criteria updates
|
||||
* @return $this
|
||||
*/
|
||||
public function setCriteriaUpdates(array $criteriaUpdates)
|
||||
{
|
||||
$this->criteriaUpdates = $criteriaUpdates;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'criteriaUpdate';
|
||||
|
||||
// Ensure criteriaUpdates array is not empty
|
||||
if (empty($this->criteriaUpdates)) {
|
||||
// Throw an exception if criteriaUpdates is not provided
|
||||
throw new PlayerActionException(__('Criteria updates not provided.'));
|
||||
}
|
||||
|
||||
return $this->serializeToJson(['criteriaUpdates']);
|
||||
}
|
||||
}
|
||||
38
lib/XMR/ScreenShotAction.php
Normal file
38
lib/XMR/ScreenShotAction.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
class ScreenShotAction extends PlayerAction
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->setQos(5);
|
||||
}
|
||||
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'screenShot';
|
||||
|
||||
return $this->serializeToJson();
|
||||
}
|
||||
}
|
||||
53
lib/XMR/TriggerWebhookAction.php
Normal file
53
lib/XMR/TriggerWebhookAction.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2023 Xibo Signage Ltd
|
||||
*
|
||||
* Xibo - Digital Signage - https://xibosignage.com
|
||||
*
|
||||
* This file is part of Xibo.
|
||||
*
|
||||
* Xibo is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* Xibo is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Xibo\XMR;
|
||||
|
||||
/**
|
||||
* Trigger a web hook on the player. This is intended mainly for testing purposes as you'd
|
||||
* expect the trigger to be sent locally on the player
|
||||
*/
|
||||
class TriggerWebhookAction extends PlayerAction
|
||||
{
|
||||
public $triggerCode;
|
||||
|
||||
public function __construct($triggerCode)
|
||||
{
|
||||
$this->triggerCode = $triggerCode;
|
||||
$this->setQos(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws PlayerActionException
|
||||
*/
|
||||
public function getMessage(): string
|
||||
{
|
||||
$this->action = 'triggerWebhook';
|
||||
|
||||
if ($this->triggerCode == '') {
|
||||
throw new PlayerActionException('Layout Details not provided');
|
||||
}
|
||||
|
||||
return $this->serializeToJson(['triggerCode']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user