Enable debuge mode option
This commit is contained in:
parent
6d6a1041d3
commit
7a5a5166a3
|
|
@ -16,6 +16,7 @@ class Mqtt
|
||||||
protected $cert_file = null;
|
protected $cert_file = null;
|
||||||
protected $password = null;
|
protected $password = null;
|
||||||
protected $port = null;
|
protected $port = null;
|
||||||
|
protected $debug = null;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +25,7 @@ class Mqtt
|
||||||
$this->password = config('mqtt.password');
|
$this->password = config('mqtt.password');
|
||||||
$this->cert_file = config('mqtt.certfile');
|
$this->cert_file = config('mqtt.certfile');
|
||||||
$this->port = config('mqtt.port');
|
$this->port = config('mqtt.port');
|
||||||
|
$this->debug = config('mqtt.debug');
|
||||||
|
|
||||||
// $this->client = new phpMQTT($this->host, $this->port, 25,$this-$this->cert_file);
|
// $this->client = new phpMQTT($this->host, $this->port, 25,$this-$this->cert_file);
|
||||||
// $this->client = new MQTTClient($this->host,$this->port);
|
// $this->client = new MQTTClient($this->host,$this->port);
|
||||||
|
|
@ -32,7 +34,7 @@ class Mqtt
|
||||||
|
|
||||||
public function ConnectAndSendMessage($topic, $msg)
|
public function ConnectAndSendMessage($topic, $msg)
|
||||||
{
|
{
|
||||||
$client = new phpMQTT($this->host,$this->port, rand(0,100), $this->cert_file);
|
$client = new phpMQTT($this->host,$this->port, rand(0,100), $this->cert_file, $this->debug);
|
||||||
|
|
||||||
if ($client->connect(true))
|
if ($client->connect(true))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class phpMQTT {
|
||||||
private $password; /* stores password */
|
private $password; /* stores password */
|
||||||
public $cafile;
|
public $cafile;
|
||||||
|
|
||||||
function __construct($address, $port, $clientid, $cafile = NULL, $debug=false){
|
function __construct($address, $port, $clientid, $cafile = NULL, $debug){
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
$this->broker($address, $port, $clientid, $cafile);
|
$this->broker($address, $port, $clientid, $cafile);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,5 @@ return [
|
||||||
'username' => env('mqtt_username',''),
|
'username' => env('mqtt_username',''),
|
||||||
'certfile' => env('mqtt_cert_file',''),
|
'certfile' => env('mqtt_cert_file',''),
|
||||||
'port' => env('mqtt_port','1883'),
|
'port' => env('mqtt_port','1883'),
|
||||||
'debug' => env('mqtt_debug',false)
|
'debug' => env('mqtt_debug',false) //Optional Parameter to enable debuging set it to True
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue