public static bool EventHasSubscriber(this IRelayService relayService, string eventName)
    {
        var eventField = relayService.GetType().GetField(eventName + "Event",
                                                         BindingFlags.Public | BindingFlags.Instance);
        object object_value = eventField.GetValue(relayService);

        return(object_value != null);
    }
Пример #2
0
 public ThermostatService(ThermostatConfig thermostatConfig,
                          ITemperatureService temperatureService,
                          IRelayService relayService,
                          MomitKillerDbContext db)
 {
     _thermostatConfig   = thermostatConfig;
     _temperatureService = temperatureService;
     _relayService       = relayService;
     _db = db;
 }
 public ControlHostedService
 (
     IEventHub eventHub,
     IRelayService relayService,
     IHostApplicationLifetime applicationLifetime,
     ILogger <ControlHostedService> logger
 )
 {
     _eventHub            = eventHub;
     _relayService        = relayService;
     _applicationLifetime = applicationLifetime;
     _logger = logger;
 }
Пример #4
0
        static Addressable()
        {
            string relayAddress = $"tcp://localhost:{RELAY_PORT}/relay.rem";

            _relayProxy = (IRelayService)RemotingServices.Connect(typeof(IRelayService), relayAddress);
        }
Пример #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              ILoggerFactory loggerFactory,
                              IMappingService mappingService,
                              IRuntimeCompilerService runtimeCompilerService,
                              IAuthenticationService authService,
                              IRelayService relayService
                              )
        {
            var globalConfig = Configuration.GetSection("Global");

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (globalConfig.GetValue("UseLogFiles", true))
            {
                loggerFactory.AddNLog();

                env.ConfigureNLog("nlog.config");  // <- Throws ArgumentNullException in productive environment
                //LogManager.Configuration = new XmlLoggingConfiguration("nlog.config", true);  // <- Workaround for ArgumentNullException
            }

            runtimeCompilerService.Configure(Configuration.GetSection("RuntimeCompiler"));
            runtimeCompilerService.Init();

            mappingService.Configure(Configuration.GetSection("Plc"));
            mappingService.Init();

            authService.Configure(Configuration.GetSection("Auth"));
            authService.Init();

            app.UseWebPackAuth();

            app.UseCors(options =>
            {
                options.AllowAnyHeader();
                options.AllowAnyMethod();
                options.AllowAnyOrigin();
                options.AllowCredentials();
            });


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


            if (globalConfig.GetValue("UseSignalR", true))
            {
                relayService.Init();

                if (globalConfig.GetValue("UseWebSockets", true))
                {
                    app.UseWebSockets();
                }
                app.UseSignalR();
            }


            app.UseMvc();

            //Not supported at the moment
            if (globalConfig.GetValue("UseSwagger", true))
            {
                app.UseSwagger();
                app.UseSwaggerUi();
            }
        }
Пример #6
0
 public SubscriptionController(ISubscriptionService subscriptionService, IRelayService relayService, IMapper mapper)
 {
     _subscriptionService = subscriptionService;
     _relayService        = relayService;
     _mapper = mapper;
 }
Пример #7
0
 public RelayController(IRelayService relayservice, IMailService mailService)
 {
     _relayService = relayservice;
     _mailService  = mailService;
 }
Пример #8
0
 public RelaysController(IRelayService relayService, IHubContext <RelayHub> relayHubContext)
 {
     _relayService    = relayService;
     _relayHubContext = relayHubContext;
 }