Browse Source

Fixed namespace and removed old changes

master
Georgios Gerontakis 5 years ago
parent
commit
ca44c36c82
  1. BIN
      tracking and telemetry/Client/.vs/Client/DesignTimeBuild/.dtbcache
  2. BIN
      tracking and telemetry/Client/.vs/Client/v16/.suo
  3. 0
      tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/db.lock
  4. BIN
      tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide
  5. 19
      tracking and telemetry/Client/Client.Designer.cs
  6. 187
      tracking and telemetry/Client/Client.cs
  7. 4
      tracking and telemetry/Client/Program.cs
  8. BIN
      tracking and telemetry/Client/bin/Debug/Client.exe
  9. BIN
      tracking and telemetry/Client/bin/Debug/Client.pdb
  10. 0
      tracking and telemetry/Client/obj/Debug/Client.Client.resources
  11. 2
      tracking and telemetry/Client/obj/Debug/Client.csproj.FileListAbsolute.txt
  12. BIN
      tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache
  13. BIN
      tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache
  14. BIN
      tracking and telemetry/Client/obj/Debug/Client.exe
  15. BIN
      tracking and telemetry/Client/obj/Debug/Client.pdb
  16. BIN
      tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
  17. BIN
      tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache
  18. BIN
      tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache
  19. BIN
      tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache

BIN
tracking and telemetry/Client/.vs/Client/DesignTimeBuild/.dtbcache

Binary file not shown.

BIN
tracking and telemetry/Client/.vs/Client/v16/.suo

Binary file not shown.

0
tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/db.lock

BIN
tracking and telemetry/Client/.vs/Client/v16/Server/sqlite3/storage.ide

Binary file not shown.

19
tracking and telemetry/Client/Client.Designer.cs

@ -1,6 +1,6 @@
namespace SimpleExample
namespace Client
{
partial class simpleexample
partial class client
{
/// <summary>
/// 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;
}
}

187
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<uint> listItemIds = new List<uint>();
Dictionary<int, object> droneDataDictionary = new Dictionary<int, object>();
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<T>(byte sysid,byte compid,int timeout = 2000)
T readsomedata<T>(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)
{
}
}
}

4
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());
}
}
}

BIN
tracking and telemetry/Client/bin/Debug/Client.exe

Binary file not shown.

BIN
tracking and telemetry/Client/bin/Debug/Client.pdb

Binary file not shown.

0
tracking and telemetry/Client/obj/Debug/SimpleExample.simpleexample.resources → tracking and telemetry/Client/obj/Debug/Client.Client.resources

2
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

BIN
tracking and telemetry/Client/obj/Debug/Client.csproj.GenerateResource.cache

Binary file not shown.

BIN
tracking and telemetry/Client/obj/Debug/Client.csprojAssemblyReference.cache

Binary file not shown.

BIN
tracking and telemetry/Client/obj/Debug/Client.exe

Binary file not shown.

BIN
tracking and telemetry/Client/obj/Debug/Client.pdb

Binary file not shown.

BIN
tracking and telemetry/Client/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll

Binary file not shown.

BIN
tracking and telemetry/Mavlink/obj/Debug/net35/MAVLink.csprojAssemblyReference.cache

Binary file not shown.

BIN
tracking and telemetry/Mavlink/obj/Debug/net461/MAVLink.csprojAssemblyReference.cache

Binary file not shown.

BIN
tracking and telemetry/Mavlink/obj/Debug/netstandard2.0/MAVLink.csprojAssemblyReference.cache

Binary file not shown.
Loading…
Cancel
Save