예제 #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .AddGatewayConfiguration();

            IConfigurationRoot root = builder.Build();

            EdgeGatewayConfiguration config = new EdgeGatewayConfiguration();

            ConfigurationBinder.Bind(root, config);

            CommunicationDirector.Create(config);  //create the singleton instance

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc(routes =>
            {
                routes.MapRoute("default", "{controller=RtuOutput}/{action=Index}/{id?}");
            });

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync("Field Gateway Service Running...");
            });
        }
예제 #2
0
        //private string requestUrl; // = "http://echomodule:8889/api/rtuinput";


        public RtuOutputController(EdgeGatewayConfiguration config, ILogger <RtuOutputController> logger)
        {
            this.logger = logger;
            try
            {
                director = CommunicationDirector.Create(config);
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
            }
        }