/// <summary> /// Sets the display configuration. This must be called by all display module constructors (even ones not using LCD displays) /// </summary> /// <param name="displayConfig">The display configuration.</param> protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig) { if (_numDisplaysConstructed != _numDisplaysConfigured + 1) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig() once."); } if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0)) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display"); } _numDisplaysConfigured++; _displayModuleToBeConfigured._config = displayConfig; if (displayConfig.LCDControllerEnabled) { if (_lcdControllerConfig != null) { if (_lcdControllerConfig == lcdPinsUsedAsIOs) { DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display"); } else { DisplayError("ERROR: Cannot use more than one LCD controller based display at a time"); } } _lcdControllerConfig = displayConfig; Mainboard.SetLCDConfiguration(displayConfig); } }
static void Main() { var hardwareOptions = new HardwareOptions() { BoardModel = BoardModel.Sc20260D }; var MainBoard = new Mainboard(hardwareOptions).Connect(); MainBoard.Network.Enabled(); var loggerFactory = new LoggerFactory(); loggerFactory.AddDebug(LogLevel.Trace); IServer server = new SocketServer(loggerFactory, options => { options.Pipeline(app => { app.UseMemoryInfo(); app.UseHttpResponse(); }); }); server.Start(); }
private void Test() { Debug.Print("Program started - memory = " + Debug.GC(false)); var isInserted = Mainboard.IsSDCardInserted; var isMounted = Mainboard.IsSDCardMounted; if (!isMounted) { Mainboard.MountStorageDevice(@"SD"); } var mb = Mainboard; var sd = mb.SDCardStorageDevice; var vi = sd.Volume; //vi.Format("FAT", 0, "TEST", true); vi.Refresh(); var totalSize = vi.TotalSize; var freeSpace = vi.TotalFreeSpace; Debug.Print("totalSize = " + totalSize); Debug.Print("freeSpace = " + freeSpace); for (var preAlloc = 20000; preAlloc < 40000; preAlloc += 1000) { Thread.Sleep(250); Debug.GC(true); RunTests(preAlloc); } }
static void Main() { var hardwareOptions = new HardwareOptions() { BoardModel = BoardModel.Sc20260D }; var mainBoard = new Mainboard(hardwareOptions).Connect(); mainBoard.Network.Enabled(); var server = new HttpServer(options => { options.Pipeline(app => { app.UseMemoryInfo(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.Map("/", context => { string response = "<doctype !html><html><head><title>Hello, world!" + "</title><meta http-equiv='refresh' content='5'></head><body>" + "<h1>" + DateTime.Now.Ticks.ToString() + "</h1></body></html>"; context.Response.Write(response); }); }); }); }); server.Start(); }
static void Main(string[] args) { var mainboard = new Mainboard(); Console.WriteLine(mainboard.Smbios.BIOS.Vendor); var cpu = Cpu.Discover(); foreach (var item in cpu) { Print(item.CoreTemperatures); Print(item.CoreClocks); Print(item.CorePowers); Print(item.CoreVoltages); Print(item.CoreClocks); } var hdd = HardDrive.Discover(); foreach (var item in hdd) { foreach (var smart in item.SmartSensors) { Console.WriteLine(smart.Key.Name); Print(new[] { smart.Value }); } } Console.ReadKey(); }
void ProgramStarted() { Thread input = new Thread(InputThread); Mainboard.SetMotorInversion(true, true); input.Start(); }
public void Think(Mainboard mainboard) { FetchInstruction(mainboard.GetRAM()); ExecuteInstruction(mainboard); IncrementPC(); }
public Mainboard GetByID(string id) { Mainboard proList = new Mainboard(); var query = (from prods in context.Mainboards where prods.MaMain == id select prods).ToList(); foreach (var item in query) { proList = new Mainboard { MaMain = item.MaMain, HangSX = item.HangSX, Model = item.Model, Socket = item.Socket, RamToiDa = Convert.ToInt32(item.RamToiDa), PCI = item.PCI, SoKheRam = Convert.ToInt32(item.SoKheRam), Giaban = Convert.ToInt32(item.Giaban), DanhGia = Convert.ToInt32(item.DanhGia), Diem = Convert.ToInt32(item.Diem), URL = item.URL, LoaiRamToiDa = item.LoaiRamToiDa }; } return(proList); }
private void SetupData() { _mainboardException = false; _win32BaseBoardException = false; _win32MotherboardDeviceException = false; _includes = new List <string>(); _mainboard1 = new Mainboard { ID = 1, SetID = new Guid(new string('0', 32)), Deleted = true, Manufacturer = "Manufacturer1", Model = "Model1", PrimaryBusType = "PrimaryBusType1", SecondaryBusType = "SecondaryBusType1" }; _mainboard2 = new Mainboard { ID = 2, SetID = new Guid(new string('1', 32)), Deleted = false, Manufacturer = "Manufacturer2", Model = "Model2", PrimaryBusType = "PrimaryBusType2", SecondaryBusType = "SecondaryBusType2" }; _mainboard3 = new Mainboard { ID = 3, SetID = new Guid(new string('0', 32)), Deleted = false, Manufacturer = "Manufacturer3", Model = "Model3", PrimaryBusType = "PrimaryBusType3", SecondaryBusType = "SecondaryBusType3" }; _mainboards = new List <Mainboard> { _mainboard1, _mainboard2, _mainboard3 }; _win32BaseBoard1 = new Win32_BaseBoard { Manufacturer = "Manufacturer1", Product = "Product1" }; _win32BaseBoards = new List <Win32_BaseBoard> { _win32BaseBoard1 }; _win32MotherboardDevice1 = new Win32_MotherboardDevice { PrimaryBusType = "PrimaryBusType1", SecondaryBusType = "SecondaryBusType1" }; _win32MotherboardDevices = new List <Win32_MotherboardDevice> { _win32MotherboardDevice1 }; }
/// <summary> /// Adds and configures hardware support. /// </summary> public static IHostBuilder ConfigureHardware(this IHostBuilder builder, HardwareOptionsDelegate options) { var hardware = new Mainboard(options).Connect(); builder.ConfigureServices((context, services) => services.AddSingleton(typeof(IHardware), hardware)); return(builder); }
/// <summary>Attempts to unmount the card.</summary> /// <returns>Whether or not the card was successfully unmounted.</returns> public bool Unmount() { if (!this.IsCardMounted) { throw new InvalidOperationException("The card is already unmounted."); } return(!Mainboard.UnmountStorageDevice("SD")); }
/// <summary>Attempts to unmount the mass storage device.</summary> /// <returns>Whether or not the mass storage device was successfully unmounted.</returns> public bool UnmountMassStorage() { if (!this.IsMassStorageMounted) { throw new InvalidOperationException("The mass storage is not mounted."); } return(Mainboard.UnmountStorageDevice("USB")); }
public static string View(Mainboard mainboard, ModelStateDictionary modelstate = default) { ValidateMainboard(mainboard); string view = default; view += RenderView(mainboard, modelstate); return(view); }
public IHttpActionResult Put(Mainboard main) { if (main.MaMain == null) { return(BadRequest()); } context.Entry(main).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
public static Mainboard From(Win32_BaseBoard win32BaseBoard, Win32_MotherboardDevice win32MotherboardDevice) { var output = new Mainboard(); output.Manufacturer = win32BaseBoard.Manufacturer; output.Model = win32BaseBoard.Product; output.PrimaryBusType = win32MotherboardDevice.PrimaryBusType; output.SecondaryBusType = win32MotherboardDevice.SecondaryBusType; return(output); }
public void Delete(string MaMain) { if (MaMain == null) { throw new ArgumentNullException(); } Mainboard main = context.Mainboards.SingleOrDefault(m => m.MaMain == MaMain); context.Mainboards.Remove(main); context.SaveChanges(); }
private static void DisplayError(string message) { Debug.Print(message); while (true) { Mainboard.SetDebugLED(true); Thread.Sleep(200); Mainboard.SetDebugLED(false); Thread.Sleep(200); } }
void timer_Tick(GT.Timer timer) { var isButtonPressed = _digitalInput.Read(); Mainboard.SetDebugLED(isButtonPressed); _digitalOutput.Write(isButtonPressed); _digitalOutput2.Write(_analogValue); Debug.Print("signal measured: " + _digitalInput2.Read().ToString()); _analogValue = !_analogValue; }
public void Post(Mainboard main) { string ID = "MA"; Mainboard MainLast = new Mainboard(); MainLast = context.Mainboards.OrderByDescending(r => r.MaMain).FirstOrDefault(); string temp = MainLast.MaMain.ToString().Substring(2); temp = (Int32.Parse(temp) + 1).ToString(); if (temp.Count() == 4) { ID = ID + int.Parse(temp); } else if (temp.Count() == 3) { ID = ID + "0" + int.Parse(temp); } else if (temp.Count() == 2) { ID = ID + "00" + int.Parse(temp); } else { ID = ID + "000" + int.Parse(temp); } main.MaMain = ID; Mainboard MainNeedAdd = new Mainboard { MaMain = main.MaMain, HangSX = main.HangSX, Model = main.Model, Socket = main.Socket, RamToiDa = Convert.ToInt32(main.RamToiDa), PCI = main.PCI, SoKheRam = Convert.ToInt32(main.SoKheRam), Giaban = Convert.ToInt32(main.Giaban), DanhGia = Convert.ToInt32(main.DanhGia), Diem = Convert.ToInt32(main.Diem), URL = main.URL, LoaiRamToiDa = main.LoaiRamToiDa }; if (main == null) { throw new ArgumentNullException(); } context.Mainboards.Add(MainNeedAdd); context.SaveChanges(); }
/// <summary> /// Sets the LCD rotation to use. This must be called before WPF is used. /// </summary> /// <param name="rotation">The rotation to use.</param> /// <returns>true if this rotation is supported, false otherwise.</returns> public bool SetLCDRotation(LCDRotation rotation) { if (_lcdControllerConfig != _config) { throw new InvalidOperationException("Cannot set LCD rotation on displays that are not LCD controller based"); } if (_wpfWindow != null || _simpleGraphics != null) { throw new InvalidOperationException("Cannot set LCD rotation once SimpleGraphics or WPF is used"); } return(Mainboard.SetLCDRotation(rotation)); }
protected static void ValidateMainboard(Mainboard mainboard) { if (mainboard is null) { throw new Exception(message: "mainboard is null"); } if (mainboard.AutoviewDto is null) { throw new Exception(message: "autoview dto is null"); } }
/// <summary>Attempts to mount the mass storage device.</summary> /// <returns>Whether or not the mass storage device was successfully mounted.</returns> public bool MountMassStorage() { if (this.IsMassStorageMounted) { throw new InvalidOperationException("The mass storage is already mounted."); } if (!this.IsMassStorageConnected) { throw new InvalidOperationException("There is no mass storage device connected."); } return(Mainboard.MountStorageDevice("USB")); }
/// <summary> /// Called when a pin otherwise used for the LCD controller is reserved for another module /// We have to ensure the LCD controller pins are disabled so they can be reused /// </summary> internal static void LCDControllerPinReuse() { if (_lcdControllerConfig != null && _lcdControllerConfig.LCDControllerEnabled) { DisplayError("ERROR: Cannot use LCD controller pins as IOs simultaneously with using them to drive a display"); } Mainboard.SetLCDConfiguration(lcdPinsUsedAsIOs); // this will reboot if necessary if (_lcdControllerConfig == null) { _lcdControllerConfig = lcdPinsUsedAsIOs; } }
protected static string RenderView(Mainboard mainboard, ModelStateDictionary modelstate) { var properties = Property.InitPropertiesOfDto(mainboard, modelstate); string view = Validation.Initial.ValidationSummeryRender(modelstate)?.BoardElement?.Rendered; foreach (var property in properties) { view += Partition.OrganizeSection(elementProperty: property); } return(view); }
/* * UNLOCK DOOR * Called by either PinFound or TagFound to unlock the door. */ private void UnlockDoor() { // Authorize access authorizedAccess = true; unlockTimerRunning = true; unlockedTimer.Restart(); // Blink LED Mainboard.SetDebugLED(true); System.Threading.Thread.Sleep(200); Mainboard.SetDebugLED(false); }
// -= Move =- // MOV DST VALUE // Gets next memory address for DST // Moves value in next memory address to DST public override void Execute(Mainboard mainboard) { mainboard.GetCPU().IncrementPC(); mainboard.GetCPU().FetchInstruction(mainboard.GetRAM()); CPURegister dst = mainboard.GetCPU().GetRegister(mainboard.GetCPU().GetInstruction()); mainboard.GetCPU().IncrementPC(); mainboard.GetCPU().FetchInstruction(mainboard.GetRAM()); byte src = mainboard.GetCPU().GetInstruction(); byte result = (byte)(dst.GetByteValue() + src); mainboard.GetCPU().SetRegister(dst.GetRegisterID(), result); }
// -------------------------------- Sensori -------------------------------- // private void InitSensors() { Mainboard.SetDebugLED(true); Gadgeteer.Socket socket = Gadgeteer.Socket.GetSocket(8, true, null, null); buzzer = new PWM(Cpu.PWMChannel.PWM_4, 1000, 0.5, false); buzzer.Stop(); orizzontal_mov = extender.CreatePwmOutput(Gadgeteer.Socket.Pin.Seven); vertical_mov = extender.CreatePwmOutput(Gadgeteer.Socket.Pin.Nine); current_orizzontal_pos = 0.075; current_vertical_pos = 0.075; orizzontal_mov.Set(50, current_orizzontal_pos); Thread.Sleep(2000); vertical_mov.Set(50, current_vertical_pos); }
void InputThread() { GT.Socket socket = GT.Socket.GetSocket(5, true, null, null); //Mainboard.TurnOnLed(6); DigitalInput p7 = DigitalInputFactory.Create(socket, GT.Socket.Pin.Three, GlitchFilterMode.Off, ResistorMode.PullDown, breakout); //Mainboard.TurnOnLed(7); DigitalInput p8 = DigitalInputFactory.Create(socket, GT.Socket.Pin.Four, GlitchFilterMode.Off, ResistorMode.PullDown, breakout); //Mainboard.TurnOnLed(8); DigitalInput p9 = DigitalInputFactory.Create(socket, GT.Socket.Pin.Five, GlitchFilterMode.Off, ResistorMode.PullDown, breakout); //Mainboard.TurnOnLed(9); while (true) { int spd = 50; string cmd = GetCommand(p7, p8, p9); //Debug.Print("CMD " + cmd); switch (cmd) { case "STOP": Mainboard.SetMotorSpeed(0, 0); break; case "GO": Mainboard.SetMotorSpeed(spd, spd); break; case "LEFT": Mainboard.SetMotorSpeed(spd, -spd); break; case "RIGHT": Mainboard.SetMotorSpeed(-spd, spd); break; case "BACK": Mainboard.SetMotorSpeed(-spd, -spd); break; default: Mainboard.SetMotorSpeed(0, 0); break; } } }
private void resetAll(object sender) { lock (myLock)//altrimenti puo provare lanciare thread mentre tolgo handler { timerSend.Tick -= sendData; timerMain.Tick -= DrawMainWindow; timerRetryServer.Tick -= RetryServer; ResetNoAlarm.Tick -= ActivateAlarm; timerMain.Stop(); timerRetryServer.Stop(); timerSend.Stop(); ResetNoAlarm.Stop(); Mainboard.PostInit(); ShowConnectionWindow(); } }
// -= Addition =- // ADD DST SRC // Gets next memory address for DST // Gets next memory address for SRC // Adds SRC to DST public override void Execute(Mainboard mainboard) { mainboard.GetCPU().IncrementPC(); mainboard.GetCPU().FetchInstruction(mainboard.GetRAM()); CPURegister dst = mainboard.GetCPU().GetRegister(mainboard.GetCPU().GetInstruction()); mainboard.GetCPU().IncrementPC(); mainboard.GetCPU().FetchInstruction(mainboard.GetRAM()); CPURegister src = mainboard.GetCPU().GetRegister(mainboard.GetCPU().GetInstruction()); byte[] dstValue = dst.GetValue(); Maths.AddArray(ref dstValue, dstValue.Length, src.GetValue()[0]); mainboard.GetCPU().SetRegister(dst.GetRegisterID(), dstValue); }
public static void Main(params string[] args) { var mainWindow = new MainWindow(); var map = new Map(); var viewmodel = new Viewmodel(); var mainboard = new Mainboard( viewmodel, new Throttle<string>(500), new GoogleTranslate(), new Synchronizer<string>(), map); mainWindow.SuchControl.Inject(viewmodel); map.Inject(viewmodel); var app = new Application { MainWindow = mainWindow }; app.Run(mainWindow); }
public MainboardGroup(ISettings settings) { mainboards = new Mainboard[1]; mainboards[0] = new Mainboard(settings); }
/// <summary> /// Sets the display configuration. This must be called by all display module constructors (even ones not using LCD displays) /// </summary> /// <param name="displayConfig">The display configuration.</param> protected static void SetLCDConfig(Mainboard.LCDConfiguration displayConfig) { if (_numDisplaysConstructed != _numDisplaysConfigured + 1) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: All display module constructors must call DisplayModule.SetLCDConfig()"); } if (displayConfig != Mainboard.LCDConfiguration.HeadlessConfig && (displayConfig.Height == 0 || displayConfig.Width == 0)) { DisplayError("ERROR IN DISPLAY MODULE DRIVER: LCDConfiguration must specify Height and Width of display"); } _numDisplaysConfigured++; _displayModuleToBeConfigured._config = displayConfig; if (displayConfig.LCDControllerEnabled) { if (_lcdControllerConfig != null) { if (_lcdControllerConfig == lcdPinsUsedAsIOs) { DisplayError("ERROR: Cannot use LCD controller pins as IOs and also use an LCD controller based display"); } else { DisplayError("ERROR: Cannot use more than one LCD controller based display at a time"); } } _lcdControllerConfig = displayConfig; Mainboard.SetLCD(displayConfig); // this reboots if necessary LCDControllerEnabled = true; // known issue: this does not check all settings match (will be fixed in the NETMF 4.2 version) if (SystemMetrics.ScreenWidth != displayConfig.Width || SystemMetrics.ScreenHeight != displayConfig.Height) DisplayReboot(); } }
public MainboardGroup(SMBIOS smbios, ISettings settings) { mainboards = new Mainboard[1]; mainboards[0] = new Mainboard(smbios, settings); }
public static void Run() { var viewmodel = new ToDoListe(); var datamodel = new contracts.datamodel.ToDoListe(); var toDo_ergänzen = new ToDo_ergänzen(); var toDo_löschen = new ToDo_löschen(); var toDo_Bearbeitung_beenden = new ToDo_Bearbeitung_beenden(); var toDo_Bearbeitung_beginnen = new ToDo_Bearbeitung_beginnen(); var main = new Main(); var lokale_ToDo_Liste_speichern = new Lokale_ToDo_Liste_speichern(); var lokale_ToDo_Liste_laden = new Lokale_ToDo_Liste_laden(); var toDo_Liste_speichern = new ToDo_Liste_speichern( new Throttle<contracts.datamodel.ToDoListe>(500), lokale_ToDo_Liste_speichern, new Synchronizer<string>()); var toDo_Liste_in_ViewModel_übersetzen = new ToDo_Liste_in_ViewModel_uebersetzen(); var selektierte_Ids_ermitteln = new Selektierte_Ids_ermitteln(); var selektiertes_ToDo_ermitteln = new Selektiertes_ToDo_ermitteln(); var geöffnetes_ToDo_ermitteln = new Geöffnetes_ToDo_ermitteln(); var toDo_Erledigt = new ToDo_erledigt(); var toDos_filtern = new ToDos_filtern(); var simpleDb = new SimpleDb(); var toDo_Listen_Synchronisieren = new ToDo_Listen_synchronisieren(); var toDo_Liste_Synchronisieren = new ToDo_Liste_synchronisieren( new Asynchronizer(), new Remote_ToDo_Liste_laden(simpleDb), toDo_Listen_Synchronisieren, new Synchronizer<contracts.datamodel.ToDoListe>(), new Remote_ToDo_Liste_speichern(simpleDb), toDo_Liste_speichern, toDo_Liste_in_ViewModel_übersetzen); var toDo_Liste_laden = new ToDo_Liste_laden(lokale_ToDo_Liste_laden, toDo_Liste_in_ViewModel_übersetzen); var neues_ToDo_anlegen = new Neues_ToDo_anlegen(toDo_ergänzen, toDo_Liste_in_ViewModel_übersetzen, toDo_Liste_speichern); var selektierte_ToDos_löschen = new Selektierte_ToDos_löschen(selektierte_Ids_ermitteln, toDo_löschen, toDo_Liste_in_ViewModel_übersetzen, toDo_Liste_speichern); var geöffnetes_ToDo_schließen = new Geöffnetes_ToDo_schließen(geöffnetes_ToDo_ermitteln, toDo_Bearbeitung_beenden, toDo_Liste_in_ViewModel_übersetzen, toDo_Liste_speichern); var selektiertes_ToDo_öffnen = new Selektiertes_ToDo_öffnen(selektiertes_ToDo_ermitteln, toDo_Bearbeitung_beginnen, toDo_Liste_in_ViewModel_übersetzen, toDo_Liste_speichern); var geändertes_ToDo_speichern = new Selektiertes_ToDo_erledigt(toDo_Erledigt, toDo_Liste_in_ViewModel_übersetzen, toDo_Liste_speichern); var toDo_Liste_filtern = new ToDo_Liste_filtern(toDos_filtern, toDo_Liste_in_ViewModel_übersetzen); var theEntryPoint = new TheEntryPoint(); var mainboard = new Mainboard( theEntryPoint, viewmodel, toDo_Liste_speichern, toDo_Liste_laden, neues_ToDo_anlegen, selektierte_ToDos_löschen, geöffnetes_ToDo_schließen, selektiertes_ToDo_öffnen, geändertes_ToDo_speichern, toDo_Liste_filtern, toDo_Liste_Synchronisieren, main); main.Inject(viewmodel); toDo_Liste_in_ViewModel_übersetzen.Inject(viewmodel); selektierte_Ids_ermitteln.Inject(viewmodel); selektiertes_ToDo_ermitteln.Inject(viewmodel); geöffnetes_ToDo_ermitteln.Inject(viewmodel); toDo_ergänzen.Inject(datamodel); toDo_löschen.Inject(datamodel); toDo_Bearbeitung_beenden.Inject(datamodel); toDo_Bearbeitung_beginnen.Inject(datamodel); toDo_Erledigt.Inject(datamodel); lokale_ToDo_Liste_laden.Inject(datamodel); toDo_Listen_Synchronisieren.Inject(datamodel); toDos_filtern.Inject(datamodel); theEntryPoint.Run(); main.ShowDialog(); }
private static void Main(string[] args) { var mainboard = new Mainboard(); mainboard.Run(); }