PHP Modules by Tommi2Day 7.0
Modules for Symon
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
IPSphpMQTT Class Reference

based on phpMQTT class modified for running with Symcon (http://www.symcon.de) More...

Public Member Functions

 __construct ($address, $port, $clientid)
 IPSphpMQTT constructor.
 
 debugtxt ($func, $msg)
 keep debug messages to retrieve from IPS module
 
 connect_auto ($clean=true, $will=NULL, $username=NULL, $password=NULL)
 Auto connect function.
 
 connect ($clean=true, $will=NULL, $username=NULL, $password=NULL)
 connects to the broker
 
 subscribe ($topics, $qos=0)
 subscribes to topics
 
 disconnect ()
 sends a proper disconect cmd
 
 close ()
 sends a proper disconect, then closes the socket
 
 publish ($topic, $content, $qos=0, $retain=0)
 publishes $content on a $topic
 
 proc ( $loop=true)
 the processing loop for an "allways on" client
 

Data Fields

 $msgid = 1
 counter for message id
 
 $keepalive = 10
 default keepalive timer
 
 $timesinceping
 host unix time, used to detect disconects
 
 $topics = array()
 used to store currently subscribed topics
 
 $debug = false
 debug flag
 
 $address
 broker address
 
 $port
 broker port
 
 $clientid
 client id sent to brocker
 
 $will
 stores the will of the client
 
 $debugmsg =array()
 store debug messages for IPS
 

Detailed Description

based on phpMQTT class modified for running with Symcon (http://www.symcon.de)

Constructor & Destructor Documentation

◆ __construct()

__construct (   $address,
  $port,
  $clientid 
)

IPSphpMQTT constructor.

Parameters
string$addressBroker IP/Hostname
int$portBroker Port
string$clientidClient ID for broker

Member Function Documentation

◆ connect()

connect (   $clean = true,
  $will = NULL,
  $username = NULL,
  $password = NULL 
)

connects to the broker

Parameters
bool$cleanshould the client send a clean session flag
string$willLast will
string$usernameBroker Username (if needed)
string$passwordBroker Password (if needed)
Returns
bool

◆ connect_auto()

connect_auto (   $clean = true,
  $will = NULL,
  $username = NULL,
  $password = NULL 
)

Auto connect function.

Parameters
bool$cleanshould the client send a clean session flag
string$willLast will
string$usernameBroker Username (if needed)
string$passwordBroker Password (if needed)
Returns
bool success

◆ debugtxt()

debugtxt (   $func,
  $msg 
)

keep debug messages to retrieve from IPS module

Parameters
$funcstring
$msgstring

◆ proc()

proc (   $loop = true)

the processing loop for an "allways on" client

Parameters
boolean$loopboolean set true when you are doing other stuff in the loop good for watching something else at the same time
Returns
boolean

◆ publish()

publish (   $topic,
  $content,
  $qos = 0,
  $retain = 0 
)

publishes $content on a $topic

Parameters
string$topicTopic to publish
string$contentContent to publish
int$qosQOS to publish(0,1,2)
int$retain

◆ subscribe()

subscribe (   $topics,
  $qos = 0 
)

subscribes to topics

Parameters
array$topicsArray with topics to subscribe
int$qosQOS setting (0,1 or 2)
Returns
string

The documentation for this class was generated from the following file: