Пример #1
0
 public static void AddNEEO(this IServiceCollection services, IConfiguration neeoConf)
 {
     if (neeoConf != null && neeoConf["Enabled"] == "True")
     {
         List <IBuildDevice> neeoDevices = new List <IBuildDevice>();
         neeoDevices.Add(new NEEOTestDevice());
         neeoDevices.Add(new NEEOLight(false,
                                       new string[] { "HomeMatic", "HomeMatic", "HomeMatic", "HomeMatic", "Lightify", "HomeMatic" },
                                       new string[] { "Wohnzimmer Links", "Wohnzimmer Mitte", "Wohnzimmer Rechts", "Arbeitsplatz", "Terrasse" },
                                       new string[] { "Wohnzimmer Links", "Wohnzimmer Mitte", "Wohnzimmer Rechts", "Arbeitsplatz", "Terrasse" })
                         );
         neeoDevices.Add(new NEEOClima());
         neeoDevices.Add(new NEEOTV());
         IDiscover discover = null;
         if (neeoConf["BrainIPAddress"] != null)
         {
             discover = new DiscoverModule("MyBrain", neeoConf["BrainIPAddress"], Int32.Parse(neeoConf["BrainPort"]), "1.0", "de-at", new string[] { neeoConf["BrainIPAddress"] });
         }
         else
         {
             discover = new DiscoverModule(new NEEODiscover());
         }
         services.AddSingleton <NeeoService>((provider) => {
             ILogger <NeeoService> logger = provider.GetService <ILogger <NeeoService> >();
             return(new NeeoService(neeoConf["Name"], discover, neeoDevices, logger, Boolean.Parse(neeoConf["Simulation"])));
         });
     }
 }
Пример #2
0
        public NeeoService(string name, IDiscover discover, IEnumerable <IBuildDevice> devices, ILogger logger, bool isSimulation) :
            base(new NewtonSoftJson(true, false, true, true), logger: logger)
        {
            _name    = name;
            _devices = devices;

            NEEOEnvironment.Logger       = _logger = logger;
            NEEOEnvironment.RestClient   = this;
            NEEOEnvironment.MachineName  = Environment.MachineName;
            NEEOEnvironment.IsSimulation = isSimulation;
        }
Пример #3
0
 public DiscoverModule(IDiscover discover)
 {
     _discover = discover;
     _instance = this;
 }