diff --git a/tracking and telemetry/Client/.vs/Client/DesignTimeBuild/.dtbcache b/tracking and telemetry/Client/.vs/Client/DesignTimeBuild/.dtbcache new file mode 100644 index 0000000..9a9f12d Binary files /dev/null and b/tracking and telemetry/Client/.vs/Client/DesignTimeBuild/.dtbcache differ diff --git a/tracking and telemetry/Client/.vs/Client/v16/.suo b/tracking and telemetry/Client/.vs/Client/v16/.suo index 58a10da..c42be5f 100644 Binary files a/tracking and telemetry/Client/.vs/Client/v16/.suo and b/tracking and telemetry/Client/.vs/Client/v16/.suo differ diff --git a/tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/db.lock b/tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide b/tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide new file mode 100644 index 0000000..6d8d80c Binary files /dev/null and b/tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide differ diff --git a/tracking and telemetry/Client/Client.Designer.cs b/tracking and telemetry/Client/Client.Designer.cs index 5bcaff8..5366807 100644 --- a/tracking and telemetry/Client/Client.Designer.cs +++ b/tracking and telemetry/Client/Client.Designer.cs @@ -1,6 +1,6 @@ -namespace SimpleExample +namespace Client { - partial class simpleexample + partial class client { /// /// Required designer variable. @@ -34,7 +34,6 @@ this.but_connect = new System.Windows.Forms.Button(); this.serialPort1 = new System.IO.Ports.SerialPort(this.components); this.listBox1 = new System.Windows.Forms.ListBox(); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // CMB_comport @@ -80,25 +79,16 @@ this.listBox1.Size = new System.Drawing.Size(169, 303); this.listBox1.TabIndex = 3; // - // richTextBox1 - // - this.richTextBox1.Location = new System.Drawing.Point(211, 69); - this.richTextBox1.Name = "richTextBox1"; - this.richTextBox1.Size = new System.Drawing.Size(310, 204); - this.richTextBox1.TabIndex = 4; - this.richTextBox1.Text = ""; - // - // simpleexample + // Client // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(547, 363); - this.Controls.Add(this.richTextBox1); this.Controls.Add(this.listBox1); this.Controls.Add(this.but_connect); this.Controls.Add(this.cmb_baudrate); this.Controls.Add(this.CMB_comport); - this.Name = "simpleexample"; + this.Name = "Client"; this.Text = "Form1"; this.Load += new System.EventHandler(this.simpleexample_Load); this.ResumeLayout(false); @@ -112,7 +102,6 @@ private System.Windows.Forms.Button but_connect; private System.IO.Ports.SerialPort serialPort1; private System.Windows.Forms.ListBox listBox1; - private System.Windows.Forms.RichTextBox richTextBox1; } } diff --git a/tracking and telemetry/Client/Client.cs b/tracking and telemetry/Client/Client.cs index 4557f64..fd003fb 100644 --- a/tracking and telemetry/Client/Client.cs +++ b/tracking and telemetry/Client/Client.cs @@ -10,12 +10,11 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -namespace SimpleExample +namespace Client { - public partial class simpleexample : Form + public partial class client : Form { MAVLink.MavlinkParse mavlink = new MAVLink.MavlinkParse(); - bool armed = false; // locking to prevent multiple reads on serial port object readlock = new object(); // our target sysid @@ -23,11 +22,7 @@ namespace SimpleExample // our target compid byte compid; - // Giak stuff - List listItemIds = new List(); - Dictionary droneDataDictionary = new Dictionary(); - - public simpleexample() + public client() { InitializeComponent(); } @@ -69,7 +64,7 @@ namespace SimpleExample { // read any valid packet from the port packet = mavlink.ReadPacket(serialPort1.BaseStream); - + // check its valid if (packet == null || packet.data == null) continue; @@ -78,9 +73,9 @@ namespace SimpleExample // check to see if its a hb packet from the comport if (packet.data.GetType() == typeof(MAVLink.mavlink_heartbeat_t)) { - + var hb = (MAVLink.mavlink_heartbeat_t)packet.data; - + // save the sysid and compid of the seen MAV sysid = packet.sysid; compid = packet.compid; @@ -109,17 +104,12 @@ namespace SimpleExample Console.WriteLine(packet.msgtypename); - // Update the data in the dictionary. - // - droneDataDictionary[(int)packet.msgid] = packet.data; - listBox1.Invoke(new Action(() => { if (!listBox1.Items.Contains(packet.msgtypename)) { listBox1.Items.Add(packet.msgtypename); - listItemIds.Add(packet.msgid); } })); @@ -132,11 +122,8 @@ namespace SimpleExample //Console.WriteLine(packet.msgtypename + " => " + att.pitch*57.2958 + " " + att.roll*57.2958); } - string d = GetData((int)packet.msgid, packet.data); - BeginInvoke(new Action(() => richTextBox1.Text = d)); - } - catch(Exception ex) + catch (Exception ex) { MessageBox.Show(ex.ToString()); } @@ -145,150 +132,10 @@ namespace SimpleExample } } - private string GetData(int id, object droneData) - { - string ret = ""; - if (id == (int)MAVLink.MAVLINK_MSG_ID.HEARTBEAT) - { - MAVLink.mavlink_heartbeat_t data = (MAVLink.mavlink_heartbeat_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_heartbeat_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.POWER_STATUS) - { - MAVLink.mavlink_power_status_t data = (MAVLink.mavlink_power_status_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_power_status_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.LOCAL_POSITION_NED) - { - MAVLink.mavlink_local_position_ned_t data = (MAVLink.mavlink_local_position_ned_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_local_position_ned_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.VIBRATION) - { - MAVLink.mavlink_vibration_t data = (MAVLink.mavlink_vibration_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_vibration_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.VFR_HUD) - { - MAVLink.mavlink_vfr_hud_t data = (MAVLink.mavlink_vfr_hud_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_vfr_hud_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.SIMSTATE) - { - MAVLink.mavlink_simstate_t data = (MAVLink.mavlink_simstate_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_simstate_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.AHRS2) - { - MAVLink.mavlink_ahrs2_t data = (MAVLink.mavlink_ahrs2_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_ahrs2_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.AHRS3) - { - MAVLink.mavlink_ahrs3_t data = (MAVLink.mavlink_ahrs3_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_ahrs3_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.ATTITUDE) - { - MAVLink.mavlink_attitude_t data = (MAVLink.mavlink_attitude_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_attitude_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.MISSION_CURRENT) - { - MAVLink.mavlink_mission_current_t data = (MAVLink.mavlink_mission_current_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_mission_current_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.SERVO_OUTPUT_RAW) - { - MAVLink.mavlink_servo_output_raw_t data = (MAVLink.mavlink_servo_output_raw_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_servo_output_raw_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - else if (id == (int)MAVLink.MAVLINK_MSG_ID.SERVO_OUTPUT_RAW) - { - MAVLink.mavlink_servo_output_raw_t data = (MAVLink.mavlink_servo_output_raw_t)droneDataDictionary[id]; - - foreach (var field in typeof(MAVLink.mavlink_servo_output_raw_t).GetFields(BindingFlags.Instance | - BindingFlags.NonPublic | - BindingFlags.Public)) - { - ret += String.Format("{0} = {1}\n", field.Name, field.GetValue(data)); - } - } - - return ret == "" ? "" : ret.Substring(0, ret.Length-1); - - } - - T readsomedata(byte sysid,byte compid,int timeout = 2000) + T readsomedata(byte sysid, byte compid, int timeout = 2000) { DateTime deadline = DateTime.Now.AddMilliseconds(timeout); - + lock (readlock) { // read the current buffered bytes @@ -302,9 +149,9 @@ namespace SimpleExample //Console.WriteLine(packet); - if (packet.data.GetType() == typeof (T)) + if (packet.data.GetType() == typeof(T)) { - return (T) packet.data; + return (T)packet.data; } } } @@ -312,16 +159,26 @@ namespace SimpleExample throw new Exception("No packet match found"); } - private void CMB_comport_Click(object sender, EventArgs e) { CMB_comport.DataSource = SerialPort.GetPortNames(); } + private void simpleexample_Load(object sender, EventArgs e) { } + + private void listBox1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void listBox1_DoubleClick(object sender, EventArgs e) + { + + } } } diff --git a/tracking and telemetry/Client/Program.cs b/tracking and telemetry/Client/Program.cs index a7bfd48..d2f432e 100644 --- a/tracking and telemetry/Client/Program.cs +++ b/tracking and telemetry/Client/Program.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; -namespace SimpleExample +namespace Client { static class Program { @@ -16,7 +16,7 @@ namespace SimpleExample { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new simpleexample()); + Application.Run(new client()); } } } diff --git a/tracking and telemetry/Client/bin/Debug/Client.exe b/tracking and telemetry/Client/bin/Debug/Client.exe index 36e8e83..47582cd 100644 Binary files a/tracking and telemetry/Client/bin/Debug/Client.exe and b/tracking and telemetry/Client/bin/Debug/Client.exe differ diff --git a/tracking and telemetry/Client/bin/Debug/Client.pdb b/tracking and telemetry/Client/bin/Debug/Client.pdb index 70ea54e..6f8243a 100644 Binary files a/tracking and telemetry/Client/bin/Debug/Client.pdb and b/tracking and telemetry/Client/bin/Debug/Client.pdb differ diff --git a/tracking and telemetry/Client/obj/Debug/SimpleExample.simpleexample.resources b/tracking and telemetry/Client/obj/Debug/Client.Client.resources similarity index 100% rename from tracking and telemetry/Client/obj/Debug/SimpleExample.simpleexample.resources rename to tracking and telemetry/Client/obj/Debug/Client.Client.resources diff --git a/tracking and telemetry/Client/obj/Debug/Client.csproj.FileListAbsolute.txt b/tracking and telemetry/Client/obj/Debug/Client.csproj.FileListAbsolute.txt index 89fadec..88c36c6 100644 --- a/tracking and telemetry/Client/obj/Debug/Client.csproj.FileListAbsolute.txt +++ b/tracking and telemetry/Client/obj/Debug/Client.csproj.FileListAbsolute.txt @@ -21,8 +21,8 @@ C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\bin\Debug\Microsoft.Scripting.Metadata.xml C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.csprojAssemblyReference.cache C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.Properties.Resources.resources -C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\SimpleExample.simpleexample.resources C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.csproj.GenerateResource.cache C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.csproj.CopyComplete C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.exe C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.pdb +C:\Users\GeorgiosGerontakis\Desktop\Talos_Drones_Tracking_and_Telemetry\tracking and telemetry\Client\obj\Debug\Client.Client.resources diff --git a/tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache b/tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache index 4fe9073..e315c02 100644 Binary files a/tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache and b/tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache differ diff --git a/tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache b/tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache index a7bdf91..6654e5b 100644 Binary files a/tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache and b/tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache differ diff --git a/tracking and telemetry/Client/obj/Debug/Client.exe b/tracking and telemetry/Client/obj/Debug/Client.exe index 36e8e83..47582cd 100644 Binary files a/tracking and telemetry/Client/obj/Debug/Client.exe and b/tracking and telemetry/Client/obj/Debug/Client.exe differ diff --git a/tracking and telemetry/Client/obj/Debug/Client.pdb b/tracking and telemetry/Client/obj/Debug/Client.pdb index 70ea54e..6f8243a 100644 Binary files a/tracking and telemetry/Client/obj/Debug/Client.pdb and b/tracking and telemetry/Client/obj/Debug/Client.pdb differ diff --git a/tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll b/tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll index a5768df..1d0e209 100644 Binary files a/tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll and b/tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll differ diff --git a/tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache b/tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache index 2836a7f..4399083 100644 Binary files a/tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache and b/tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache differ diff --git a/tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache b/tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache index 9f61b7e..f2d690f 100644 Binary files a/tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache and b/tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache differ diff --git a/tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache b/tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache index 484ebc2..263bbe8 100644 Binary files a/tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache and b/tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache differ