//public static Bitmap keyboardSymbol = new Bitmap(Resources.GetBytes(Resources.BinaryResources.keyboard), Bitmap.BitmapImageType.Bmp); //Image keyboard1 = new Image(keyboard); //public static Bitmap keyboardUpper = new Bitmap(Resources.GetBytes(Resources.BinaryResources.keyboard), Bitmap.BitmapImageType.Bmp); //Image keyboard1 = new Image(keyboard); // This method is run when the mainboard is powered up or reset. void ProgramStarted() { /******************************************************************************************* * Modules added in the Program.gadgeteer designer view are used by typing * their name followed by a period, e.g. button. or camera. * * Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.: * button.ButtonPressed +=<tab><tab> * * If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.: * GT.Timer timer = new GT.Timer(1000); // every second (1000ms) * timer.Tick +=<tab><tab> * timer.Start(); *******************************************************************************************/ timer = new GT.Timer(15000); timer.Tick += timer_Tick; Debug.Print("Program Started"); mainWindow = displayTE35.WPFWindow; mainWindow.Child = canvas; //InitEthernet(); SetupDisplay(); camera.BitmapStreamed += camera_BitmapStreamed; netif = new EthernetBuiltIn(); netif.Open(); netif.EnableStaticIP("169.254.202.65", "255.255.255.0", "169.254.202.73"); }
private Program() { OneTimeConfig(); _lcd = new Bitmap(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight); Touch.Initialize(this); this.MainWindow = new Window(); this.MainWindow.TouchDown += MainWindow_TouchDown; this.MainWindow.TouchUp += MainWindow_TouchUp; this.MainWindow.TouchMove += MainWindow_TouchMove; var eth = new EthernetBuiltIn(); eth.Open(); if (!eth.CableConnected) { eth.Close(); var wifi = new WiFiRS9110(SPI.SPI_module.SPI1, G400.PD13, G400.PD12, G400.PD15); _netif = wifi; _netif.Open(); wifi.Join("XXX", "XXX"); } else { _netif = eth; } if (!_netif.IsDhcpEnabled) _netif.EnableDhcp(); if (!_netif.IsDynamicDnsEnabled) _netif.EnableDynamicDns(); NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; }
void InitEthernet() { netif = new EthernetBuiltIn(); netif.Open(); netif.EnableDhcp(); netif.EnableDynamicDns(); while (netif.IPAddress == "0.0.0.0") { Debug.Print("Waiting for DHCP"); Thread.Sleep(250); } }
/// <summary>Constructs a new instance.</summary> /// <param name="socketNumber">The socket that this module is plugged in to.</param> public EthernetJ11D(int socketNumber) { Socket socket = Socket.GetSocket(socketNumber, true, this, null); socket.EnsureTypeIsSupported('E', this); socket.ReservePin(Socket.Pin.Four, this); socket.ReservePin(Socket.Pin.Five, this); socket.ReservePin(Socket.Pin.Six, this); socket.ReservePin(Socket.Pin.Seven, this); socket.ReservePin(Socket.Pin.Eight, this); socket.ReservePin(Socket.Pin.Nine, this); this.networkInterface = new EthernetBuiltIn(); this.NetworkSettings = this.networkInterface.NetworkInterface; }
/* * /// <summary>Whether or not the cable is inserted into the module. Make sure to also check the NetworkUp property to verify network state.</summary> * public override bool IsNetworkConnected { * get { * return this.networkInterface.CableConnected; * } * } */ /// <summary>Constructs a new instance.</summary> /// <param name="socketNumber">The socket that this module is plugged in to.</param> public EthernetJ11D(GHI.Processor.DeviceType deviceType, int socketNumber) { switch (deviceType) { case GHI.Processor.DeviceType.EMX: { } break; case GHI.Processor.DeviceType.G120E: { } break; default: { throw new NotSupportedException("Mainboard not supported!"); } } /* * Socket socket = Socket.GetSocket(socketNumber, true, this, null); * * socket.EnsureTypeIsSupported('E', this); * * socket.ReservePin(Socket.Pin.Four, this); * socket.ReservePin(Socket.Pin.Five, this); * socket.ReservePin(Socket.Pin.Six, this); * socket.ReservePin(Socket.Pin.Seven, this); * socket.ReservePin(Socket.Pin.Eight, this); * socket.ReservePin(Socket.Pin.Nine, this); */ this.networkInterface = new EthernetBuiltIn(); /* * this.NetworkSettings = this.networkInterface.NetworkInterface; */ }
private Program() { var eth = new EthernetBuiltIn(); eth.Open(); if (!eth.CableConnected) { eth.Close(); var wifi = new WiFiRS9110(SPI.SPI_module.SPI2, G120E.Gpio.P3_30, G120E.Gpio.P2_30, G120E.Gpio.P4_31); _netif = wifi; _netif.Open(); wifi.Join("XXX", "XXX"); } else { _netif = eth; } if (!_netif.IsDhcpEnabled) _netif.EnableDhcp(); if (!_netif.IsDynamicDnsEnabled) _netif.EnableDynamicDns(); NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; }
void ethernet_CableConnectivityChanged(object sender, EthernetBuiltIn.CableConnectivityEventArgs e) { Debug.Print("Built-in Ethernet Cable is " + (e.IsConnected ? "Connected!" : "Disconneced!")); if (e.IsConnected) NetworkAvailablityBlocking.Set(); else { screen.SimpleGraphics.Clear(); screen.SimpleGraphics.DisplayText("Ethernet cable was unplugged", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.White, 20, 20); } }
private NetworkInterface StartClient(string StaticIP) { Ethernet = new EthernetBuiltIn(); Ethernet.Open(); if (!Ethernet.IsCableConnected) { Debug.Print("Network cable is not connected!"); } NetworkInterface ni = Ethernet.NetworkInterface; if (StaticIP == string.Empty) { Debug.Print("Starting DHCP client."); if (!ni.IsDhcpEnabled) { ni.EnableDhcp(); } else { ni.RenewDhcpLease(); } Debug.Print("DHCP client started."); } else { Debug.Print("Using static IP."); ni.EnableStaticIP(StaticIP, NetMask, string.Empty); Debug.Print("Static IP enabled."); } ni.EnableDynamicDns(); NetworkInterfaceExtension.AssignNetworkingStackTo(Ethernet); return ni; }