We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extension FrameSubAck: InitialWithBytes { init?(packetFixedHeaderType: UInt8, bytes: [UInt8]) { self.packetFixedHeaderType = packetFixedHeaderType var protocolVersion = ""; if let storage = CocoaMQTTStorage() { protocolVersion = storage.queryMQTTVersion() } if (protocolVersion == "5.0"){ // the bytes length must bigger than 3 guard bytes.count >= 4 else { return nil } self.msgid = UInt16(bytes[0]) << 8 + UInt16(bytes[1]) self.grantedQos = [] for i in 3 ..< bytes.count { guard let qos = CocoaMQTTQoS(rawValue: bytes[i]) else { return nil } self.grantedQos.append(qos) } self.reasonCodes = [CocoaMQTTSUBACKReasonCode]() for i in 3 ..< bytes.count { guard let qos = CocoaMQTTSUBACKReasonCode(rawValue: bytes[i]) else { return nil } self.reasonCodes! += [qos] } self.subAckProperties = MqttDecodeSubAck() self.subAckProperties!.decodeSubAck(fixedHeader: packetFixedHeaderType, pubAckData: bytes) }else{ // the bytes length must bigger than 3 guard bytes.count >= 3 else { return nil } self.msgid = UInt16(bytes[0]) << 8 + UInt16(bytes[1]) self.grantedQos = [] for i in 2 ..< bytes.count { guard let qos = CocoaMQTTQoS(rawValue: bytes[i]) else { return nil } self.grantedQos.append(qos) } } } }
if bytes is [0, 1, 0, 135], this function return nil。Because CocoaMQTTQoS(rawValue: bytes[i]) return nil
CocoaMQTTQoS(rawValue: bytes[i])
The text was updated successfully, but these errors were encountered:
Does not seem to respond correctly to the following situation
Sorry, something went wrong.
No branches or pull requests
if bytes is [0, 1, 0, 135], this function return nil。Because
CocoaMQTTQoS(rawValue: bytes[i])
return nilThe text was updated successfully, but these errors were encountered: