现场功能更改5
This commit is contained in:
@@ -26,6 +26,7 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
{
|
{
|
||||||
private readonly IContainerProvider ContainerProvider;
|
private readonly IContainerProvider ContainerProvider;
|
||||||
private readonly object _dbcParserLock = new object();
|
private readonly object _dbcParserLock = new object();
|
||||||
|
private const int DbcStringBufferCapacity = 256;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实例化函数
|
/// 实例化函数
|
||||||
@@ -354,11 +355,11 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
int DBCMsgNum = CAN_DBCParser.DBC_GetMsgQuantity(DBCHandle);
|
int DBCMsgNum = CAN_DBCParser.DBC_GetMsgQuantity(DBCHandle);
|
||||||
for (int i = 0; i < DBCMsgNum; i++)
|
for (int i = 0; i < DBCMsgNum; i++)
|
||||||
{
|
{
|
||||||
StringBuilder MsgName = new StringBuilder(32);
|
StringBuilder MsgName = new StringBuilder(DbcStringBufferCapacity);
|
||||||
CAN_DBCParser.DBC_GetMsgName(DBCHandle, i, MsgName);
|
CAN_DBCParser.DBC_GetMsgName(DBCHandle, i, MsgName);
|
||||||
//Console.WriteLine("Msg.Name = {0}", MsgName);
|
//Console.WriteLine("Msg.Name = {0}", MsgName);
|
||||||
int DBCSigNum = CAN_DBCParser.DBC_GetMsgSignalQuantity(DBCHandle, MsgName);
|
int DBCSigNum = CAN_DBCParser.DBC_GetMsgSignalQuantity(DBCHandle, MsgName);
|
||||||
StringBuilder Publisher = new StringBuilder(32);
|
StringBuilder Publisher = new StringBuilder(DbcStringBufferCapacity);
|
||||||
CAN_DBCParser.DBC_GetMsgPublisher(DBCHandle, MsgName, Publisher);
|
CAN_DBCParser.DBC_GetMsgPublisher(DBCHandle, MsgName, Publisher);
|
||||||
long MsgId;
|
long MsgId;
|
||||||
MsgId = CAN_DBCParser.DBC_GetMsgIDByName(DBCHandle, MsgName);
|
MsgId = CAN_DBCParser.DBC_GetMsgIDByName(DBCHandle, MsgName);
|
||||||
@@ -366,7 +367,7 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
//Console.Write("Signals:");
|
//Console.Write("Signals:");
|
||||||
for (int j = 0; j < DBCSigNum; j++)
|
for (int j = 0; j < DBCSigNum; j++)
|
||||||
{
|
{
|
||||||
StringBuilder SigName = new StringBuilder(32);
|
StringBuilder SigName = new StringBuilder(DbcStringBufferCapacity);
|
||||||
CAN_DBCParser.DBC_GetMsgSignalName(DBCHandle, MsgName, j, SigName);
|
CAN_DBCParser.DBC_GetMsgSignalName(DBCHandle, MsgName, j, SigName);
|
||||||
//Console.Write("{0} ", SigName);
|
//Console.Write("{0} ", SigName);
|
||||||
|
|
||||||
@@ -628,15 +629,16 @@ namespace CapMachine.Wpf.CanDrive
|
|||||||
//将CAN消息数据填充到信号里面,用DBC解析数据
|
//将CAN消息数据填充到信号里面,用DBC解析数据
|
||||||
CAN_DBCParser.DBC_SyncCANMsgToValue(DBCHandle, msgPtRead, CanNum);
|
CAN_DBCParser.DBC_SyncCANMsgToValue(DBCHandle, msgPtRead, CanNum);
|
||||||
|
|
||||||
|
double[] valueDouble = new double[1];
|
||||||
//循环获取消息的数据
|
//循环获取消息的数据
|
||||||
foreach (var item in ListCanDbcModel)
|
foreach (var item in ListCanDbcModel)
|
||||||
{
|
{
|
||||||
//有配置的名称的,认为是有用的,则需要读取数据
|
//有配置的名称的,认为是有用的,则需要读取数据
|
||||||
//if (!string.IsNullOrEmpty(item.Name))
|
//if (!string.IsNullOrEmpty(item.Name))
|
||||||
//{
|
//{
|
||||||
var valueSb = new StringBuilder(64);
|
valueDouble[0] = 0;
|
||||||
CAN_DBCParser.DBC_GetSignalValueStr(DBCHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), valueSb);
|
CAN_DBCParser.DBC_GetSignalValue(DBCHandle, new StringBuilder(item.MsgName), new StringBuilder(item.SignalName), valueDouble);
|
||||||
item.SignalRtValueSb = valueSb;
|
item.SignalRtValue = valueDouble[0].ToString();
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user