private void but_hwids_Click(object sender, EventArgs e) { string value = "0"; if (InputBox.Show("hwid", "Enter the ID number", ref value, false, true) == DialogResult.OK) { StringBuilder sb = new StringBuilder(); var items = value.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in items) { var items2 = item.Split(new char[] { ' ', '\t' }); foreach (var item2 in items2) { uint uintvalue = 0; if (uint.TryParse(item2, out uintvalue)) { Device.DeviceStructure test1 = new Device.DeviceStructure(uintvalue); sb.AppendLine(item.Replace('\t', ' ') + " = " + test1.ToString()); } } } CustomMessageBox.Show(sb.ToString()); } }
public void Activate() { if (!MainV2.comPort.BaseStream.IsOpen) { Enabled = false; } Enabled = true; var all_dev_ids = MainV2.comPort.MAV.param.Where(a => a.Name.Contains("_ID")); var b = 0; foreach (var dev in all_dev_ids) { var devid = new Device.DeviceStructure(dev.Name, (uint)dev.Value); var ans = devid.ToString(); //var gr = CreateGraphics(); var lbl = new Label() { Text = ans, AutoSize = true, Location = new Point(5, 5 + b * 25) }; Controls.Add(lbl); //gr.DrawString(dev.Name + " " + ans, Font, new SolidBrush(ForeColor), 5, 5 + b * 25); b++; } }
public void Activate() { if (!MainV2.comPort.BaseStream.IsOpen) { Enabled = false; } Enabled = true; var all_dev_ids = MainV2.comPort.MAV.param.Where(a => a.Name.Contains("_ID")); var b = 0; foreach (var dev in all_dev_ids) { var devid = new Device.DeviceStructure((uint)dev.Value); var ans = devid.ToString(); var gr = CreateGraphics(); gr.DrawString(dev.Name + " " + ans, Font, new SolidBrush(ForeColor), 5, 5 + b * 25); b++; } }
public static void Main(string[] args) { Program.args = args; Console.WriteLine( "If your error is about Microsoft.DirectX.DirectInput, please install the latest directx redist from here http://www.microsoft.com/en-us/download/details.aspx?id=35 \n\n"); Console.WriteLine("Debug under mono MONO_LOG_LEVEL=debug mono MissionPlanner.exe"); Thread = Thread.CurrentThread; System.Windows.Forms.Application.EnableVisualStyles(); XmlConfigurator.Configure(); log.Info("******************* Logging Configured *******************"); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); ServicePointManager.DefaultConnectionLimit = 10; System.Windows.Forms.Application.ThreadException += Application_ThreadException; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); // fix ssl on mono ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback( (sender, certificate, chain, policyErrors) => { return(true); }); if (args.Length > 0 && args[0] == "/update") { Utilities.Update.DoUpdate(); return; } name = "Mission Planner"; try { if (File.Exists(Settings.GetRunningDirectory() + "logo.txt")) { name = File.ReadAllLines(Settings.GetRunningDirectory() + "logo.txt", Encoding.UTF8)[0]; } } catch { } if (File.Exists(Settings.GetRunningDirectory() + "logo.png")) { Logo = new Bitmap(Settings.GetRunningDirectory() + "logo.png"); } if (File.Exists(Settings.GetRunningDirectory() + "icon.png")) { // 128*128 IconFile = new Bitmap(Settings.GetRunningDirectory() + "icon.png"); } else { IconFile = MissionPlanner.Properties.Resources.mpdesktop.ToBitmap(); } if (File.Exists(Settings.GetRunningDirectory() + "splashbg.png")) // 600*375 { SplashBG = new Bitmap(Settings.GetRunningDirectory() + "splashbg.png"); } Splash = new MissionPlanner.Splash(); if (SplashBG != null) { Splash.BackgroundImage = SplashBG; Splash.pictureBox1.Visible = false; } if (IconFile != null) { Splash.Icon = Icon.FromHandle(((Bitmap)IconFile).GetHicon()); } string strVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Splash.Text = name + " " + Application.ProductVersion + " build " + strVersion; Splash.Show(); Application.DoEvents(); Application.DoEvents(); // setup theme provider CustomMessageBox.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; Controls.MainSwitcher.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; MissionPlanner.Controls.InputBox.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; Controls.BackstageView.BackstageViewPage.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; // setup settings provider MissionPlanner.Comms.CommsBase.Settings += CommsBase_Settings; MissionPlanner.Comms.CommsBase.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; // set the cache provider to my custom version GMap.NET.GMaps.Instance.PrimaryCache = new Maps.MyImageCache(); // add my custom map providers GMap.NET.MapProviders.GMapProviders.List.Add(Maps.WMSProvider.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Custom.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Earthbuilder.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Statkart_Topo2.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapBox.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapboxNoFly.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance); // add proxy settings GMap.NET.MapProviders.GMapProvider.WebProxy = WebRequest.GetSystemWebProxy(); GMap.NET.MapProviders.GMapProvider.WebProxy.Credentials = CredentialCache.DefaultCredentials; WebRequest.DefaultWebProxy = WebRequest.GetSystemWebProxy(); WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials; if (name == "VVVVZ") { // set pw Settings.Instance["password"] = "******"; Settings.Instance["password_protect"] = "True"; // prevent wizard Settings.Instance["newuser"] = "******"; // invalidate update url System.Configuration.ConfigurationManager.AppSettings["UpdateLocationVersion"] = ""; } CleanupFiles(); log.InfoFormat("64bit os {0}, 64bit process {1}", System.Environment.Is64BitOperatingSystem, System.Environment.Is64BitProcess); Device.DeviceStructure test1 = new Device.DeviceStructure(73225); Device.DeviceStructure test2 = new Device.DeviceStructure(262434); Device.DeviceStructure test3 = new Device.DeviceStructure(131874); MAVLink.MavlinkParse tmp = new MAVLink.MavlinkParse(); MAVLink.mavlink_heartbeat_t hb = new MAVLink.mavlink_heartbeat_t() { autopilot = 1, base_mode = 2, custom_mode = 3, mavlink_version = 2, system_status = 6, type = 7 }; var t1 = tmp.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); var t2 = tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb, true); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb, true); try { //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime; Thread.CurrentThread.Name = "Base Thread"; Application.Run(new MainV2()); } catch (Exception ex) { log.Fatal("Fatal app exception", ex); Console.WriteLine(ex.ToString()); Console.WriteLine("\nPress any key to exit!"); Console.ReadLine(); } try { // kill sim background process if its still running if (Controls.SITL.simulator != null) { Controls.SITL.simulator.Kill(); } } catch { } }
public static void Start(string[] args) { Program.args = args; Console.WriteLine( "If your error is about Microsoft.DirectX.DirectInput, please install the latest directx redist from here http://www.microsoft.com/en-us/download/details.aspx?id=35 \n\n"); Console.WriteLine("Debug under mono MONO_LOG_LEVEL=debug mono MissionPlanner.exe"); Console.WriteLine("Data Dir " + Settings.GetDataDirectory()); Console.WriteLine("Log Dir " + Settings.GetDefaultLogDir()); Console.WriteLine("Running Dir " + Settings.GetRunningDirectory()); Console.WriteLine("User Data Dir " + Settings.GetUserDataDirectory()); var t = Type.GetType("Mono.Runtime"); MONO = (t != null); Thread = Thread.CurrentThread; System.Windows.Forms.Application.EnableVisualStyles(); XmlConfigurator.Configure(); log.Info("******************* Logging Configured *******************"); ServicePointManager.DefaultConnectionLimit = 10; System.Windows.Forms.Application.ThreadException += Application_ThreadException; // fix ssl on mono ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback( (sender, certificate, chain, policyErrors) => { return(true); }); if (args.Length > 0 && args[0] == "/update") { Utilities.Update.DoUpdate(); return; } name = "Mission Planner"; try { if (File.Exists(Settings.GetRunningDirectory() + "logo.txt")) { name = File.ReadAllLines(Settings.GetRunningDirectory() + "logo.txt", Encoding.UTF8)[0]; } } catch { } if (File.Exists(Settings.GetRunningDirectory() + "logo.png")) { Logo = new Bitmap(Settings.GetRunningDirectory() + "logo.png"); } if (File.Exists(Settings.GetRunningDirectory() + "logo2.png")) { Logo2 = new Bitmap(Settings.GetRunningDirectory() + "logo2.png"); } if (File.Exists(Settings.GetRunningDirectory() + "icon.png")) { // 128*128 IconFile = new Bitmap(Settings.GetRunningDirectory() + "icon.png"); } else { IconFile = MissionPlanner.Properties.Resources.mpdesktop.ToBitmap(); } if (File.Exists(Settings.GetRunningDirectory() + "splashbg.png")) // 600*375 { SplashBG = new Bitmap(Settings.GetRunningDirectory() + "splashbg.png"); } Splash = new MissionPlanner.Splash(); if (SplashBG != null) { Splash.BackgroundImage = SplashBG; Splash.pictureBox1.Visible = false; } if (IconFile != null) { Splash.Icon = Icon.FromHandle(((Bitmap)IconFile).GetHicon()); } string strVersion = File.Exists("version.txt") ? File.ReadAllText("version.txt") : System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Splash.Text = name + " " + Application.ProductVersion + " build " + strVersion; Splash.Show(); Application.DoEvents(); Application.DoEvents(); CustomMessageBox.ShowEvent += (text, caption, buttons, icon) => { return((CustomMessageBox.DialogResult)(int) MsgBox.CustomMessageBox.Show(text, caption, (MessageBoxButtons)(int)buttons, (MessageBoxIcon)(int)icon)); }; // setup theme provider MsgBox.CustomMessageBox.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; Controls.MainSwitcher.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; MissionPlanner.Controls.InputBox.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; Controls.BackstageView.BackstageViewPage.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; Controls.MainSwitcher.Tracking += MissionPlanner.Utilities.Tracking.AddPage; Controls.BackstageView.BackstageView.Tracking += MissionPlanner.Utilities.Tracking.AddPage; // setup settings provider MissionPlanner.Comms.CommsBase.Settings += CommsBase_Settings; MissionPlanner.Comms.CommsBase.InputBoxShow += CommsBaseOnInputBoxShow; MissionPlanner.Comms.CommsBase.ApplyTheme += MissionPlanner.Utilities.ThemeManager.ApplyThemeTo; // set the cache provider to my custom version GMap.NET.GMaps.Instance.PrimaryCache = new Maps.MyImageCache(); // add my custom map providers GMap.NET.MapProviders.GMapProviders.List.Add(Maps.WMSProvider.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Custom.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Earthbuilder.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Statkart_Topo2.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Eniro_Topo.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapBox.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.MapboxNoFly.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Lake.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1974.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1979.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1984.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_1988.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Relief.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Slopezone.Instance); GMap.NET.MapProviders.GMapProviders.List.Add(Maps.Japan_Sea.Instance); GoogleMapProvider.APIKey = "AIzaSyA5nFp39fEHruCezXnG3r8rGyZtuAkmCug"; // optionally add gdal support if (Directory.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "gdal")) { GMap.NET.MapProviders.GMapProviders.List.Add(GDAL.GDALProvider.Instance); } // add proxy settings GMap.NET.MapProviders.GMapProvider.WebProxy = WebRequest.GetSystemWebProxy(); GMap.NET.MapProviders.GMapProvider.WebProxy.Credentials = CredentialCache.DefaultCredentials; // generic status report screen MAVLinkInterface.CreateIProgressReporterDialogue += title => new ProgressReporterDialogue() { StartPosition = FormStartPosition.CenterScreen, Text = title }; WebRequest.DefaultWebProxy = WebRequest.GetSystemWebProxy(); WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials; if (name == "VVVVZ") { // set pw Settings.Instance["password"] = "******"; Settings.Instance["password_protect"] = "True"; // prevent wizard Settings.Instance["newuser"] = "******"; // invalidate update url System.Configuration.ConfigurationManager.AppSettings["UpdateLocationVersion"] = ""; } CleanupFiles(); //LoadDlls(); log.InfoFormat("64bit os {0}, 64bit process {1}", System.Environment.Is64BitOperatingSystem, System.Environment.Is64BitProcess); Device.DeviceStructure test1 = new Device.DeviceStructure(73225); Device.DeviceStructure test2 = new Device.DeviceStructure(262434); Device.DeviceStructure test3 = new Device.DeviceStructure(131874); //ph2 - cube with here Device.DeviceStructure test5 = new Device.DeviceStructure(466441); Device.DeviceStructure test6 = new Device.DeviceStructure(131874); Device.DeviceStructure test7 = new Device.DeviceStructure(263178); // Device.DeviceStructure test8 = new Device.DeviceStructure(1442082); Device.DeviceStructure test9 = new Device.DeviceStructure(1114914); Device.DeviceStructure test10 = new Device.DeviceStructure(1442826); // Device.DeviceStructure test11 = new Device.DeviceStructure(2359586); Device.DeviceStructure test12 = new Device.DeviceStructure(2229282); Device.DeviceStructure test13 = new Device.DeviceStructure(2360330); Device.DeviceStructure test21 = new Device.DeviceStructure(592905); Device.DeviceStructure test22 = new Device.DeviceStructure(131874); Device.DeviceStructure test23 = new Device.DeviceStructure(263178); MAVLink.MavlinkParse tmp = new MAVLink.MavlinkParse(); MAVLink.mavlink_heartbeat_t hb = new MAVLink.mavlink_heartbeat_t() { autopilot = 1, base_mode = 2, custom_mode = 3, mavlink_version = 2, system_status = 6, type = 7 }; var t1 = tmp.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); var t2 = tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb, true); tmp.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb, true); var msg = new MAVLink.MAVLinkMessage(t2); try { //System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.RealTime; Thread.CurrentThread.Name = "Base Thread"; Application.Run(new MainV2()); } catch (Exception ex) { log.Fatal("Fatal app exception", ex); Console.WriteLine(ex.ToString()); Console.WriteLine("\nPress any key to exit!"); Console.ReadLine(); } try { // kill sim background process if its still running if (Controls.SITL.simulator != null) { Controls.SITL.simulator.Kill(); } } catch { } }
public DeviceInfo(int index, string ParamName, uint id) { _index = index; this.ParamName = ParamName; _devid = new Device.DeviceStructure(ParamName, id); }