/// <summary> 
        /// Sends an interaction.
        /// </summary>
        /// <param name="decodedValue">the message or interaction to send
        /// </param>
        public virtual void SendInteraction(BaseInteractionMessage msg)
        {
            TransportationType transport = interactionChannelMap[msg.GetType()];

            // If transport is null, then we send it directly to 
            // our listeners
            if (transport == null)
            {
                ReceiveInteraction(msg);
            }
            else
            {
                //msg.InteractionClassHandle = ((XRTIInteractionClassHandle)interactionClassDescriptorMap[msg.GetType()].Handle).Identifier;
                msg.InteractionClassHandle = SerializerManager.GetHandle(msg.GetType());

                SendInteraction(transport, msg);
            }
        }
Exemple #2
0
        /// <summary>
        /// Notifies that there is a new channel available
        /// </summary>
        public void OnChannelAvailable(IMessageChannel ch)
        {
            PeerAdvertisementInteractionMessage msg = new PeerAdvertisementInteractionMessage();

            msg.InteractionClassHandle = SerializerManager.GetHandle(typeof(PeerAdvertisementInteractionMessage));
            msg.PeerName        = PeerName;
            msg.PeerDescription = PeerDescription;
            msg.PeerChannels    = new ConnectionList();
            foreach (MessageChannelAcceptor channel in channelManager.ChannelAcceptorsList)
            {
                msg.PeerChannels.Add(channel.Uri);
            }

            IList <IMessageChannel> list = channelManager.ChannelsList(ChannelType.MULTICAST);

            if (list != null)
            {
                foreach (IMessageChannel channel in list)
                {
                    msg.PeerChannels.Add(channel.Uri);
                }
            }

            if (ch is TCPMessageChannel)
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("New Channel detected. Sending a PeerAdvertisement message");
                }

                SendRealiableInteraction(ch as StreamMessageChannel, msg);
            }
            else if (ch is MulticastMessageChannel)
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("New Channel detected. Sending a PeerAdvertisement message");
                }

                SendBestEffortInteraction(ch as DGramMessageChannel, msg);
            }
        }