public ParticipantChangedEventArgs(RtpCommunicator communicator, Multicast multicast, Participant participant, ParticipantChangedType type)
 {
     this.Communicator = communicator;
     this.Multicast    = multicast;
     this.Participant  = participant;
     this.Type         = type;
 }
Exemplo n.º 2
0
 /// <summary>
 /// 安装模块
 /// </summary>
 /// <param name="context"></param>
 public void Install(RtpCommunicator communicator)
 {
     if (this.Installed)
     {
         return;
     }
     this.Installed    = true;
     this.Communicator = communicator;
     _channel          = CreateChannel(communicator);
     InstallImpl(communicator);
     _events.Raise(communicator, this, true);
 }
Exemplo n.º 3
0
        /// <summary>
        /// 移除模块
        /// </summary>
        /// <param name="context"></param>
        public void Uninstall(RtpCommunicator communicator)
        {
            if (!this.Installed)
            {
                return;
            }
            this.Installed = false;
            UninstallImpl(communicator);

            LogoutCapabilities();
            RemoveChannel(communicator);
            _channel          = null;
            this.Communicator = null;
            _events.Raise(communicator, this, false);
        }
Exemplo n.º 4
0
        private void InitializeCommunicator(string serverIP, int serverPort)
        {
            var config = new ClientConfig()
            {
                Host = serverIP,
                Port = serverPort,
                ReconnectDelayTime = 5, //间隔5秒重连一次
                ReconnectTimes     = 0  //无限重连
            };

            _communicator                   = new RtpCommunicator(this.CommunicatorName, config);
            _communicator.Connected        += OnConnected;
            _communicator.Error            += OnError;
            _communicator.LastConnectError += OnLastConnectError;
            _communicator.Dropped          += OnDropped;
            _communicator.Start();

            _single = new AutoResetEvent(false);
            _single.WaitOne(); //使用信号量来控制连接是同步的,当成功连接或者失败连接后,池才会返回对象给外界使用
        }
Exemplo n.º 5
0
 protected abstract void RemoveChannel(RtpCommunicator communicator);
Exemplo n.º 6
0
 protected abstract RtpChannel CreateChannel(RtpCommunicator communicator);
Exemplo n.º 7
0
 /// <summary>
 /// 卸载模块的实现方法
 /// </summary>
 /// <param name="context"></param>
 protected abstract void UninstallImpl(RtpCommunicator communicator);
 protected override void RemoveChannel(RtpCommunicator communicator)
 {
     communicator.Context.RemoveChannel(this.MulticastAddress);
 }
 protected override RtpChannel CreateChannel(RtpCommunicator communicator)
 {
     return(communicator.Context.CreateChannel(this.MulticastAddress, this.Participant));
 }
Exemplo n.º 10
0
 public ModuleChangedEventArgs(RtpCommunicator communicator, RtpModule module, bool installed)
 {
     this.Communicator = communicator;
     this.Module       = module;
     this.Installed    = installed;
 }
Exemplo n.º 11
0
 private void DisposeCommunicator()
 {
     _communicator.Dispose();
     _communicator = null;
 }
Exemplo n.º 12
0
 protected override void RemoveChannel(RtpCommunicator communicator)
 {
 }
Exemplo n.º 13
0
 protected override RtpChannel CreateChannel(RtpCommunicator communicator)
 {
     return(communicator.Context.UnicastChannel);
 }