Browse Source

1.增加808分析工具接口

2.web增加808分析功能展示
pull/3/head
smallchi(Koike) 5 years ago
parent
commit
4ecb00f493
3 changed files with 80 additions and 24 deletions
  1. +23
    -0
      src/JTTools/Controllers/JTToolsController.cs
  2. +2
    -2
      src/JTTools/JTTools.csproj
  3. +55
    -22
      src/ui/jttools/src/App.vue

+ 23
- 0
src/JTTools/Controllers/JTToolsController.cs View File

@@ -61,6 +61,29 @@ namespace JTTools.Controllers
return jTResultDto;
}

[Route("Analyze808")]
[HttpPost]
public ActionResult<JTResultDto> Analyze808([FromBody]JTRequestDto parameter)
{
JTResultDto jTResultDto = new JTResultDto();
try
{
jTResultDto.Code = 200;
jTResultDto.Data = jT808Serializer.Analyze(parameter.HexData.ToHexBytes());
}
catch (JT808Exception ex)
{
jTResultDto.Code = 500;
jTResultDto.Message = $"{ex.ErrorCode}-{ex.Message}";
}
catch (Exception ex)
{
jTResultDto.Code = 500;
jTResultDto.Message = ex.Message;
}
return jTResultDto;
}

[Route("Parse809")]
[HttpPost]
public ActionResult<JTResultDto> Parse809([FromBody]JT809RequestDto parameter)


+ 2
- 2
src/JTTools/JTTools.csproj View File

@@ -12,12 +12,12 @@
<ItemGroup>
<!--<PackageReference Include="JT1078" Version="1.0.0" />-->
<PackageReference Include="JT1078" Version="1.0.2" />
<PackageReference Include="JT808" Version="2.2.5" />
<PackageReference Include="JT808" Version="2.2.6" />
<PackageReference Include="JT808.Protocol.Extensions.JT1078" Version="2.2.5" />
<PackageReference Include="JT808.Protocol.Extensions.JTActiveSafety" Version="1.0.0" />
<PackageReference Include="JT809" Version="2.1.3" />
<PackageReference Include="JT809.Protocol.Extensions.JT1078" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.6.1" />


+ 55
- 22
src/ui/jttools/src/App.vue View File

@@ -7,37 +7,18 @@
<ul class="ivu-menu ivu-menu-horizontal">
<div class="layout-logo">SmallChi</div>
<div class="layout-nav">
<!-- <li class="ivu-menu-item ">
<a href="index.html">首页</a>
</li>-->
<li class="ivu-menu-item ivu-menu-item-active ivu-menu-item-selected">
<a href="index.html" class>JTTools在线解析</a>
</li>
<!-- <li class="ivu-menu-item"><a href="update-notes.html"><i class="ivu-icon ivu-icon-ios-analytics"></i>
文档说明</a>
</li>-->
<li class="ivu-menu-item">
<iframe id="github-star" style="border:none;vertical-align: middle;" width="105" height="20" src="https://ghbtns.com/github-btn.html?user=SmallChi&amp;repo=JTTools&amp;type=watch&amp;count=true"></iframe>

