public PromptForm(ref GHI.Glide.Display.Window window, ref Gadgeteer.Modules.GHIElectronics.DisplayTE35 displayTE35, ref SDCard sdCard, ref USBHost usbHost, ref USBClientEDP usbClientEDP, ref WiFiRS21 wifiRS21) : base(ref window) { this.usbClientEDP = usbClientEDP; this.usbHost = usbHost; this.sdCard = sdCard; this.displayTE35 = displayTE35; this.wifiRS21 = wifiRS21; }
public GvShell(ref SDCard sdCard, ref USBHost usbHost, ref DisplayTE35 displayT35, ref USBClientEDP usbClientEdp, ref WiFiRS21 wifiRS21) { //initial / default params ForeGround = GT.Color.White; BackGround = GT.Color.Black; ScreenWidth = 320; ScreenHeight = 240; this.wifiRS21 = wifiRS21; this.displayTE35 = displayT35; this.usbHost = usbHost; this.usbClientEDP = usbClientEdp; this.sdCard = sdCard; Screen = new Bitmap(ScreenWidth, ScreenHeight); ClearScreen(); MaxLine = ScreenHeight / 20; CurrentLine = 0; CurrentFont = Resources.GetFont(Resources.FontResources.NinaB); CurrentPath = "\\SD\\"; DataLines = new ArrayList(); for (int i = 0; i < MaxLine; i++) { DataLines.Add(string.Empty); } TypedCommand = string.Empty; if (basic == null) { if (basic == null) { basic = new SBASIC(); basic.Print += Basic_Print; basic.ClearScreen += Basic_ClearScreen; } } //setup network wifiRS21.DebugPrintEnabled = true; NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; //setup network wifiRS21.NetworkInterface.Open(); wifiRS21.NetworkInterface.EnableDhcp(); wifiRS21.NetworkInterface.EnableDynamicDns(); }
public void connectToWiFI(WiFiRS21 wifiRS21, string ssid, string password) { string pass = password; // public event EventHandler WiFiConnected; //WiFiRS9110.NetworkParameters net = new WiFiRS9110.NetworkParameters(); //net.SecurityMode = WiFiRS9110.SecurityMode.Wep; //net.Key = "tamarindo3579"; //net.Key = "74616D6172696E646F33353739"; //net.Ssid = "ProjecAndLab"; //net.NetworkType = WiFiRS9110.NetworkType.AccessPoint; //net.Channel = 6; //WiFiRS9110.NetworkParameters[] c = wifiRS21.NetworkInterface.Scan(); try { if (wifiRS21 == null || !(wifiRS21.IsNetworkConnected && wifiRS21.IsNetworkUp)) { Debug.Print("Try to connect"); if (!wifiRS21.NetworkInterface.Opened) { wifiRS21.NetworkInterface.Open(); } if (!wifiRS21.NetworkInterface.IsDhcpEnabled) { wifiRS21.NetworkInterface.EnableDhcp(); } WiFiRS9110.NetworkParameters[] nets = wifiRS21.NetworkInterface.Scan(ssid); if (nets.Length > 0) { if (nets[0].SecurityMode == GHI.Networking.WiFiRS9110.SecurityMode.Wep) { pass = HexToString(password); } if (nets[0].SecurityMode == GHI.Networking.WiFiRS9110.SecurityMode.Open) { pass = ""; } nets[0].Key = pass; wifiRS21.NetworkInterface.Join(nets[0]); while (wifiRS21.NetworkInterface.IPAddress == "0.0.0.0") { //Debug.Print(wifiRS21.NetworkInterface.IPAddress); } Debug.Print(wifiRS21.NetworkInterface.IPAddress); Debug.Print("Connected"); wifi_connected(new EventArgs()); } else { Debug.Print("Not found network"); } } } catch (Exception e) { Debug.Print(e.Message); } }