internal Generator(GpioCore _core, EventConfig _config, ILogger _logger) { Logger = _logger; Core = _core; Config = _config; Driver = PinController.GetDriver() ?? throw new DriverNotInitializedException(); Init(); }
public static async Task Main(string[] args) { var pins = new AvailablePins(new int[10], new int[10], new int[10], new int[10], new int[10], new int[10]); GpioCore = new GpioCore(pins, false); WebHost = CreateHostBuilder().Build(); await WebHost.StartAsync().ConfigureAwait(false); WebHost.WaitForShutdown(); }
internal Core(string[] args) { Console.Title = $"Initializing..."; Logger = InternalLogger.GetOrCreateLogger <Core>(this, nameof(Core)); OS.Init(true); RuntimeSpanCounter.Restart(); File.WriteAllText("version.txt", Constants.Version?.ToString()); ParseStartupArguments(); if (File.Exists(Constants.TraceLogFile)) { File.Delete(Constants.TraceLogFile); } Config = new CoreConfig(this); Config.LoadAsync().Wait(); IsUpdatesAllowed = !NoUpdates && Config.AutoUpdates; Config.LocalIP = Helpers.GetLocalIpAddress()?.ToString() ?? "-Invalid-"; Config.PublicIP = Helpers.GetPublicIP()?.ToString() ?? "-Invalid-"; if (!IsNetworkAvailable) { Logger.Warn("No Internet connection."); Logger.Info($"Starting offline mode..."); } Pins = new PinsWrapper( Config.GpioConfiguration.OutputModePins, Config.GpioConfiguration.InputModePins, Constants.BcmGpioPins, Config.GpioConfiguration.RelayPins, Config.GpioConfiguration.InfraredSensorPins, Config.GpioConfiguration.SoundSensorPins ); Controller = new GpioCore(Pins, this, Config.GpioConfiguration.GpioSafeMode); ModuleLoader = new ModuleLoader(); RestServer = new RestCore(Config.RestServerPort, Config.Debug); JobManager.AddJob(() => SetConsoleTitle(), (s) => s.WithName("ConsoleUpdater").ToRunEvery(1).Seconds()); Logger.CustomLog(FiggleFonts.Ogre.Render("LUNA"), ConsoleColor.Green); Logger.CustomLog($"---------------- Starting Luna v{Constants.Version} ----------------", ConsoleColor.Blue); IsBaseInitiationCompleted = true; PostInitiation().Wait(); InternalConfigWatcher = new ConfigWatcher(this); InternalModuleWatcher = new ModuleWatcher(this); InitiationCompleted = true; }
internal SoundController(GpioCore gpioCore) { Controller = gpioCore; aMixerInterfacer = new aMixerCommandInterfacer(false, false, false); }
internal BluetoothController(GpioCore _controller) => Controller = _controller;
internal PinController(GpioCore _controller) => Controller = _controller;
internal SoundController(GpioCore _controller) => Controller = _controller;
internal EventManager(GpioCore _core) => Core = _core;
internal PinController(GpioCore core) => Controller = core;
public GpioController(GpioCore _gpioCore) { GpioCore = _gpioCore; Debug.WriteLine($"{nameof(_gpioCore)} assigned!"); }