Skip to content

Commit

Permalink
XMR: apply some logic to the OOS setting and refactor interface. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Nov 4, 2023
1 parent fb265b3 commit fcb7763
Show file tree
Hide file tree
Showing 14 changed files with 292 additions and 116 deletions.
39 changes: 29 additions & 10 deletions lib/XMR/ChangeLayoutAction.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
<?php
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2015 Spring Signage Ltd
* (ChangeLayoutAction.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
Expand All @@ -26,8 +44,9 @@ class ChangeLayoutAction extends PlayerAction
*/
public function setLayoutDetails($layoutId, $duration = 0, $downloadRequired = false, $changeMode = 'queue')
{
if ($duration === null)
if ($duration === null) {
$duration = 0;
}

$this->layoutId = $layoutId;
$this->duration = $duration;
Expand All @@ -38,15 +57,15 @@ public function setLayoutDetails($layoutId, $duration = 0, $downloadRequired = f
}

/**
* @return mixed|string
* @throws PlayerActionException
* @inheritDoc
*/
public function getMessage()
public function getMessage(): string
{
$this->action = 'changeLayout';

if ($this->layoutId == 0)
if ($this->layoutId == 0) {
throw new PlayerActionException('Layout Details not provided');
}

return $this->serializeToJson(['layoutId', 'duration', 'downloadRequired', 'changeMode']);
}
Expand Down
28 changes: 24 additions & 4 deletions lib/XMR/ClearStatsAndLogsAction.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
<?php
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2017 Spring Signage Ltd
* (ClearStatsAndLogsAction.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/>.
*/


Expand All @@ -14,7 +29,12 @@
*/
class ClearStatsAndLogsAction extends PlayerAction
{
public function getMessage()
public function __construct()
{
$this->setQos(2);
}

public function getMessage(): string
{
$this->action = 'clearStatsAndLogs';

Expand Down
27 changes: 23 additions & 4 deletions lib/XMR/CollectNowAction.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
<?php
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2015 Spring Signage Ltd
* (CollectNowAction.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/>.
*/


Expand All @@ -14,12 +29,16 @@
*/
class CollectNowAction extends PlayerAction
{
public function __construct()
{
$this->setQos(5);
}

/**
* @inheritdoc
*/
public function getMessage()
{
$this->setQos(1);
$this->action = 'collectNow';

return $this->serializeToJson();
Expand Down
33 changes: 26 additions & 7 deletions lib/XMR/CommandAction.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
<?php
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2015 Spring Signage Ltd
* (CommandAction.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
Expand All @@ -24,12 +42,13 @@ public function setCommandCode($code)
return $this;
}

public function getMessage()
public function getMessage(): string
{
$this->action = 'commandAction';

if ($this->commandCode == '')
if ($this->commandCode == '') {
throw new PlayerActionException('Missing Command Code');
}

return $this->serializeToJson(['commandCode']);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/XMR/DataUpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
*/


namespace Xibo\XMR;

/**
Expand All @@ -35,10 +34,11 @@ class DataUpdateAction extends PlayerAction
*/
public function __construct(protected int $widgetId)
{
$this->setQos(5);
}

/** @inheritdoc */
public function getMessage()
public function getMessage(): string
{
$this->setQos(1);
$this->action = 'dataUpdate';
Expand Down
15 changes: 10 additions & 5 deletions lib/XMR/LicenceCheckAction.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Copyright (C) 2020 Xibo Signage Ltd
/*
* Copyright (C) 2023 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
* Xibo - Digital Signage - https://xibosignage.com
*
* This file is part of Xibo.
*
Expand All @@ -28,10 +28,15 @@
*/
class LicenceCheckAction extends PlayerAction
{
public function __construct()
{
$this->setQos(4);
}

/**
* @return mixed|string
* @return string
*/
public function getMessage()
public function getMessage(): string
{
$this->action = 'licenceCheck';

Expand Down
35 changes: 28 additions & 7 deletions lib/XMR/OverlayLayoutAction.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
<?php
/*
* Spring Signage Ltd - http://www.springsignage.com
* Copyright (C) 2015 Spring Signage Ltd
* (ChangeLayoutAction.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;

/**
Expand All @@ -19,6 +33,11 @@ class OverlayLayoutAction extends PlayerAction
public $downloadRequired;
public $changeMode;

public function __construct()
{
$this->setQos(10);
}

/**
* Set details for this layout
* @param int $layoutId the layoutId to change to
Expand All @@ -38,15 +57,17 @@ public function setLayoutDetails($layoutId, $duration, $downloadRequired = false
/**
* @inheritdoc
*/
public function getMessage()
public function getMessage(): string
{
$this->action = 'overlayLayout';

if ($this->layoutId == 0)
if ($this->layoutId == 0) {
throw new PlayerActionException(__('Layout Details not provided'));
}

if ($this->duration == 0)
if ($this->duration == 0) {
throw new PlayerActionException(__('Duration not provided'));
}

return $this->serializeToJson(['layoutId', 'duration', 'downloadRequired']);
}
Expand Down
Loading

0 comments on commit fcb7763

Please sign in to comment.