</li>
<!-- <li class="ivu-menu-item">
<a href="update-notes.html">更新日志 </a>
</li>-->
</div>
</ul>
</div>
<!-- End header -->
<div class="ivu-layout-content" style="padding: 0px 70px;margin-top: 20px">
<!-- <div class="ivu-breadcrumb" style="margin: 20px 0px;"><span><span
class="ivu-breadcrumb-item-link">Home</span> <span
class="ivu-breadcrumb-item-separator">/</span></span> <span><span
class="ivu-breadcrumb-item-link">Components</span> <span
class="ivu-breadcrumb-item-separator">/</span></span> <span><span
class="ivu-breadcrumb-item-link">Layout</span> <span
class="ivu-breadcrumb-item-separator">/</span></span></div>-->
<div class="ivu-card ivu-card-bordered">
<!---->
<!---->
<div class="ivu-card-body">
<div style="min-height: 200px;">
<tabs value="name1">
@@ -61,6 +42,26 @@
</div>
</div>
</tab-pane>
<tab-pane :label="tabLabel" name="name4">
<div class="pane-content">
<div class="left">
<i-input
v-model="analyze808arameter.HexData"
type="textarea"
placeholder="Enter Hex Data..."
style="resize:none"
/>
</div>
<div class="center">
<i-button @click="analyze808Click" type="primary">
<Icon type="ios-arrow-forward" />
</i-button>
</div>
<div class="right">
<json-viewer copyable :expand-depth=5 :value="analyze808Result"></json-viewer>
</div>
</div>
</tab-pane>
<tab-pane label="JT809解析工具" name="name2">
<div class="pane-content">
<div class="left">
@@ -120,21 +121,34 @@ export default {
name: 'App',
data () {
return {
tabLabel: (h) => {
return h('div', [
h('span', 'JT808分析工具'),
h('Badge', {
props: {
dot: true
}
})
])
},
parse808Parameter: {
HexData: '7E 02 00 00 26 12 34 56 78 90 12 00 7D 02 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 10 15 10 10 10 01 04 00 00 00 64 02 02 00 7D 01 13 7E'
},
analyze808arameter: {
HexData: '7E 02 00 00 26 12 34 56 78 90 12 00 7D 02 00 00 00 01 00 00 00 02 00 BA 7F 0E 07 E4 F1 1C 00 28 00 3C 00 00 18 10 15 10 10 10 01 04 00 00 00 64 02 02 00 7D 01 13 7E'
},
parse809Parameter: {
HexData: '5B 00 00 00 92 00 00 06 82 94 00 01 33 EF B8 01 00 00 00 00 00 27 0F D4 C1 41 31 32 33 34 35 00 00 00 00 00 00 00 00 00 00 00 00 00 02 94 01 00 00 00 5C 01 00 02 00 00 00 00 5A 01 AC 3F 40 12 3F FA A1 00 00 00 00 5A 01 AC 4D 50 03 73 6D 61 6C 6C 63 68 69 00 00 00 00 00 00 00 00 31 32 33 34 35 36 37 38 39 30 31 00 00 00 00 00 00 00 00 00 31 32 33 34 35 36 40 71 71 2E 63 6F 6D 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 BA D8 5D'
},
parse1078Parameter: {
HexData: '30 31 63 64 81 E2 10 88 01 12 34 56 78 10 01 10 00 00 01 6B B3 92 CA 7C 02 80 00 28 00 2E 00 00 00 01 61 E1 A2 BF 00 98 CF C0 EE 1E 17 28 34 07 78 8E 39 A4 03 FD DB D1 D5 46 BF B0 63 01 3F 59 AC 34 C9 7A 02 1A B9 6A 28 A4 2C 08'
},
parse808ResultObject: {},
parse808Result: '',
analyze808Result: '',
parse809Result: '',
parse1078Result: '',
apiUrl: 'https://jttools.smallchi.cn/api'
//apiUrl: 'http://localhost:18888/api'
// apiUrl: 'http://localhost:18888/api'
}
},
mounted () {},
@@ -157,6 +171,24 @@ export default {
this.$Loading.error()
})
},
analyze808Click () {
if (!this.analyze808arameter) return
this.$Loading.start()
axios
.post(this.apiUrl + '/JTTools/Analyze808', this.analyze808arameter)
.then(response => {
if (response.data.Code === 200) {
this.analyze808Result = JSON.parse(response.data.Data)
} else {
this.analyze808Result = response.data.Message
}
this.$Loading.finish()
})
.catch(error => {
this.analyze808Result = JSON.stringify(error)
this.$Loading.error()
})
},
parse809Click () {
if (!this.parse809Parameter) return
this.$Loading.start()
@@ -226,7 +258,8 @@ export default {
height: 60px;
line-height: 60px;
}

.ivu-badge{top: -15px;
right: -10px;}
.ivu-menu-horizontal {
height: 60px;
line-height: 60px;


Loading…
Cancel
Save