My Project
 All Classes Functions Properties
Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
MQTTClient Class Reference
Inheritance diagram for MQTTClient:

Instance Methods

(MQTTClient *) - initWithClientId:
 
(void) - setMessageRetry:
 
(void) - connect
 
(void) - connectToHost:
 
(void) - reconnect
 
(void) - disconnect
 
(void) - setWill:toTopic:withQos:retain:
 
(void) - clearWill
 
(void) - publishString:toTopic:withQos:retain:
 
(void) - subscribe:
 
(void) - subscribe:withQos:
 
(void) - unsubscribe:
 
(void) - loop:
 

Class Methods

(void) + initialize
 
(NSString *) + version
 

Protected Attributes

struct mosquitto * mosq
 
NSTimer * timer
 

Properties

NSString * host
 
unsigned short port
 
NSString * username
 
NSString * password
 
unsigned short keepAlive
 
BOOL cleanSession
 
id< MQTTClientDelegatedelegate
 

Method Documentation

- (void) clearWill

Clears the will that was set with setWill().

- (void) connect

Connects to the host designated if the host has already been set.

- (void) connectToHost: (NSString*)  host

Connects to the given host.

Parameters
hostString that represents the host address.
- (void) disconnect

Disconnect from the host.

- (MQTTClient *) initWithClientId: (NSString *)  clientId

Initalize a new MQTTClient object with a clientID

Parameters
clientIdString that represents the client ID
Returns
a newly initialized MQTTClient
- (void) publishString: (NSString *)  payload
toTopic: (NSString *)  topic
withQos: (NSUInteger)  qos
retain: (BOOL)  retain 

Publishes a string to the host on a given topic

Parameters
payloadString that holds the message to be sent
topicString that represents the topic to which the message is sent
qosNSUInteger that represents the quality of service level that the message will be sent with
retainBOOL that flags the message to be retained or not
- (void) reconnect

Disconnect from the host and establish a new connection.

- (void) setMessageRetry: (NSUInteger)  seconds

Sets how often the message will retry.

Parameters
secondsNSUInteger that represent the amount of time between retries.
- (void) setWill: (NSString *)  payload
toTopic: (NSString *)  willTopic
withQos: (NSUInteger)  willQos
retain: (BOOL)  retain 

Message to be sent upon disconnect

Parameters
payloadString that holds the message to be sent
willTopicString that represents the topic to which the Will message is sent
willQosNSUInteger that represents the quality of service level that the message will be sent with
retainBOOL that flags the message to be retained or not
- (void) subscribe: (NSString *)  topic

Subscribes to the given topic to receive messages sent to that topic

Parameters
topicString that represents the topic to be listened on
- (void) subscribe: (NSString *)  topic
withQos: (NSUInteger)  qos 

Subscribes to the given topic to receive messages sent to that topic with the given QOS

Parameters
topicString that represents the topic to be listened on
qosNSUInteger that represents the quality of service level that the message will be recieved with
- (void) unsubscribe: (NSString *)  topic

Unsubscibes from the given topic

Parameters
topicString that represents the topic from which to be unsubscribed

Property Documentation

- (BOOL) cleanSession
readwriteatomicassign

Boolean to flag a clean session.

- (id<MQTTClientDelegate>) delegate
readwriteatomicassign

Pointer to the delegate object that will handle messages when received.

- (NSString *) host
readwriteatomicretain

The string that holds the host address.

- (unsigned short) keepAlive
readwriteatomicassign

The amount of time to keep alive

- (NSString *) password
readwriteatomicretain

The string that holds the password of the client.

- (unsigned short) port
readwriteatomicassign

The port number of the host.

- (NSString *) username
readwriteatomicretain

The string that holds the username of the client.


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