Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public SensorSimulation(IModel model, StreamConfiguration streamConfig)
 {
     this.model        = model;
     this.streamConfig = streamConfig;
 }