public DispatchableInstance(DispatchableType type, string name, Guid id, DispatchableSource source) { Type = type; Name = name; Id = id; Source = source; }
private void ValueDispatched(DispatchableType type, Guid nodeId, object value) { if (_nodeMap.ContainsKey(nodeId)) { _nodeMap[nodeId].DispatchValue(value); } }
public virtual IDictionary <Guid, object> GetValues(DispatchableType type) { lock (_lock) { if (NodeValues.ContainsKey(type)) { return(NodeValues[type]); } } return(new Dictionary <Guid, object>()); }
public object GetValue(DispatchableType type, Guid id) { lock (_lock) { if (NodeValues.ContainsKey(type) && NodeValues[type].ContainsKey(id)) { return(NodeValues[type][id]); } } return(null); }
public void RegisterDispatch(DispatchableType type, Guid id, Action <IDispatchable, object> callback) { if (!_registrationMap.ContainsKey(type)) { _registrationMap.Add(type, new ConcurrentDictionary <Guid, IList <Action <IDispatchable, object> > >()); } if (!_registrationMap[type].ContainsKey(id)) { _registrationMap[type].Add(id, new List <Action <IDispatchable, object> >()); } _registrationMap[type][id].Add(callback); }
public async Task RegisterDispatch(DispatchableType type, Guid id, Action <IDispatchable, object> callback) { var topic = $"{RemoteTopicConstants.DISPATCHER_TOPIC}/{type}/{id}"; _subscriptions.Add(topic); await _mqttClient.SubscribeAsync(topic, MQTTnet.Protocol.MqttQualityOfServiceLevel.AtLeastOnce); if (!_registrationMap.ContainsKey(type)) { _registrationMap.Add(type, new ConcurrentDictionary <Guid, IList <Action <IDispatchable, object> > >()); } if (!_registrationMap[type].ContainsKey(id)) { _registrationMap[type].Add(id, new List <Action <IDispatchable, object> >()); } _registrationMap[type][id].Add(callback); }
// Register a dispatcher from the control thread. public void RegisterDispatcher(DispatchableType dispatchableType, Dispatcher dispatcher) { _dispatchingMap[dispatchableType] = dispatcher; }
public async Task DispatchValue(DispatchableType type, Guid id, object value) { await _dataHub.Clients.Group("All").SendAsync("dispatchValue", type, id, value); await _dataHub.Clients.Group(id.ToString()).SendAsync("dispatchValue", type, id, value); }