///<inheritdoc/> public void AddTableListenerEx(string key, ITableListener listener, NotifyFlags flags) { lock (m_listenerMap) { if (!m_listenerMap.TryGetValue(listener, out List <int> adapters)) { adapters = new List <int>(); m_listenerMap.Add(listener, adapters); } string fullKey = m_pathWithSeperator + key; // ReSharper disable once InconsistentNaming EntryListenerCallback func = (uid, funcKey, value, flags_) => { if (!funcKey.Equals(fullKey)) { return; } listener.ValueChanged(this, key, value, flags_); }; int id = NtCore.AddEntryListener(fullKey, func, flags); adapters.Add(id); } }
///<inheritdoc/> public void AddTableListenerEx(ITableListener listener, NotifyFlags flags) { List <int> adapters; if (!m_listenerMap.TryGetValue(listener, out adapters)) { adapters = new List <int>(); m_listenerMap.Add(listener, adapters); } // ReSharper disable once InconsistentNaming EntryListenerCallback func = (uid, key, value, flags_) => { string relativeKey = key.Substring(m_path.Length + 1); if (relativeKey.IndexOf(PathSeperatorChar) != -1) { return; } listener.ValueChanged(this, relativeKey, value, flags_); }; int id = m_ntCore.AddEntryListener(m_path + PathSeperatorChar, func, flags); adapters.Add(id); }
///<inheritdoc/> public void AddSubTableListener(ITableListener listener, bool localNotify) { if (!m_listenerMap.TryGetValue(listener, out List <int> adapters)) { adapters = new List <int>(); m_listenerMap.Add(listener, adapters); } HashSet <string> notifiedTables = new HashSet <string>(); // ReSharper disable once InconsistentNaming EntryListenerCallback func = (uid, key, value, flags_) => { string relativeKey = key.Substring(m_path.Length + 1); int endSubTable = relativeKey.IndexOf(PathSeperatorChar); if (endSubTable == -1) { return; } string subTableKey = relativeKey.Substring(0, endSubTable); if (notifiedTables.Contains(subTableKey)) { return; } notifiedTables.Add(subTableKey); listener.ValueChanged(this, subTableKey, null, flags_); }; NotifyFlags flags = NotifyFlags.NotifyNew | NotifyFlags.NotifyUpdate; if (localNotify) { flags |= NotifyFlags.NotifyLocal; } int id = m_ntCore.AddEntryListener(m_pathWithSeperator, func, flags); adapters.Add(id); }
public NetworkTableListenerAdapter(string str, ITable it, ITableListener itl) { base.\u002Ector(); NetworkTableListenerAdapter tableListenerAdapter = this; this.prefix = str; this.targetSource = it; this.targetListener = itl; }
public virtual void addTableListener(ITableListener itl, bool b) { int num = b ? 1 : 0; this.tableListeners.add((object) itl); if (num == 0) return; this.entryStore.notifyEntries((ITable) null, itl); }
public NetworkTableSubListenerAdapter(string str, NetworkTable nt, ITableListener itl) { base.\u002Ector(); NetworkTableSubListenerAdapter subListenerAdapter = this; this.notifiedTables = new Set(); this.prefix = str; this.targetSource = nt; this.targetListener = itl; }
public Scheduler() { Scheduler scheduler = this; this.count = 0; this.commands = new StringArray(); this.ids = new NumberArray(); this.toCancel = new NumberArray(); this.listener = (ITableListener) new Scheduler\u00241(this); }
public NetworkTableKeyListenerAdapter(string str1, string str2, NetworkTable nt, ITableListener itl) { base.\u002Ector(); NetworkTableKeyListenerAdapter keyListenerAdapter = this; this.relativeKey = str1; this.fullKey = str2; this.targetSource = nt; this.targetListener = itl; }
///<inheritdoc/> public void AddTableListener(string key, ITableListener listener, bool immediateNotify = false) { NotifyFlags flags = NotifyFlags.NotifyNew | NotifyFlags.NotifyUpdate; if (immediateNotify) { flags |= NotifyFlags.NotifyImmediate; } AddTableListenerEx(key, listener, flags); }
///<inheritdoc/> public void RemoveTableListener(ITableListener listener) { if (m_listenerMap.TryGetValue(listener, out List <int> adapters)) { foreach (int t in adapters) { m_ntCore.RemoveEntryListener(t); } adapters.Clear(); } }
void IStreamingListener.Start(int phase) { string groupOrItemName = _groupOrItemName.ToUpper(); if (_listener != null) { _listener.MessageReceived -= ListenerMessageReceived; ((IStreamingListener)this).Stop(); } string schema = _messageConverter.GetFieldList(); string channel = _channel.ToUpper(); _listener = new TableListener <TDto>(_adapterSet.ToUpper(), channel, groupOrItemName, phase, _serializer); _listener.MessageReceived += ListenerMessageReceived; Logger.Debug(string.Format("Subscribing to group:{0}, schema {1}, dataAdapter {2}, mode {3}, snapshot {4}", groupOrItemName, schema, channel, _mode.ToUpper(), _snapshot)); var simpleTableInfo = new SimpleTableInfo( groupOrItemName, schema: schema, mode: _mode.ToUpper(), snap: _snapshot) { DataAdapter = channel }; var gate = new ManualResetEvent(false); Exception ex = null; new Thread(() => { try { _subscribedTableKey = _lsClient.SubscribeTable(simpleTableInfo, _listener, false); Logger.Debug(string.Format("Subscribed to table with key: {0}", _subscribedTableKey)); } catch (Exception exInner) { ex = exInner; } gate.Set(); }).Start(); if (ex != null) { Logger.Error(ex); throw ex; } if (!gate.WaitOne(LightstreamerDefaults.DEFAULT_TIMEOUT_MS + 1000)) { Logger.Error(string.Format("Listener taking longer than {0}ms to start: {1}.", LightstreamerDefaults.DEFAULT_TIMEOUT_MS, GetType().Name)); } }
public virtual void addTableListener(ITableListener itl, bool b) { int num = b ? 1 : 0; List list = (List) this.listenerMap.get((object) itl); if (list == null) { list = new List(); this.listenerMap.put((object) itl, (object) list); } NetworkTableListenerAdapter tableListenerAdapter = new NetworkTableListenerAdapter(new StringBuilder().append(this.path).append('/').toString(), (ITable) this, itl); list.add((object) tableListenerAdapter); this.node.addTableListener((ITableListener) tableListenerAdapter, num != 0); }
public void AddTableListener(ITableListener listener) { throw new NotImplementedException(); }
public void RemoveTableListener(ITableListener listener) { }
public void AddTableListener(string key, ITableListener listener, bool immediateNotify) { }
public void AddSubTableListener(ITableListener listener, bool localNotify) { }
public void AddTableListenerEx(ITableListener listener, NotifyFlags flags) { }
public void AddSubTableListener(ITableListener listener, bool localNotify) { subtableListeners.Add(listener); }
public void AddTableListenerEx(string key, ITableListener listener, NotifyFlags flags) { }
/// <summary> /// Adds a SubTable Listener with the default flags, and without local notify. /// </summary> /// <param name="listener">The <see cref="ITableListener"/> to add.</param> public void AddSubTableListener(ITableListener listener) { AddSubTableListener(listener, false); }
/// <summary> /// Removes a table listener. /// </summary> /// <param name="listener">The <see cref="ITableListener"/> to remove.</param> public void RemoveTableListener(ITableListener listener) { List<int> adapters; if (m_listenerMap.TryGetValue(listener, out adapters)) { foreach (int t in adapters) { CoreMethods.RemoveEntryListener(t); } adapters.Clear(); } }
/// <summary> /// Adds a Table Listener for a specified key, using the extended entry flags. /// </summary> /// <param name="key">The key to listen for.</param> /// <param name="listener">The <see cref="ITableListener"/> to add.</param> /// <param name="flags">The <see cref="EntryFlags"/> flags to use for the listener</param> public void AddTableListenerEx(string key, ITableListener listener, NotifyFlags flags) { List<int> adapters; if (!m_listenerMap.TryGetValue(listener, out adapters)) { adapters = new List<int>(); m_listenerMap.Add(listener, adapters); } string fullKey = m_path + PathSeperatorChar + key; // ReSharper disable once InconsistentNaming EntryListenerFunction func = (uid, funcKey, value, flags_) => { if (!funcKey.Equals(fullKey)) return; listener.ValueChanged(this, key, value, flags_); }; int id = CoreMethods.AddEntryListener(fullKey, func, flags); adapters.Add(id); }
/// <summary> /// Adds a Table Listener for the entire table, using the extended entry flags. /// </summary> /// <param name="listener">The <see cref="ITableListener"/> to add.</param> /// <param name="flags">The <see cref="EntryFlags"/> flags to use for the listener</param> public void AddTableListenerEx(ITableListener listener, NotifyFlags flags) { List<int> adapters; if (!m_listenerMap.TryGetValue(listener, out adapters)) { adapters = new List<int>(); m_listenerMap.Add(listener, adapters); } // ReSharper disable once InconsistentNaming EntryListenerFunction func = (uid, key, value, flags_) => { string relativeKey = key.Substring(m_path.Length + 1); if (relativeKey.IndexOf(PathSeperatorChar) != -1) { return; } listener.ValueChanged(this, relativeKey, value, flags_); }; int id = CoreMethods.AddEntryListener(m_path + PathSeperatorChar, func, flags); adapters.Add(id); }
public void AddSubTableListener(ITableListener listener) { subtableListeners.Add(listener); }
public void AddTableListener(ITableListener listener, bool immediateNotify = false) { }
public void AddTableListener(ITableListener listener, bool immediateNotify) { throw new NotImplementedException(); }
public void AddSubTableListener(ITableListener listener) { }
public virtual void addTableListener(string str, ITableListener itl, bool b) { int num = b ? 1 : 0; List list = (List) this.listenerMap.get((object) itl); if (list == null) { list = new List(); this.listenerMap.put((object) itl, (object) list); } NetworkTableKeyListenerAdapter keyListenerAdapter = new NetworkTableKeyListenerAdapter(str, this.absoluteKeyCache.get(str), this, itl); list.add((object) keyListenerAdapter); this.node.addTableListener((ITableListener) keyListenerAdapter, num != 0); }
public virtual void removeTableListener(ITableListener itl) { List list = (List) this.listenerMap.get((object) itl); if (list == null) return; for (int i = 0; i < list.size(); ++i) this.node.removeTableListener((ITableListener) list.get(i)); list.clear(); }
/// <summary> /// /// </summary> /// <typeparam name="TDto"></typeparam> /// <param name="simpleTableInfo"></param> /// <param name="listener"></param> /// <param name="b"></param> /// <returns></returns> public SubscribedTableKey SubscribeTable <TDto>(SimpleTableInfo simpleTableInfo, ITableListener <TDto> listener, bool b) where TDto : class, new() { SubscribedTableKey key = _client.SubscribeTable(simpleTableInfo, listener, b); return(key); }
/// <summary> /// Adds a SubTable Listener. /// </summary> /// <param name="listener">The <see cref="ITableListener"/> to add.</param> /// <param name="localNotify">True if we want to notify local and remote listeners, /// otherwise just notify remote listeners.</param> public void AddSubTableListener(ITableListener listener, bool localNotify) { List<int> adapters; if (!m_listenerMap.TryGetValue(listener, out adapters)) { adapters = new List<int>(); m_listenerMap.Add(listener, adapters); } HashSet<string> notifiedTables = new HashSet<string>(); // ReSharper disable once InconsistentNaming EntryListenerFunction func = (uid, key, value, flags_) => { string relativeKey = key.Substring(m_path.Length + 1); int endSubTable = relativeKey.IndexOf(PathSeperatorChar); if (endSubTable == -1) return; string subTableKey = relativeKey.Substring(0, endSubTable); if (notifiedTables.Contains(subTableKey)) return; notifiedTables.Add(subTableKey); listener.ValueChanged(this, subTableKey, GetSubTable(subTableKey), flags_); }; NotifyFlags flags = NotifyFlags.NotifyNew | NotifyFlags.NotifyUpdate; if (localNotify) flags |= NotifyFlags.NotifyLocal; int id = CoreMethods.AddEntryListener(m_path + PathSeperatorChar, func, flags); adapters.Add(id); }
public virtual void removeTableListener(ITableListener itl) { this.tableListeners.remove((object) itl); }
public void RemoveTableListener(ITableListener listener) { throw new NotImplementedException(); }
public virtual void addTableListener(ITableListener itl) { this.addTableListener(itl, false); }
/// <summary> /// Adds a table listener for a specific key with the default listener flags. /// </summary> /// <param name="key">The key to listen for.</param> /// <param name="listener">The <see cref="ITableListener"/> to add.</param> /// <param name="immediateNotify">True if we want to immediately notify the listener, /// otherwise false.</param> public void AddTableListener(string key, ITableListener listener, bool immediateNotify = false) { NotifyFlags flags = NotifyFlags.NotifyNew | NotifyFlags.NotifyUpdate; if (immediateNotify) flags |= NotifyFlags.NotifyImmediate; AddTableListenerEx(key, listener, flags); }
public virtual void addSubTableListener(ITableListener itl) { List list = (List) this.listenerMap.get((object) itl); if (list == null) { list = new List(); this.listenerMap.put((object) itl, (object) list); } NetworkTableSubListenerAdapter subListenerAdapter = new NetworkTableSubListenerAdapter(this.path, this, itl); list.add((object) subListenerAdapter); this.node.addTableListener((ITableListener) subListenerAdapter, true); }
public void AddTableListenerEx(string key, ITableListener listener, NotifyFlags flags) { throw new NotImplementedException(); }
/// <summary> /// ctor /// </summary> /// <param name="comListener"></param> public NativeTableListener(ITableListener comListener, Session session) { mComListener = comListener; mSession = session; }
///<inheritdoc/> public void AddSubTableListener(ITableListener listener) { AddSubTableListener(listener, false); }
public void AddTableListener(string key, ITableListener listener, bool immediateNotify) { throw new NotImplementedException(); }