public NetworkTableConnectionListenerAdapter(IRemote ir, IRemoteConnectionListener ircl)
 {
   base.\u002Ector();
   NetworkTableConnectionListenerAdapter connectionListenerAdapter = this;
   this.targetSource = ir;
   this.targetListener = ircl;
 }
Example #2
0
        ///<inheritdoc cref="NetworkTable.AddConnectionListener(IRemoteConnectionListener, bool)"/>
        public static void AddGlobalConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
        {
            lock (s_connectionListenerMap)
            {
                if (s_connectionListenerMap.ContainsKey(listener))
                {
                    throw new ArgumentException("Cannot add the same listener twice", nameof(listener));
                }

                ConnectionListenerCallback func = (uid, connected, conn) =>
                {
                    if (connected)
                    {
                        listener.Connected(s_staticRemote.Value, conn);
                    }
                    else
                    {
                        listener.Disconnected(s_staticRemote.Value, conn);
                    }
                };

                int id = NtCore.AddConnectionListener(func, immediateNotify);
                s_connectionListenerMap.Add(listener, id);
            }
        }
Example #3
0
 ///<inheritdoc/>
 public void RemoveConnectionListener(IRemoteConnectionListener listener)
 {
     if (m_connectionListenerMap.TryGetValue(listener, out int val))
     {
         m_ntCore.RemoveConnectionListener(val);
     }
 }
 public virtual void addConnectionListener(IRemoteConnectionListener ircl, bool b)
 {
   this.remoteListeners.add((object) ircl);
   if (this.isConnected())
     ircl.connected((IRemote) this);
   else
     ircl.disconnected((IRemote) this);
 }
Example #5
0
        ///<inheritdoc/>
        public void RemoveConnectionListener(IRemoteConnectionListener listener)
        {
            int val;

            if (m_connectionListenerMap.TryGetValue(listener, out val))
            {
                CoreMethods.RemoveConnectionListener(val);
            }
        }
Example #6
0
 ///<inheritdoc cref="RemoveConnectionListener(IRemoteConnectionListener)"/>
 public static void RemoveGlobalConnectionListener(IRemoteConnectionListener listener)
 {
     lock (s_connectionListenerMap)
     {
         if (s_connectionListenerMap.TryGetValue(listener, out int val))
         {
             NtCore.RemoveConnectionListener(val);
             s_connectionListenerMap.Remove(listener);
         }
     }
 }
Example #7
0
        ///<inheritdoc/>
        public void AddConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
        {
            if (m_connectionListenerMap.ContainsKey(listener))
            {
                throw new ArgumentException("Cannot add the same listener twice", nameof(listener));
            }

            ConnectionListenerCallback func = (uid, connected, conn) =>
            {
                if (connected)
                {
                    listener.Connected(this, conn);
                }
                else
                {
                    listener.Disconnected(this, conn);
                }
            };
            int id = m_ntCore.AddConnectionListener(func, immediateNotify);

            m_connectionListenerMap.Add(listener, id);
        }
Example #8
0
 public virtual void removeConnectionListener(IRemoteConnectionListener ircl)
 {
   NetworkTableConnectionListenerAdapter connectionListenerAdapter = (NetworkTableConnectionListenerAdapter) this.connectionListenerMap.get((object) ircl);
   if (connectionListenerAdapter == null)
     return;
   this.node.removeConnectionListener((IRemoteConnectionListener) connectionListenerAdapter);
 }
Example #9
0
 public virtual void addConnectionListener(IRemoteConnectionListener ircl, bool b)
 {
   int num = b ? 1 : 0;
   if ((NetworkTableConnectionListenerAdapter) this.connectionListenerMap.get((object) ircl) != null)
   {
     string str = "Cannot add the same listener twice";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalStateException(str);
   }
   else
   {
     NetworkTableConnectionListenerAdapter connectionListenerAdapter = new NetworkTableConnectionListenerAdapter((IRemote) this, ircl);
     this.connectionListenerMap.put((object) ircl, (object) connectionListenerAdapter);
     this.node.addConnectionListener((IRemoteConnectionListener) connectionListenerAdapter, num != 0);
   }
 }
 public virtual void removeConnectionListener(IRemoteConnectionListener ircl)
 {
   this.remoteListeners.remove((object) ircl);
 }
 /// <summary>
 /// Removes a Connection Listener from the network table.
 /// </summary>
 /// <param name="listener">The <see cref="IRemoteConnectionListener"/> to remove.</param>
 public void RemoveConnectionListener(IRemoteConnectionListener listener)
 {
     int val;
     if (m_connectionListenerMap.TryGetValue(listener, out val))
     {
         CoreMethods.RemoveConnectionListener(val);
     }
 }
        /// <summary>
        /// Adds a connection listener to the network table.
        /// </summary>
        /// <param name="listener">The <see cref="IRemoteConnectionListener"/> to add.</param>
        /// <param name="immediateNotify">True whether to notify the listener immediately, 
        /// otherwise false.</param>
        public void AddConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
        {
            if (m_connectionListenerMap.ContainsKey(listener))
            {
                throw new ArgumentException("Cannot add the same listener twice", nameof(listener));
            }

            ConnectionListenerFunction func = (uid, connected, conn) =>
            {
                if (connected) listener.Connected(this);
                else listener.Disconnected(this);
            };

            int id = CoreMethods.AddConnectionListener(func, immediateNotify);

            m_connectionListenerMap.Add(listener, id);
        }
Example #13
0
 public static void addConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
 {
   int num = immediateNotify ? 1 : 0;
   Robot.__\u003C\u003Eclient.addConnectionListener(listener, num != 0);
 }
Example #14
0
 public static void removeConnectionListener(IRemoteConnectionListener listener)
 {
   Robot.__\u003C\u003Eclient.removeConnectionListener(listener);
 }
Example #15
0
 public void RemoveConnectionListener(IRemoteConnectionListener listener)
 {
     NetworkTable.RemoveGlobalConnectionListener(listener);
 }
Example #16
0
 public void AddConnectionListener(IRemoteConnectionListener listener, bool immediateNotify)
 {
     NetworkTable.AddGlobalConnectionListener(listener, immediateNotify);
 }