def test_start_channel(packets, crypto):
    bin_name = 'start_channel_request'
    msg = factory.start_channel(
        channel_request_id=1,
        title_id=0,
        service=constants.MessageTarget.SystemInputUUID,
        activity_id=0
    )
    msg.header(
        sequence_number=2,
        source_participant_id=31
    )
    msg.header.flags(need_ack=True)
    packed = _pack(msg, crypto)

    assert msg.header.pkt_type == enum.PacketType.Message
    assert msg.header.flags.msg_type == enum.MessageType.StartChannelRequest

    assert msg.protected_payload.channel_request_id == 1
    assert msg.protected_payload.title_id == 0
    assert msg.protected_payload.service == constants.MessageTarget.SystemInputUUID
    assert msg.protected_payload.activity_id == 0

    assert len(packed) == len(packets[bin_name])
    assert packed == packets[bin_name]
Exemplo n.º 2
0
    async def start_channel(self,
                            channel: ServiceChannel,
                            messagetarget_uuid: uuid.UUID,
                            title_id: int = 0,
                            activity_id: int = 0,
                            **kwargs) -> None:
        """
        Request opening of specific ServiceChannel

        Args:
            channel: Channel to start
            messagetarget_uuid: Message Target UUID
            title_id: Title ID, Only used for ServiceChannel.Title
            activity_id: Activity ID, unknown use-case
            **kwargs: KwArgs

        Returns: None
        """
        request_id = self._chl_mgr.get_next_request_id(channel)
        msg = factory.start_channel(request_id, title_id, messagetarget_uuid,
                                    activity_id)
        await self.send_message(msg, **kwargs)
Exemplo n.º 3
0
    def start_channel(self,
                      channel,
                      messagetarget_uuid,
                      title_id=0,
                      activity_id=0,
                      **kwargs):
        """
        Request opening of specific ServiceChannel

        Args:
            channel (:class:`ServiceChannel`): Channel to start
            messagetarget_uuid (UUID): Message Target UUID
            title_id (int): Title ID, Only used for ServiceChannel.Title
            activity_id (int): Activity ID, unknown use-case
            **kwargs: KwArgs

        Returns: None
        """
        request_id = self._chl_mgr.get_next_request_id(channel)
        msg = factory.start_channel(request_id, title_id, messagetarget_uuid,
                                    activity_id)
        return self.send_message(msg, **kwargs)