@@ -0,0 +1,13 @@ | |||||
using JT808.Protocol.Interfaces; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Threading.Tasks; | |||||
namespace JTTools.Configs | |||||
{ | |||||
public class JT808_Streamax_Config : GlobalConfigBase | |||||
{ | |||||
public override string ConfigId { get; protected set; } = "JT808_Streamax_Config"; | |||||
} | |||||
} |
@@ -12,6 +12,7 @@ | |||||
<PackageReference Include="JT808" Version="2.2.12" /> | <PackageReference Include="JT808" Version="2.2.12" /> | ||||
<PackageReference Include="JT808.Protocol.Extensions.JT1078" Version="2.2.12" /> | <PackageReference Include="JT808.Protocol.Extensions.JT1078" Version="2.2.12" /> | ||||
<PackageReference Include="JT808.Protocol.Extensions.JTActiveSafety" Version="1.0.4" /> | <PackageReference Include="JT808.Protocol.Extensions.JTActiveSafety" Version="1.0.4" /> | ||||
<PackageReference Include="JT808.Protocol.Extensions.Streamax" Version="0.1.2" /> | |||||
<PackageReference Include="JT809" Version="2.1.4-preview5" /> | <PackageReference Include="JT809" Version="2.1.4-preview5" /> | ||||
<PackageReference Include="JT809.Protocol.Extensions.JT1078" Version="2.1.4-preview4" /> | <PackageReference Include="JT809.Protocol.Extensions.JT1078" Version="2.1.4-preview4" /> | ||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" /> | <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" /> | ||||
@@ -2,7 +2,8 @@ | |||||
<Title Level="1">JTTools</Title> | <Title Level="1">JTTools</Title> | ||||
<Paragraph> | <Paragraph> | ||||
<Title Level="3">JT808、JT809、JT1078、JT19056、JTNE(新能源)、主动安全(苏标)解析工具</Title> | |||||
<Text> | <Text> | ||||
JT808、JT809、JT1078、JT19056、JTNE(新能源)、主动安全(苏标)解析工具 | |||||
<Badge Color="red" />支持锐明808公交业务扩展协议 | |||||
</Text> | </Text> | ||||
</Paragraph> | </Paragraph> |
@@ -1,20 +1,27 @@ | |||||
@page "/jt1078pack" | @page "/jt1078pack" | ||||
@using OneOf; | |||||
<h3>JT1078扩展808、809组包</h3> | |||||
<Select DefaultValue="@MsgType" @bind-Value="@MsgType" Style="width:200px" OnChange="@OnSelectMsgType"> | |||||
<SelectOption Value="0x9101">808_打开看视频</SelectOption> | |||||
<SelectOption Value="0x9102">808_关闭看视频</SelectOption> | |||||
</Select> | |||||
<select class="form-control" Id="exampleFormControlSelect1" @onchange="@OnSelectMsgType"> | |||||
<option value="0x9101">808_打开看视频</option> | |||||
<option value="0x9102">808_关闭看视频</option> | |||||
</select> | |||||
<Button Type="primary" @onclick="@Pack">组包</Button> | |||||
@MsgType | |||||
待开发 | |||||
@code { | @code { | ||||
string MsgType = "0x9101"; | string MsgType = "0x9101"; | ||||
private void OnSelectMsgType(ChangeEventArgs e) | |||||
private void OnSelectMsgType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | |||||
OneOf<SelectOption, IEnumerable<SelectOption>> option) | |||||
{ | { | ||||
MsgType = e.Value.ToString(); | |||||
MsgType = value.Value.ToString(); | |||||
} | |||||
private void Pack() | |||||
{ | |||||
Console.WriteLine("pack"); | |||||
} | } | ||||
} | } |
@@ -4,12 +4,14 @@ | |||||
@using JT1078.Protocol.Extensions; | @using JT1078.Protocol.Extensions; | ||||
@using JTTools.Configs; | @using JTTools.Configs; | ||||
<button class="btn btn-primary" @onclick="Query">解析</button> | |||||
<Alert Type="@AlertType.Error" Closable> | |||||
@ErrerMessage | |||||
</Alert> | |||||
<Button Type="primary" @onclick="Query">分析</Button> | |||||
@if (isOpen) | |||||
{ | |||||
<Alert Type="@AlertType.Error" Description="@ErrerMessage" Closable AfterClose="OnDismiss" /> | |||||
} | |||||
<div class="right"> | <div class="right"> | ||||
<textarea class="form-control" @bind="HexData" rows="10"></textarea> | |||||
<TextArea AllowClear="true" AutoSize="true" MinRows="10" MaxRows="30" @bind-Value="@HexData" /> | |||||
<pre> | <pre> | ||||
@Json | @Json | ||||
</pre> | </pre> | ||||
@@ -28,7 +30,6 @@ | |||||
void OnDismiss() | void OnDismiss() | ||||
{ | { | ||||
isOpen = !isOpen; | isOpen = !isOpen; | ||||
StateHasChanged(); | |||||
} | } | ||||
private void Query() | private void Query() | ||||
@@ -4,18 +4,21 @@ | |||||
@using JT808.Protocol.Extensions; | @using JT808.Protocol.Extensions; | ||||
@using JTTools.Configs; | @using JTTools.Configs; | ||||
@inject IJT808Config Config | @inject IJT808Config Config | ||||
@using OneOf; | |||||
<select class="form-control" @onchange="@OnSelectWayType"> | |||||
<option value="up">上行</option> | |||||
<option value="down">下行</option> | |||||
</select> | |||||
<button class="btn btn-primary" @onclick="Query">分析</button> | |||||
<Select DefaultValue="@wayType" @bind-Value="@wayType" Style="width:100px" OnChange="@OnSelectWayType"> | |||||
<SelectOption Value="up">上行</SelectOption> | |||||
<SelectOption Value="down">下行</SelectOption> | |||||
</Select> | |||||
<Alert Type="@AlertType.Error" Closable> | |||||
@ErrerMessage | |||||
</Alert> | |||||
<Button Type="primary" @onclick="Query">分析</Button> | |||||
@if (isOpen) | |||||
{ | |||||
<Alert Type="@AlertType.Error" Description="@ErrerMessage" Closable AfterClose="OnDismiss" /> | |||||
} | |||||
<div class="right"> | <div class="right"> | ||||
<textarea class="form-control" @bind="HexData" rows="10"></textarea> | |||||
<TextArea AllowClear="true" AutoSize="true" MinRows="10" MaxRows="30" @bind-Value="@HexData" /> | |||||
<pre> | <pre> | ||||
@Json | @Json | ||||
</pre> | </pre> | ||||
@@ -32,9 +35,10 @@ | |||||
string wayType = "up"; | string wayType = "up"; | ||||
private void OnSelectWayType(ChangeEventArgs e) | |||||
private void OnSelectWayType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | |||||
OneOf<SelectOption, IEnumerable<SelectOption>> option) | |||||
{ | { | ||||
wayType = e.Value.ToString(); | |||||
wayType = value.Value.ToString(); | |||||
switch (wayType) | switch (wayType) | ||||
{ | { | ||||
case "up": | case "up": | ||||
@@ -57,7 +61,6 @@ | |||||
void OnDismiss() | void OnDismiss() | ||||
{ | { | ||||
isOpen = !isOpen; | isOpen = !isOpen; | ||||
StateHasChanged(); | |||||
} | } | ||||
protected override void OnInitialized() | protected override void OnInitialized() | ||||
@@ -88,4 +91,4 @@ | |||||
ErrerMessage = ex.StackTrace; | ErrerMessage = ex.StackTrace; | ||||
} | } | ||||
} | } | ||||
} | |||||
} |
@@ -10,12 +10,14 @@ | |||||
@inject IJT808Config config | @inject IJT808Config config | ||||
@inject JT808_JT1078_Config jT808_JT1078_Config | @inject JT808_JT1078_Config jT808_JT1078_Config | ||||
@inject JT808_JTActiveSafety_Config jT808_JTActiveSafety_Config | @inject JT808_JTActiveSafety_Config jT808_JTActiveSafety_Config | ||||
@inject JT808_Streamax_Config jT808_Streamax_Config | |||||
@using OneOf; | @using OneOf; | ||||
<Select DefaultValue=@("JT808") Style="width:200px" OnChange="OnSelectProtocolType"> | |||||
<Select DefaultValue="@protocolType" @bind-Value="@protocolType" Style="width:200px" OnChange="@OnSelectProtocolType"> | |||||
<SelectOption Value="JT808">国标</SelectOption> | <SelectOption Value="JT808">国标</SelectOption> | ||||
<SelectOption Value="JT808_JT1078">国标扩展JT1078</SelectOption> | <SelectOption Value="JT808_JT1078">国标扩展JT1078</SelectOption> | ||||
<SelectOption Value="JT808_JTAS">国标扩展主动安全(苏标)</SelectOption> | <SelectOption Value="JT808_JTAS">国标扩展主动安全(苏标)</SelectOption> | ||||
<SelectOption Value="JT808_JTRM">公交扩展协议(锐明)</SelectOption> | |||||
</Select> | </Select> | ||||
<Button Type="primary" @onclick="Query">分析</Button> | <Button Type="primary" @onclick="Query">分析</Button> | ||||
@@ -24,9 +26,7 @@ | |||||
@if (isOpen) | @if (isOpen) | ||||
{ | { | ||||
<Alert Type="@AlertType.Error" Closable AfterClose="OnDismiss"> | |||||
@ErrerMessage | |||||
</Alert> | |||||
<Alert Type="@AlertType.Error" Description="@ErrerMessage" Closable AfterClose="OnDismiss" /> | |||||
} | } | ||||
<div class="right"> | <div class="right"> | ||||
@@ -39,6 +39,8 @@ | |||||
private JT808Serializer Serializer; | private JT808Serializer Serializer; | ||||
private JT808Serializer JTRM_Serializer; | |||||
private JT808Serializer JTAS_Serializer; | private JT808Serializer JTAS_Serializer; | ||||
private JT808Serializer JT1078Serializer; | private JT808Serializer JT1078Serializer; | ||||
@@ -58,7 +60,7 @@ | |||||
isOpen = !isOpen; | isOpen = !isOpen; | ||||
} | } | ||||
private void OnSelectProtocolType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | |||||
private void OnSelectProtocolType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | |||||
OneOf<SelectOption, IEnumerable<SelectOption>> option) | OneOf<SelectOption, IEnumerable<SelectOption>> option) | ||||
{ | { | ||||
protocolType = value.Value.ToString(); | protocolType = value.Value.ToString(); | ||||
@@ -69,6 +71,7 @@ | |||||
Serializer = config.GetSerializer(); | Serializer = config.GetSerializer(); | ||||
JT1078Serializer = jT808_JT1078_Config.GetSerializer(); | JT1078Serializer = jT808_JT1078_Config.GetSerializer(); | ||||
JTAS_Serializer = jT808_JTActiveSafety_Config.GetSerializer(); | JTAS_Serializer = jT808_JTActiveSafety_Config.GetSerializer(); | ||||
JTRM_Serializer = jT808_Streamax_Config.GetSerializer(); | |||||
} | } | ||||
private void Query() | private void Query() | ||||
@@ -88,6 +91,9 @@ | |||||
case "JT808_JTAS": | case "JT808_JTAS": | ||||
Json = JTAS_Serializer.Analyze(data, options: JTJsonWriterOptions.Instance); | Json = JTAS_Serializer.Analyze(data, options: JTJsonWriterOptions.Instance); | ||||
break; | break; | ||||
case "JT808_JTRM": | |||||
Json = JTRM_Serializer.Analyze(data, options: JTJsonWriterOptions.Instance); | |||||
break; | |||||
} | } | ||||
} | } | ||||
catch (JT808Exception ex) | catch (JT808Exception ex) | ||||
@@ -9,36 +9,40 @@ | |||||
@using JTTools.Configs; | @using JTTools.Configs; | ||||
@using JT809.Protocol.Enums; | @using JT809.Protocol.Enums; | ||||
@using OneOf; | @using OneOf; | ||||
@using AntDesign; | |||||
@inject JT809_2011_Config Config2011 | @inject JT809_2011_Config Config2011 | ||||
@inject JT809_2019_Config Config2019 | @inject JT809_2019_Config Config2019 | ||||
<Select DefaultValue=@("v2011") Style="width:200px" OnSelect="OnSelectVersion"> | |||||
<Select DefaultValue="@version" @bind-Value="@version" Style="width:200px" OnChange="@OnSelectVersion"> | |||||
<SelectOption Value="v2011">2011版本</SelectOption> | <SelectOption Value="v2011">2011版本</SelectOption> | ||||
<SelectOption Value="v2019">2019版本</SelectOption> | <SelectOption Value="v2019">2019版本</SelectOption> | ||||
</Select> | </Select> | ||||
<Select DefaultValue=@("none") Style="width:200px" OnChange="@OnSelectEncryptType"> | |||||
<Select DefaultValue="@encryptType" @bind-Value="@encryptType" Style="width:200px" OnChange="@OnSelectEncryptType"> | |||||
<SelectOption Value="none">未加密</SelectOption> | <SelectOption Value="none">未加密</SelectOption> | ||||
<SelectOption Value="encrypt">加密</SelectOption> | <SelectOption Value="encrypt">加密</SelectOption> | ||||
</Select> | </Select> | ||||
@if (encryptType == "encrypt") | @if (encryptType == "encrypt") | ||||
{ | { | ||||
@*<Input Placeholder="M1" @bind-Value="@M1" /> | |||||
<Input Placeholder="IA1" @bind-Value="@IA1" /> | |||||
<Input Placeholder="IC1" @bind-Value="@IC1" />*@ | |||||
<AntDesign.Input @bind-Value="@M1"> | |||||
<AddOnBefore>M1</AddOnBefore> | |||||
</AntDesign.Input> | |||||
<AntDesign.Input @bind-Value="@IA1"> | |||||
<AddOnBefore>IA1</AddOnBefore> | |||||
</AntDesign.Input> | |||||
<AntDesign.Input @bind-Value="@IC1"> | |||||
<AddOnBefore>IC1</AddOnBefore> | |||||
</AntDesign.Input> | |||||
} | } | ||||
<Button Type="primary" @onclick="Query">分析</Button> | <Button Type="primary" @onclick="Query">分析</Button> | ||||
@if (isOpen) | @if (isOpen) | ||||
{ | { | ||||
<Alert Type="@AlertType.Error" Closable AfterClose="OnDismiss"> | |||||
@ErrerMessage | |||||
</Alert> | |||||
<Alert Type="@AlertType.Error" Description="@ErrerMessage" Closable AfterClose="OnDismiss" /> | |||||
} | } | ||||
@HexData | |||||
<div class="right"> | <div class="right"> | ||||
<TextArea AllowClear="true" AutoSize="true" MinRows="10" MaxRows="30" @bind-Value="@HexData" /> | <TextArea AllowClear="true" AutoSize="true" MinRows="10" MaxRows="30" @bind-Value="@HexData" /> | ||||
<pre> | <pre> | ||||
@@ -54,7 +58,7 @@ | |||||
private string HexData2019 = "5B 00 00 00 C9 00 00 06 82 17 00 01 34 15 F4 01 00 00 00 00 00 27 0F 00 00 00 00 5E 02 A5 07 B8 D4 C1 41 31 32 33 34 35 00 00 00 00 00 00 00 00 00 00 00 00 00 02 17 01 00 00 00 8B 01 02 03 04 05 06 07 08 09 10 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E7 D3 5D"; | private string HexData2019 = "5B 00 00 00 C9 00 00 06 82 17 00 01 34 15 F4 01 00 00 00 00 00 27 0F 00 00 00 00 5E 02 A5 07 B8 D4 C1 41 31 32 33 34 35 00 00 00 00 00 00 00 00 00 00 00 00 00 02 17 01 00 00 00 8B 01 02 03 04 05 06 07 08 09 10 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E7 D3 5D"; | ||||
private string HexData = ""; | |||||
private string HexData = ""; | |||||
private string Json; | private string Json; | ||||
@@ -68,29 +72,28 @@ | |||||
private bool isOpen = false; | private bool isOpen = false; | ||||
private uint? M1; | |||||
private uint? IA1; | |||||
private uint? IC1; | |||||
private long M1; | |||||
private long IA1; | |||||
private long IC1; | |||||
void OnDismiss() | void OnDismiss() | ||||
{ | { | ||||
isOpen = !isOpen; | isOpen = !isOpen; | ||||
StateHasChanged(); | |||||
} | } | ||||
public void OnSelectVersion(OneOf<string, LabeledValue> value, SelectOption option) | |||||
public void OnSelectVersion(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | |||||
OneOf<SelectOption, IEnumerable<SelectOption>> option) | |||||
{ | { | ||||
HexData = new Random().Next(1, 100).ToString(); | |||||
//this.version = value.Value.ToString(); | |||||
//switch (version) | |||||
//{ | |||||
// case "v2011": | |||||
// this.HexData = HexData2011; | |||||
// break; | |||||
// case "v2019": | |||||
// this.HexData = HexData2019; | |||||
// break; | |||||
//} | |||||
this.version = value.Value.ToString(); | |||||
switch (version) | |||||
{ | |||||
case "v2011": | |||||
this.HexData = HexData2011; | |||||
break; | |||||
case "v2019": | |||||
this.HexData = HexData2019; | |||||
break; | |||||
} | |||||
} | } | ||||
private void OnSelectEncryptType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | private void OnSelectEncryptType(OneOf<string, IEnumerable<string>, LabeledValue, IEnumerable<LabeledValue>> value, | ||||
@@ -123,12 +126,12 @@ | |||||
else | else | ||||
{ | { | ||||
IJT809Config jt809ConfigInternal = new JT809Config2011(Guid.NewGuid().ToString()); | IJT809Config jt809ConfigInternal = new JT809Config2011(Guid.NewGuid().ToString()); | ||||
SetEncryptOptions(); | |||||
jt809ConfigInternal.EncryptOptions = EncryptOptions; | jt809ConfigInternal.EncryptOptions = EncryptOptions; | ||||
JT809Serializer jT809SerializerInternal = new JT809Serializer(jt809ConfigInternal); | JT809Serializer jT809SerializerInternal = new JT809Serializer(jt809ConfigInternal); | ||||
Json = jT809SerializerInternal.Analyze(data, JTJsonWriterOptions.Instance); | Json = jT809SerializerInternal.Analyze(data, JTJsonWriterOptions.Instance); | ||||
} | } | ||||
break; | break; | ||||
case "v2019": | case "v2019": | ||||
if (encryptType == "none") | if (encryptType == "none") | ||||
{ | { | ||||
@@ -137,6 +140,7 @@ | |||||
else | else | ||||
{ | { | ||||
IJT809Config jt809ConfigInternal = new JT809Config2019(Guid.NewGuid().ToString()); | IJT809Config jt809ConfigInternal = new JT809Config2019(Guid.NewGuid().ToString()); | ||||
SetEncryptOptions(); | |||||
jt809ConfigInternal.EncryptOptions = EncryptOptions; | jt809ConfigInternal.EncryptOptions = EncryptOptions; | ||||
JT809Serializer jT809SerializerInternal = new JT809Serializer(jt809ConfigInternal); | JT809Serializer jT809SerializerInternal = new JT809Serializer(jt809ConfigInternal); | ||||
Json = jT809SerializerInternal.Analyze(data, JTJsonWriterOptions.Instance); | Json = jT809SerializerInternal.Analyze(data, JTJsonWriterOptions.Instance); | ||||
@@ -158,6 +162,13 @@ | |||||
} | } | ||||
} | } | ||||
private void SetEncryptOptions() | |||||
{ | |||||
EncryptOptions.M1 = (uint)M1; | |||||
EncryptOptions.IA1 = (uint)IA1; | |||||
EncryptOptions.IC1 = (uint)IC1; | |||||
} | |||||
class JT809Config2011 : JT809GlobalConfigBase | class JT809Config2011 : JT809GlobalConfigBase | ||||
{ | { | ||||
public JT809Config2011(string configId) | public JT809Config2011(string configId) | ||||
@@ -12,6 +12,7 @@ using Microsoft.Extensions.DependencyInjection; | |||||
using Newtonsoft.Json.Serialization; | using Newtonsoft.Json.Serialization; | ||||
using JTTools.Configs; | using JTTools.Configs; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using JT808.Protocol.Extensions.Streamax; | |||||
namespace JTTools | namespace JTTools | ||||
{ | { | ||||
@@ -82,6 +83,8 @@ namespace JTTools | |||||
.AddJT1078Configure(); | .AddJT1078Configure(); | ||||
services.AddJT809Configure(new JT809_2019_Config()) | services.AddJT809Configure(new JT809_2019_Config()) | ||||
.AddJT1078Configure(); | .AddJT1078Configure(); | ||||
services.AddJT808Configure(new JT808_Streamax_Config()) | |||||
.AddStreamaxConfigure(); | |||||
}) | }) | ||||
.Build() | .Build() | ||||
.Run(); | .Run(); | ||||
@@ -15,7 +15,7 @@ | |||||
</Sider> | </Sider> | ||||
<Layout> | <Layout> | ||||
<Header Class="site-layout-sub-header-background" Style="padding: 0;"> | <Header Class="site-layout-sub-header-background" Style="padding: 0;"> | ||||
<iframe id="github-star" style="border:none;vertical-align: middle;" width="105" height="20" src="https://ghbtns.com/github-btn.html?user=SmallChi&repo=JTTools&type=watch&count=true"></iframe> | |||||
<iframe id="github-star" style="border:none;vertical-align: middle;position:absolute;right:50px;top:25px;" width="105" height="20" src="https://ghbtns.com/github-btn.html?user=SmallChi&repo=JTTools&type=watch&count=true"></iframe> | |||||
</Header> | </Header> | ||||
<Content Style=" margin: 24px 16px 0;"> | <Content Style=" margin: 24px 16px 0;"> | ||||
<div class="site-layout-background" style="padding: 24px; min-height: 360px"> | <div class="site-layout-background" style="padding: 24px; min-height: 360px"> | ||||