My Project
 All Classes Functions Properties
MQTTClient.h
1 /*******************************************************************************
2  * Copyright 2013 ClearBlade, Inc
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Any redistribution of this program in any form must include this copyright
9  *******************************************************************************/
10 
11 #import <Foundation/Foundation.h>
12 #import "MQTTMessage.h"
13 
19 - (void) didConnect: (NSUInteger)code;
23 - (void) didDisconnect;
28 - (void) didPublish: (NSUInteger)messageId;
33 - (void) didReceiveMessage: (MQTTMessage*)mqtt_msg;
39 - (void) didSubscribe: (NSUInteger)messageId grantedQos:(NSArray*)qos;
44 - (void) didUnsubscribe: (NSUInteger)messageId;
45 
46 @end
47 
48 
49 @interface MQTTClient : NSObject {
50  struct mosquitto *mosq;
51  NSString *host;
52  unsigned short port;
53  NSString *username;
54  NSString *password;
55  unsigned short keepAlive;
57 
58  NSTimer *timer;
59 }
63 @property (readwrite,retain) NSString *host;
67 @property (readwrite,assign) unsigned short port;
71 @property (readwrite,retain) NSString *username;
75 @property (readwrite,retain) NSString *password;
79 @property (readwrite,assign) unsigned short keepAlive;
83 @property (readwrite,assign) BOOL cleanSession;
87 @property (readwrite,assign) id<MQTTClientDelegate> delegate;
88 
89 
90 + (void) initialize;
91 + (NSString*) version;
92 
98 - (MQTTClient*) initWithClientId: (NSString *)clientId;
103 - (void) setMessageRetry: (NSUInteger)seconds;
107 - (void) connect;
112 - (void) connectToHost: (NSString*)host;
116 - (void) reconnect;
120 - (void) disconnect;
128 - (void)setWill: (NSString *)payload toTopic:(NSString *)willTopic withQos:(NSUInteger)willQos retain:(BOOL)retain;
132 - (void)clearWill;
140 - (void)publishString: (NSString *)payload toTopic:(NSString *)topic withQos:(NSUInteger)qos retain:(BOOL)retain;
145 - (void)subscribe: (NSString *)topic;
151 - (void)subscribe: (NSString *)topic withQos:(NSUInteger)qos;
156 - (void)unsubscribe: (NSString *)topic;
157 
158 
159 // This is called automatically when connected
160 - (void) loop: (NSTimer *)timer;
161 
162 @end
Definition: MQTTClient.h:49
NSString * password
Definition: MQTTClient.h:54
unsigned short port
Definition: MQTTClient.h:52
NSString * username
Definition: MQTTClient.h:53
Definition: MQTTMessage.h:13
unsigned short keepAlive
Definition: MQTTClient.h:55
NSString * host
Definition: MQTTClient.h:51
BOOL cleanSession
Definition: MQTTClient.h:56
Definition: MQTTClient.h:14