-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[viera-connector-homekit-connector-bridge] Prepared viera connector t…
…o homekit connector bridge (#306)
- Loading branch information
1 parent
328e14e
commit f72cfe7
Showing
7 changed files
with
193 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
/** | ||
* DbTransactionFinished.php | ||
* | ||
* @license More in LICENSE.md | ||
* @copyright https://www.fastybird.com | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Events | ||
* @since 1.0.0 | ||
* | ||
* @date 11.09.24 | ||
*/ | ||
|
||
namespace FastyBird\Library\Application\Events; | ||
|
||
use Symfony\Contracts\EventDispatcher; | ||
|
||
/** | ||
* Database transaction finished event | ||
* | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Events | ||
* | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
*/ | ||
class DbTransactionFinished extends EventDispatcher\Event | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
/** | ||
* DbTransactionStarted.php | ||
* | ||
* @license More in LICENSE.md | ||
* @copyright https://www.fastybird.com | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Events | ||
* @since 1.0.0 | ||
* | ||
* @date 11.09.24 | ||
*/ | ||
|
||
namespace FastyBird\Library\Application\Events; | ||
|
||
use Symfony\Contracts\EventDispatcher; | ||
|
||
/** | ||
* Database transaction started event | ||
* | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Events | ||
* | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
*/ | ||
class DbTransactionStarted extends EventDispatcher\Event | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
/** | ||
* EventLoop.php | ||
* | ||
* @license More in LICENSE.md | ||
* @copyright https://www.fastybird.com | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Subscribers | ||
* @since 1.0.0 | ||
* | ||
* @date 11.09.24 | ||
*/ | ||
|
||
namespace FastyBird\Library\Application\Subscribers; | ||
|
||
use FastyBird\Library\Application\Events; | ||
use FastyBird\Library\Application\Utilities; | ||
use Nette; | ||
use Symfony\Component\EventDispatcher; | ||
|
||
/** | ||
* Event loop events | ||
* | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Subscribers | ||
* | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
*/ | ||
final class EventLoop implements EventDispatcher\EventSubscriberInterface | ||
{ | ||
|
||
use Nette\SmartObject; | ||
|
||
public function __construct(private readonly Utilities\EventLoopStatus $eventLoopStatus) | ||
{ | ||
} | ||
|
||
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
Events\EventLoopStarted::class => 'loopStarted', | ||
Events\EventLoopStopped::class => 'loopStopped', | ||
Events\EventLoopStopping::class => 'loopStopped', | ||
]; | ||
} | ||
|
||
public function loopStarted(): void | ||
{ | ||
$this->eventLoopStatus->setStatus(true); | ||
} | ||
|
||
public function loopStopped(): void | ||
{ | ||
$this->eventLoopStatus->setStatus(false); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
/** | ||
* EventLoopStatus.php | ||
* | ||
* @license More in LICENSE.md | ||
* @copyright https://www.fastybird.com | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Utilities | ||
* @since 1.0.0 | ||
* | ||
* @date 12.09.24 | ||
*/ | ||
|
||
namespace FastyBird\Library\Application\Utilities; | ||
|
||
use Nette; | ||
|
||
/** | ||
* Event loop status helper | ||
* | ||
* @package FastyBird:ApplicationLibrary! | ||
* @subpackage Utilities | ||
* | ||
* @author Adam Kadlec <adam.kadlec@fastybird.com> | ||
*/ | ||
final class EventLoopStatus | ||
{ | ||
|
||
use Nette\SmartObject; | ||
|
||
private bool $status = false; | ||
|
||
public function setStatus(bool $status): void | ||
{ | ||
$this->status = $status; | ||
} | ||
|
||
public function isRunning(): bool | ||
{ | ||
return $this->status; | ||
} | ||
|
||
} |