diff --git a/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml b/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml
index d8445e3..fd1d627 100644
--- a/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml
+++ b/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml
@@ -255,20 +255,35 @@
+
+
+
-
-
+
+
+
+
+
+
+
+
diff --git a/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml.cs b/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml.cs
index 11d4f48..984e0fd 100644
--- a/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml.cs
+++ b/src/SharpBladeFlightAnalyzer/Controls/LogPageControl.xaml.cs
@@ -254,7 +254,7 @@ private void exportAcmiBtn_Click(object sender, RoutedEventArgs e)
(logFile.FormatList["vehicle_attitude"].SubscribedID.Count == 0)
)
{
- MessageBox.Show("数据不全");
+ MessageBox.Show("数据不全", "SharpBladeFlightAnalyzer");
return;
}
DataField[] posData = new DataField[3];
@@ -359,7 +359,7 @@ private void exportCsvBtn_Click(object sender, RoutedEventArgs e)
(logFile.FormatList["vehicle_attitude"].SubscribedID.Count == 0)
)
{
- MessageBox.Show("数据不全");
+ MessageBox.Show("数据不全", "SharpBladeFlightAnalyzer");
return;
}
DataField[] posData = new DataField[3];
diff --git a/src/SharpBladeFlightAnalyzer/LoggedMessage.cs b/src/SharpBladeFlightAnalyzer/LoggedMessage.cs
index 5f69b9f..a9f0077 100644
--- a/src/SharpBladeFlightAnalyzer/LoggedMessage.cs
+++ b/src/SharpBladeFlightAnalyzer/LoggedMessage.cs
@@ -12,6 +12,7 @@ public class LoggedMessage
ulong timestamp;
string message;
DateTime time;
+ LogTag tag;
public LogLevel Level
{
@@ -39,6 +40,23 @@ public DateTime Time
{
get { return time; }
}
+
+ public LogTag Tag { get => tag; set => tag = value; }
+
+ public string TagString
+ {
+ get
+ {
+ if (Tag != LogTag.notag)
+ return tag.ToString();
+ return "";
+ }
+ }
+
+ public LoggedMessage()
+ {
+ tag = LogTag.notag;
+ }
}
public enum LogLevel:byte
@@ -52,4 +70,19 @@ public enum LogLevel:byte
INFO = 0x36,
DEBUG = 0x37
}
+
+ public enum LogTag : ushort
+ {
+ unassigned,
+ mavlink_handler,
+ ppk_handler,
+ camera_handler,
+ ptp_handler,
+ serial_handler,
+ watchdog,
+ io_service,
+ cbuf,
+ ulg,
+ notag=9999
+ }
}
diff --git a/src/SharpBladeFlightAnalyzer/MainWindow.xaml b/src/SharpBladeFlightAnalyzer/MainWindow.xaml
index 6dfd7b0..ba680e6 100644
--- a/src/SharpBladeFlightAnalyzer/MainWindow.xaml
+++ b/src/SharpBladeFlightAnalyzer/MainWindow.xaml
@@ -75,7 +75,9 @@
-
+
+
+
diff --git a/src/SharpBladeFlightAnalyzer/Parameter.cs b/src/SharpBladeFlightAnalyzer/Parameter.cs
new file mode 100644
index 0000000..9d1f5df
--- /dev/null
+++ b/src/SharpBladeFlightAnalyzer/Parameter.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SharpBladeFlightAnalyzer
+{
+ public class Parameter
+ {
+ string name;
+ float value;
+ float systemDefaultValue;
+ float airframeDefaultValue;
+ string displayedSysDefalut;
+ string displayedAirframeDefault;
+
+ public string Name { get => name; set => name = value; }
+ public float Value { get => value; set => this.value = value; }
+ public float SystemDefaultValue
+ {
+ get => systemDefaultValue;
+ set
+ {
+ systemDefaultValue = value;
+ displayedSysDefalut = value.ToString();
+ }
+ }
+ public float AirframeDefaultValue
+ {
+ get => airframeDefaultValue;
+ set
+ {
+ airframeDefaultValue = value;
+ displayedAirframeDefault = value.ToString();
+ }
+ }
+ public string DisplayedSysDefalut { get => displayedSysDefalut; set => displayedSysDefalut = value; }
+ public string DisplayedAirframeDefault { get => displayedAirframeDefault; set => displayedAirframeDefault = value; }
+
+ public Parameter()
+ {
+ name = "";
+ value = 0;
+ systemDefaultValue = 0;
+ airframeDefaultValue = 0;
+ displayedSysDefalut = "";
+ displayedAirframeDefault = "";
+ }
+ }
+}
diff --git a/src/SharpBladeFlightAnalyzer/SharpBladeFlightAnalyzer.csproj b/src/SharpBladeFlightAnalyzer/SharpBladeFlightAnalyzer.csproj
index 1930674..e736374 100644
--- a/src/SharpBladeFlightAnalyzer/SharpBladeFlightAnalyzer.csproj
+++ b/src/SharpBladeFlightAnalyzer/SharpBladeFlightAnalyzer.csproj
@@ -103,6 +103,7 @@
+
diff --git a/src/SharpBladeFlightAnalyzer/ULogFile.cs b/src/SharpBladeFlightAnalyzer/ULogFile.cs
index fc8bbff..583042b 100644
--- a/src/SharpBladeFlightAnalyzer/ULogFile.cs
+++ b/src/SharpBladeFlightAnalyzer/ULogFile.cs
@@ -5,6 +5,7 @@
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
+using System.Windows.Forms;
namespace SharpBladeFlightAnalyzer
{
@@ -29,7 +30,7 @@ public class ULogFile :IDisposable
//key,value
List> infomations;
//key,value
- List> parameters;
+ List parameters;
List messages;
@@ -76,7 +77,7 @@ public static Dictionary TypeSize
}
}
- public List> Parameters
+ public List Parameters
{
get { return parameters; }
set { parameters = value; }
@@ -103,7 +104,7 @@ public ULogFile()
FormatList = new Dictionary();
MessageDict = new Dictionary();
infomations=new List>();
- parameters=new List>();
+ parameters=new List();
Messages = new List();
}
@@ -211,38 +212,71 @@ private bool readMessage()
byte msgtype = reader.ReadByte();
if (reader.BaseStream.Length - reader.BaseStream.Position < size)
return false;
+ bool res = false;
+ string errmsg="读取类型为"+msgtype.ToString()+"的消息时发生未知错误";
switch (msgtype)
{
case 66://B
- return readFlagBitset(size);
+ res = readFlagBitset(size);
+ break;
case 70://F
- return readFormatDefinition(size);
+ res = readFormatDefinition(size);
+ break;
case 73://I
- return readInformation(size);
+ res = readInformation(size);
+ break;
case 77://M
- return readInformationMulti(size);
+ res = readInformationMulti(size);
+ break;
case 80://P
- return readParameter(size);
+ res = readParameter(size, false);
+ break;
+ case 81://Q
+ res = readParameter(size, true);
+ break;
case 65://A
if(!defEndFlag)
- expendDefinition();
- return readSubscribe(size);
+ expendDefinition();
+ res = readSubscribe(size);
+ break;
case 82://R
- return readUnsubscribe(size);
+ res = readUnsubscribe(size);
+ break;
case 68://D
- return readLoggedData(size);
+ res = readLoggedData(size);
+ break;
case 76://L
if (!defEndFlag)
expendDefinition();
- return readLoggedString(size);
+ res = readLoggedString(size,false);
+ break;
+ case 67://C Tagged Logged string message
+ res = readLoggedString(size, true);
+ break;
case 83://S
- return readSynchronization(size);
+ res = readSynchronization(size);
+ break;
case 79://O
- return readDropoutMark(size);
+ res = readDropoutMark(size);
+ break;
default:
- Debug.WriteLine("Unknow message type:{0}.", msgtype);
+ Debug.WriteLine("Unknow message type:{0},at {1}, size {2}.", msgtype, reader.BaseStream.Position,size);
+ byte[] tmp= reader.ReadBytes(size);
+ res = false;
+ errmsg = "未知日志消息类型:" + msgtype.ToString();
+ break;
+ }
+
+ if (!res)
+ {
+ errmsg = "读取文件时发生错误:" + System.Environment.NewLine + errmsg + System.Environment.NewLine + "是否继续?";
+ if (MessageBox.Show(errmsg, "SharpBladeFlightAnalyzer", MessageBoxButtons.YesNo) == DialogResult.Yes)
+ return true;
+ else
return false;
}
+
+ return res;
}
private void expendDefinition()
{
@@ -385,26 +419,50 @@ private bool readInformationMulti(ushort msglen)
return true;
}
- private bool readParameter(ushort msglen)
+ private bool readParameter(ushort msglen,bool def)
{
+ Parameter p = new Parameter();
+ byte defaultType=0;
+ if(def)
+ {
+ defaultType = reader.ReadByte();
+ }
int keylen = reader.ReadByte();
string key = readASCIIString(keylen);
string keytype = key.Substring(0, key.IndexOf(' '));
- string keyname = key.Substring(keytype.Length + 1);
- float val=0;
+ p.Name = key.Substring(keytype.Length + 1);
+ float v;
switch(keytype)
{
case "int32_t":
- val = reader.ReadInt32();
+ v = reader.ReadInt32();
break;
case "float":
- val = reader.ReadSingle();
+ v = reader.ReadSingle();
break;
default:
Debug.WriteLine("[P]:Unknow parameter type {0}.", keytype);
return false;
}
- parameters.Add(new Tuple(keyname, val));
+ if (!def)
+ {
+ p.Value = v;
+ parameters.Add(p);
+ return true;
+ }
+ else
+ {
+ for(int i=0;i