Skip to content

Commit

Permalink
retain -> retained
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangwh committed Mar 8, 2016
1 parent 8140246 commit f5bdc58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions Source/CocoaMQTT.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public protocol CocoaMQTTClient {

func connect() -> Bool

func publish(topic: String, withString string: String, qos: CocoaMQTTQOS, retain: Bool, dup: Bool) -> UInt16
func publish(topic: String, withString string: String, qos: CocoaMQTTQOS, retained: Bool, dup: Bool) -> UInt16

func publish(message: CocoaMQTTMessage) -> UInt16

Expand Down Expand Up @@ -220,16 +220,16 @@ public class CocoaMQTT: NSObject, CocoaMQTTClient, GCDAsyncSocketDelegate, Cocoa
}
}

public func publish(topic: String, withString string: String, qos: CocoaMQTTQOS = .QOS1, retain: Bool = false, dup: Bool = false) -> UInt16 {
let message = CocoaMQTTMessage(topic: topic, string: string, qos: qos, retain: retain, dup: dup)
public func publish(topic: String, withString string: String, qos: CocoaMQTTQOS = .QOS1, retained: Bool = false, dup: Bool = false) -> UInt16 {
let message = CocoaMQTTMessage(topic: topic, string: string, qos: qos, retained: retained, dup: dup)
return publish(message)
}

public func publish(message: CocoaMQTTMessage) -> UInt16 {
let msgId: UInt16 = _nextMessageId()
let frame = CocoaMQTTFramePublish(msgid: msgId, topic: message.topic, payload: message.payload)
frame.qos = message.qos.rawValue
frame.retain = message.retain
frame.retained = message.retained
frame.dup = message.dup
send(frame, tag: Int(msgId))
if message.qos != CocoaMQTTQOS.QOS0 {
Expand Down Expand Up @@ -588,7 +588,7 @@ public class CocoaMQTTReader {
frame.unpack()
let msgId = frame.msgid!
let qos = CocoaMQTTQOS(rawValue: frame.qos)!
let message = CocoaMQTTMessage(topic: frame.topic!, payload: frame.payload, qos: qos, retain: frame.retain, dup: frame.dup)
let message = CocoaMQTTMessage(topic: frame.topic!, payload: frame.payload, qos: qos, retained: frame.retained, dup: frame.dup)
return (msgId, message)
}

Expand Down
4 changes: 2 additions & 2 deletions Source/CocoaMQTTFrame.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class CocoaMQTTFrame {

}

var retain: Bool {
var retained: Bool {

get { return (header & 0x01) == 0 ? false : true }

Expand Down Expand Up @@ -259,7 +259,7 @@ class CocoaMQTTFrameConnect: CocoaMQTTFrame {
if let will = client.willMessage {
flagWill = true
flagWillQOS = will.qos.rawValue
flagWillRetain = will.retain
flagWillRetain = will.retained
payload += will.topic.bytesWithLength
payload += will.payload
}
Expand Down
12 changes: 6 additions & 6 deletions Source/CocoaMQTTMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
/**
* MQTT Message
*/
public class CocoaMQTTMessage {
public class CocoaMQTTMessage: NSObject {

public var topic: String

Expand All @@ -26,23 +26,23 @@ public class CocoaMQTTMessage {

var qos: CocoaMQTTQOS = .QOS1

var retain: Bool = false
var retained: Bool = false

var dup: Bool = false

public init(topic: String, string: String, qos: CocoaMQTTQOS = .QOS1, retain: Bool = false, dup: Bool = false) {
public init(topic: String, string: String, qos: CocoaMQTTQOS = .QOS1, retained: Bool = false, dup: Bool = false) {
self.topic = topic
self.payload = [UInt8](string.utf8)
self.qos = qos
self.retain = retain
self.retained = retained
self.dup = dup
}

public init(topic: String, payload: [UInt8], qos: CocoaMQTTQOS = .QOS1, retain: Bool = false, dup: Bool = false) {
public init(topic: String, payload: [UInt8], qos: CocoaMQTTQOS = .QOS1, retained: Bool = false, dup: Bool = false) {
self.topic = topic
self.payload = payload
self.qos = qos
self.retain = retain
self.retained = retained
self.dup = dup
}

Expand Down

0 comments on commit f5bdc58

Please sign in to comment.