File modules/cms/generator/dsl/DslMqtt.class.php
Last commit: Thu Dec 26 19:48:18 2024 +0100 Jan Dankert New: Import the module 'phariable' via a new dependency script. The Variable Resolver has now it's own repository.
1 <?php 2 3 namespace cms\generator\dsl; 4 5 use dsl\context\BaseScriptableObject; 6 use mqtt\Mqtt; 7 8 /** 9 * A Proxy for MqTT methods. 10 */ 11 class DslMqtt extends BaseScriptableObject 12 { 13 /** 14 * @var Mqtt 15 */ 16 private $mqtt; 17 18 19 public function __construct($url,$user,$password ) 20 { 21 $this->mqtt = new Mqtt( $url ); 22 $this->mqtt->connect( $user, $password ); 23 } 24 25 public function publish($topic,$value) 26 { 27 $this->mqtt->publish($topic,$value); 28 } 29 30 public function subscribe($topic) 31 { 32 return $this->mqtt->subscribe($topic); 33 } 34 35 public function disconnect() 36 { 37 $this->mqtt->disconnect(); 38 } 39 }
Downloadmodules/cms/generator/dsl/DslMqtt.class.php
History Thu, 26 Dec 2024 19:48:18 +0100 Jan Dankert New: Import the module 'phariable' via a new dependency script. The Variable Resolver has now it's own repository. Mon, 27 Jun 2022 00:40:42 +0200 Jan Dankert New: Marker interface 'Scriptable', Proxy class for MQTT, help() method in Scripts.