mqtt/pdu.py
def encode(self):
        '''
        Encode and store a SUBACK control packet.
        '''
        header    = bytearray(1)
        payload   = bytearray()
        varHeader = encode16Int(self.msgId)
        header[0] = 0x90
        for code in self.granted:
            payload.append(code[0] | (0x80 if code[1] == True else 0x00))
        header.extend(encodeLength(len(varHeader) + len(payload)))
        header.extend(varHeader)
        header.extend(payload)
        self.encoded = header
        return str(header) if PY2 else bytes(header)
def encode(self):
        '''
        Encode and store a SUBACK control packet.
        '''
        header    = bytearray(1)
        payload   = bytearray()
        varHeader = encode16Int(self.msgId)
        header[0] = 0x90
        for code in self.granted:
            payload.append(code[0] | (0x80 if code[1] == True else 0x00))
        header.extend(encodeLength(len(varHeader) + len(payload)))
        header.extend(varHeader)
        header.extend(payload)
        self.encoded = header
        return str(header) if PY2 else bytes(header)
def encode ( self ) : header = bytearray ( 1 ) payload = bytearray ( ) varHeader = encode16Int ( self . msgId ) header [ 0 ] = 0x90 for code in self . granted : payload . append ( code [ 0 ] | ( 0x80 if code [ 1 ] == True else 0x00 ) ) header . extend ( encodeLength ( len ( varHeader ) + len ( payload ) ) ) header . extend ( varHeader ) header . extend ( payload ) self . encoded = header return str ( header ) if PY2 else bytes ( header )
Encode and store a SUBACK control packet.
Encode and store a SUBACK control packet .