static void Main(string[] args) { var appConfig = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .Build(); string endpointLocation = appConfig.GetValue <string>("Endpoint"); StreamConfiguration streamConfig = appConfig.GetSection(StreamConfiguration.SECTION_NAME).Get <StreamConfiguration>(); host = new DeviceHost(streamConfig, endpointLocation, (message) => Console.WriteLine(message)); RunAsync(); }
public DeviceHost(StreamConfiguration streamConfig, string endpoint, Action <string> log) { this.streamConfig = streamConfig; this.endpoint = endpoint; this.log = log; var factory = new ConnectionFactory() { HostName = this.streamConfig.HostName, VirtualHost = this.streamConfig.VirtualHost, UserName = this.streamConfig.Username, Password = this.streamConfig.Password }; connection = factory.CreateConnection(); model = connection.CreateModel(); }
public SensorSimulation(IModel model, StreamConfiguration streamConfig) { this.model = model; this.streamConfig = streamConfig; }