public ThingChannel(IThingChannelHandler thingChannelHandler, ThingId thingId, IMessageHub messageHub) { _thingChannelHandler = thingChannelHandler; _messageHub = messageHub; Id = new ThingChannelId(thingId, Name); _state = new SynchronizedValue <ThingState>(); }
private async Task AddChannel(IThingChannelHandler thingChannelHandler) { if (!_thingTemplate.IsChannelDefined(thingChannelHandler.Name)) { return; } Log.Info($"Channel handler '{thingChannelHandler.Name}' added"); var thingChannel = await _thingChannelBuilder.Build(thingChannelHandler, this); _channels.Add(thingChannel); }
public async Task <ThingChannel> Build(IThingChannelHandler thingChannelHandler, IThing thing) { var thingChannel = new ThingChannel(thingChannelHandler, thing.Id, _messageHub); await thingChannelHandler.SetupAsync(_messageHub).ConfigureAwait(false); await _thingChannelRepository.AddAsync(thingChannel).ConfigureAwait(false); await thingChannel.InitAsync().ConfigureAwait(false); await thingChannelHandler.InitAsync().ConfigureAwait(false); return(thingChannel); }
public NewThingChannelMessage(string thingId, IThingChannelHandler thingChannelHandler) { ThingId = thingId; ThingChannelHandler = thingChannelHandler; }