Пример #1
0
 def joinChannel(self, userID, channelID):
     """
     Join a channel
     :param userID: the user ID that will join the channel
     :param channelID: the channel ID
     """
     pdu = MCSChannelJoinRequestPDU(userID, channelID, b"")
     self.mcs.send(pdu)
Пример #2
0
    def parseChannelJoinRequest(self, stream: BytesIO) -> MCSChannelJoinRequestPDU:
        """
        Parse a Channel Join Request PDU
        :param stream: stream containing the data
        """
        data = stream.read()
        if len(data) < 4:
            raise ParsingError("Invalid Channel Join Request PDU received")

        initiator = Uint16BE.unpack(data[0 : 2]) + MCSChannelID.USERCHANNEL_BASE
        channelID = Uint16BE.unpack(data[2 : 4])
        payload = data[4 :]

        return MCSChannelJoinRequestPDU(initiator, channelID, payload)