Beispiel #1
0
        public static void Main()
        {
            //Start the server time setting thread.
            new Thread(() => NTP.UpdateTime()).Start();
            while (!NTP.timeSet)
            {
                Thread.Sleep(100);
            }
            Thread.Sleep(100);

            PowerManagment.SetPeripheralState(Peripheral.PowerLED, false);
            //Start the server itself.
            ServerConfiguration = new Configuration(8081);
            ServerCredential    = new Credential(new string[] { "Test" }, "/auth.htm", new string[] { "/auth.htm", "/img/Log-In.png", "/css/main.css", "/lib/GetInTemp.js", "/lib/Login.js" });
            Server = new HttpServer(ServerConfiguration, ServerCredential, 1024, 1024, @"\SD\htdocs");
            Server.OnServerError += new OnServerErrorDelegate(Server_OnServerError);
            AC        = new ACStatus(Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D10);
            commander = new IRCommands(IR, commands);
            timers    = new Timers(AC, tempSensor, commander);
            handler   = new requestHandler(@"\SD\htdocs", commander, tempSensor, AC, timers, ServerCredential);
            Server.OnRequestReceived += new OnRequestRecievedDelegate(handler.processRequest);
            Server.Start();

            //Start the temp management thread.
            new Thread(timers.tempControl).Start();
            //Blink LED three times to show we're up and running.
            for (int i = 0; i < 6; i++)
            {
                led.Write(!led.Read());
                Thread.Sleep(350);
            }
            led.Write(false);
        }
        public static void PrintLastWakeTime()
        {
            var returnValue = PowerManagment.GetLastWakeTime();
            var time        = GetDTCTime(returnValue);

            Console.WriteLine(time);
        }
        public static void SuspendState()
        {
            var result = PowerManagment.SetSuspendState(false);

            Console.WriteLine($"Suspend result = {result}");
        }
 public static void RemoveHiberFile()
 {
     PowerManagment.RemoveHiberFile();
 }
        public static void PrintSystemBatteryState()
        {
            var returnValue = PowerManagment.GetBatteryState();

            Console.WriteLine($"BatteryPresent={returnValue.BatteryPresent}, MaxCapacity={returnValue.MaxCapacity}, Rate={returnValue.Rate}, RemainingCapacity={returnValue.RemainingCapacity}, EstimatedTime={returnValue.EstimatedTime}, Discharging={returnValue.Discharging}, Charging={returnValue.Charging}, AcOnLine={returnValue.AcOnLine}");
        }
        public static void PrintSystemPowerInformation()
        {
            var returnValue = PowerManagment.GetPowerInformation();

            Console.WriteLine($"TimeRemaining = {returnValue.TimeRemaining}, MaxIdlenessAloowed = {returnValue.MaxIdlenessAllowed}, Idleness = {returnValue.Idleness}, CoolingMode = {returnValue.CoolingMode}");
        }