添加xcpcore,添加加载dbc至单一通道
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<UserControl x:Class="UpdateInfoModule.Views.TSMasterXCPView"
|
||||
<UserControl x:Class="TSMasterXCPModule.Views.TSMasterXCPView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -6,10 +6,274 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
d:DesignHeight="1080"
|
||||
d:DesignWidth="1920">
|
||||
<Grid Background="green">
|
||||
|
||||
</Grid>
|
||||
<UserControl.Resources>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Background="#F5F7FA">
|
||||
<Grid Margin="8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ScrollViewer Grid.Column="0"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
Margin="0,0,8,0">
|
||||
<StackPanel>
|
||||
|
||||
<!-- ============ 设备状态卡片 ============ -->
|
||||
<materialDesign:Card Margin="0,0,0,8" Padding="12,8">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<materialDesign:PackIcon Kind="Connection"
|
||||
Width="22" Height="22"
|
||||
Foreground="#1565C0"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock Text="TSMaster XCP 测试 · XcpMaster"
|
||||
FontSize="15" FontWeight="Bold"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock FontSize="12" VerticalAlignment="Center" Margin="12,0,0,0">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="总线: 未连接" />
|
||||
<Setter Property="Foreground" Value="#F44336" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsBusConnected}" Value="True">
|
||||
<Setter Property="Text" Value="总线: 已连接" />
|
||||
<Setter Property="Foreground" Value="#4CAF50" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Border Width="10" Height="10" CornerRadius="5" Margin="0,0,6,0">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="#F44336" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsConnected}" Value="True">
|
||||
<Setter Property="Background" Value="#4CAF50" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Text" Value="XCP 未连接" />
|
||||
<Setter Property="Foreground" Value="#F44336" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsConnected}" Value="True">
|
||||
<Setter Property="Text" Value="XCP 已连接" />
|
||||
<Setter Property="Foreground" Value="#4CAF50" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<ProgressBar IsIndeterminate="True" Width="60" Height="4"
|
||||
Margin="12,0,0,0"
|
||||
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVis}}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</materialDesign:Card>
|
||||
|
||||
<!-- ============ TSMaster 总线连接 ============ -->
|
||||
<GroupBox Header="TSMaster 总线连接" Margin="0,0,0,8"
|
||||
materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="工程文件" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="360"
|
||||
ToolTip="TSMaster 工程文件(.tscproj / .xcp 等全路径),留空则使用默认工程初始化"
|
||||
Text="{Binding TSMasterProjectPath, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="初始化驱动" Command="{Binding InitDriverCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
Background="#388E3C" Foreground="White" />
|
||||
<Button Content="释放驱动" Command="{Binding ReleaseDriverCommand}"
|
||||
Style="{StaticResource WarnBtn}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<Button Content="连接总线" Command="{Binding ConnectBusCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
Background="#388E3C" Foreground="White"
|
||||
ToolTip="tsapp_connect + 启动 RBS 仿真,XCP 收发前必须先连接总线" />
|
||||
<Button Content="断开总线" Command="{Binding DisconnectBusCommand}"
|
||||
Style="{StaticResource WarnBtn}" />
|
||||
<TextBlock Text="{Binding IsBusConnected, StringFormat='总线状态: {0}'}"
|
||||
VerticalAlignment="Center" Margin="12,0,0,0"
|
||||
FontSize="12" Foreground="#616161" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- ============ XCP 连接配置 ============ -->
|
||||
<GroupBox Header="XCP 连接配置" Margin="0,0,0,8"
|
||||
materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="CAN通道" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="60"
|
||||
ToolTip="TSMaster 通道号,0 起始"
|
||||
Text="{Binding CanChannel, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="CRO ID" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="90"
|
||||
ToolTip="命令发送 CAN ID(hex),如 0x7E0"
|
||||
Text="{Binding CroIdText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="DTO ID" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="90"
|
||||
ToolTip="响应/DAQ 接收 CAN ID(hex),如 0x7E8"
|
||||
Text="{Binding DtoIdText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="超时(ms)" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="70"
|
||||
ToolTip="XCP 命令响应超时时间"
|
||||
Text="{Binding CommandTimeoutMs, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="帧类型" Style="{StaticResource ParamLabel}" />
|
||||
<CheckBox Content="扩展帧 (29位ID)" IsChecked="{Binding IsExtendedFrame}"
|
||||
VerticalAlignment="Center" Margin="4,0" />
|
||||
<CheckBox Content="CAN FD" IsChecked="{Binding IsCanFd}"
|
||||
VerticalAlignment="Center" Margin="4,0" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<Button Content="XCP 连接" Command="{Binding XcpConnectCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
Background="#388E3C" Foreground="White"
|
||||
ToolTip="CONNECT 0x00:建立 XCP 逻辑连接(先连总线)" />
|
||||
<Button Content="XCP 断开" Command="{Binding XcpDisconnectCommand}"
|
||||
Style="{StaticResource WarnBtn}" />
|
||||
<Button Content="查询状态" Command="{Binding GetStatusCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
ToolTip="GET_STATUS:会话状态 / 已配置 DAQ 列表数 / 事件通道数" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding SlaveInfoText}"
|
||||
FontSize="12" Foreground="#1565C0"
|
||||
Margin="4,4,4,0" TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- ============ 内存读写 ============ -->
|
||||
<GroupBox Header="内存读写(SET_MTA / UPLOAD / DOWNLOAD)" Margin="0,0,0,8"
|
||||
materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="地址(hex)" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="110"
|
||||
ToolTip="从站内存地址,如 0x20000000"
|
||||
Text="{Binding MemAddressText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="读取长度" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="60"
|
||||
ToolTip="字节数,1~200"
|
||||
Text="{Binding MemReadLength, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="读取内存" Command="{Binding ReadMemoryCommand}"
|
||||
Style="{StaticResource CmdBtn}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,2">
|
||||
<TextBlock Text="读取结果" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox IsReadOnly="True" Width="420" Height="30" FontSize="12"
|
||||
FontFamily="Consolas" Background="#FAFAFA"
|
||||
VerticalContentAlignment="Center" Margin="4,0"
|
||||
Text="{Binding ReadResultText, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="写入数据" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="300"
|
||||
ToolTip="hex 字节序列(空格/逗号分隔),如 01 A2 FF 00"
|
||||
Text="{Binding MemWriteDataText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="写入内存" Command="{Binding WriteMemoryCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
Background="#388E3C" Foreground="White" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- ============ DAQ 采集 ============ -->
|
||||
<GroupBox Header="DAQ 采集(FREE_DAQ / ALLOC_DAQ / WRITE_DAQ / START_STOP)" Margin="0,0,0,8"
|
||||
materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel Margin="4">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="DAQ列表号" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="60"
|
||||
ToolTip="DAQ 列表编号(十进制,0 起始)"
|
||||
Text="{Binding DaqListNumber, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="事件通道" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="60"
|
||||
ToolTip="事件通道编号(十进制),决定采集触发源"
|
||||
Text="{Binding EventChannel, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="预分频" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="60"
|
||||
ToolTip="每 N 个事件采集一次(1=每个事件都采)"
|
||||
Text="{Binding Prescaler, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<TextBlock Text="ODT地址" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="110"
|
||||
ToolTip="要采集的信号在从站内存中的地址(hex)"
|
||||
Text="{Binding OdtAddressText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Text="长度" Style="{StaticResource ParamLabel}" />
|
||||
<TextBox Style="{StaticResource NumInput}" Width="50"
|
||||
ToolTip="信号长度(字节,1~64)"
|
||||
Text="{Binding OdtLength, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="配置 DAQ" Command="{Binding ConfigureDaqCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
Background="#388E3C" Foreground="White"
|
||||
ToolTip="释放并重新分配 DAQ 资源后写入 ODT 条目(会清空从站已有 DAQ 配置)" />
|
||||
<Button Content="启动 DAQ" Command="{Binding StartDaqCommand}"
|
||||
Style="{StaticResource CmdBtn}" />
|
||||
<Button Content="停止 DAQ" Command="{Binding StopDaqCommand}"
|
||||
Style="{StaticResource WarnBtn}" />
|
||||
</StackPanel>
|
||||
<Separator Margin="0,4" />
|
||||
<StackPanel Orientation="Horizontal" Margin="0,4">
|
||||
<Button Content="接收一帧 DTO" Command="{Binding ReceiveDtoCommand}"
|
||||
Style="{StaticResource CmdBtn}"
|
||||
ToolTip="从接收队列取一帧 DAQ 数据(500ms 超时);注意 DAQ 运行期间命令响应与 DTO 共用队列" />
|
||||
<TextBlock Text="{Binding DtoFrameCount, StringFormat='已收帧数: {0}'}"
|
||||
VerticalAlignment="Center" Margin="12,0,8,0"
|
||||
FontSize="12" Foreground="#616161" />
|
||||
<TextBox IsReadOnly="True" Width="380" Height="30" FontSize="12"
|
||||
FontFamily="Consolas" Background="#FAFAFA"
|
||||
VerticalContentAlignment="Center"
|
||||
ToolTip="最近收到的 DTO 帧原始数据(hex)"
|
||||
Text="{Binding LatestDtoText, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- ============ 日志 ============ -->
|
||||
<GroupBox Header="日志" materialDesign:ColorZoneAssist.Mode="PrimaryLight">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,4,2">
|
||||
<Button Content="清空日志" Command="{Binding ClearLogCommand}"
|
||||
Style="{StaticResource CmdBtn}" Height="26" />
|
||||
</StackPanel>
|
||||
<ScrollViewer Height="170" VerticalScrollBarVisibility="Auto">
|
||||
<TextBox Text="{Binding ResponseLog, Mode=OneWay}"
|
||||
IsReadOnly="True" TextWrapping="Wrap"
|
||||
FontSize="11" FontFamily="Consolas"
|
||||
Background="#FAFAFA" BorderThickness="0"
|
||||
VerticalAlignment="Top" />
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user