def _decode_data(self, _data): cursor = 0 self.id = MQTTUtils.decode_value(_data[cursor:cursor + 2]) cursor += 2 self.unsubscribe_list = [] while cursor < self.length: topic, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l + 2 self.unsubscribe_list.append(topic)
def _decode_data(self, _data): self.topic, l = MQTTUtils.decode_string(_data) cursor = l + 2 if self.qos > MQTTConstants.AT_MOST_ONCE: self.id = MQTTUtils.decode_value(_data[cursor:cursor + 2]) cursor += 2 else: self.id = None self.payload = _data[cursor:]
def _decode_data(self, _data): self.id = MQTTUtils.decode_value(_data[0:2]) cursor = 2 self.subscription_intents = [] while cursor < self.length: topic, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l + 2 qos = _data[cursor] & 0x03 cursor += 1 self.subscription_intents.append((topic, qos))
def _decode_data(self, _data): self.protocol_name, l = MQTTUtils.decode_string(_data) assert self.protocol_name == 'MQIsdp' or self.protocol_name == 'MQTT' cursor = l + 2 self.protocol_version = _data[cursor] assert self.protocol_version == 3 or self.protocol_version == 4 cursor += 1 self.has_username = (_data[cursor] & 0x80) == 0x80 self.has_passwd = (_data[cursor] & 0x40) == 0x40 self.will_retain = (_data[cursor] & 0x20) == 0x20 self.will_qos = (_data[cursor] & 0x18) >> 3 self.will_flag = (_data[cursor] & 0x04) == 0x04 self.clean_session = (_data[cursor] & 0x02) == 0x02 cursor += 1 self.keep_alive = MQTTUtils.decode_value(_data[cursor:cursor+2]) cursor += 2 self.client_uid, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l if self.will_flag: cursor += 2 self.will_topic, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l + 2 self.will_message, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l else: self.will_topic = None self.will_message = None if self.has_username: cursor += 2 self.username, l = MQTTUtils.decode_string(_data[cursor:]) cursor += l else: self.username = None if self.has_passwd: cursor += 2 if cursor < self.length - 2: self.passwd, l = MQTTUtils.decode_string(_data[cursor:]) else: self.passwd = None else: self.passwd = None
def _decode_data(self, _data): self.id = MQTTUtils.decode_value(_data[0:2])
def _decode_data(self, _data): cursor = 0 self.id = MQTTUtils.decode_value(_data[cursor:cursor + 2]) cursor += 2 self.payload = _data[cursor:]