IceCoffee.HJ212
1.0.1.1
See the version list below for details.
dotnet add package IceCoffee.HJ212 --version 1.0.1.1
NuGet\Install-Package IceCoffee.HJ212 -Version 1.0.1.1
<PackageReference Include="IceCoffee.HJ212" Version="1.0.1.1" />
paket add IceCoffee.HJ212 --version 1.0.1.1
#r "nuget: IceCoffee.HJ212, 1.0.1.1"
// Install IceCoffee.HJ212 as a Cake Addin #addin nuget:?package=IceCoffee.HJ212&version=1.0.1.1 // Install IceCoffee.HJ212 as a Cake Tool #tool nuget:?package=IceCoffee.HJ212&version=1.0.1.1
IceCoffee.HJ212
本仓库是根据《污染物在线监控(监测)系统数据传输标准 HJ 212-2017.pdf》文档,对接收到的212协议报文进行接收和解析。
HJ212协议简介
做环保相关的,有时需要对212协议进行拆包和解包。HJ212协议是一种字符串协议,数据传输通讯包主要由包头、数据段长度、数据段、CRC校验、包尾组成,其中“数据段”内容包括请求编码、系统编码、命令编码、密码、设备唯一标识、总包数、包号、指令参数。请求编码为请求的时间戳,系统编码ST统一规定为22,命令编码CN为该数据包的时间类型,访问密码、设备唯一标识在对接时由平台提供,指令参数为数据内容。通讯协议的数据结构如图4所示。 <center>图4 通讯协议的数据结构</center>
通讯包结构组成
名称 | 类型 | 长度 | 描述 |
---|---|---|---|
包头 | 字符 | 2 | 固定为## |
数据段长度 | 十进制整数 | 4 | 数据段的ASCII字符数。例如数据段的字符数为128,则写为“0128” |
数据段 | 字符 | 0<=n<=9999 | 变长的数据 |
CRC校验 | 十六进制 | 4 | 数据段的校验结果,例如C901,如果CRC错,即执行超时 |
包尾 | 字符 | 2 | 回车换行(\r\n) |
《污染物在线监控(监测)系统数据传输标准》简称《HJ212-2017》标准PDF文档可以从中华人民共和国生态环境部的官网下载,具体地址为:HJ212-2017》标准PDF文档 如下图所示: 目前HJ212标准协议已经发布了两个版本,一个是HJ/T 212-2005,另一个是 HJ 212-2017,最新的HJ 212-2017下载地址为:污染物在线监控(监测)系统数据传输标准(HJ 212-2017代替HJ/T 212-2005)
使用GB212类进行212协议包的解析,
例如有如下212协议数据报文:
##0285QN=20190925181031464;ST=22;CN=2061;PW=BF470F88957588DE902D1A52;MN=Z13401000010301;Flag=5;CP=&&DataTime=20190924220000;a34006-Avg=2.69700,a34006-Flag=N;a34007-Avg=7.96600,a34007-Flag=N;a34048-Avg=3.30600,a34048-Flag=N;a34047-Avg=7.35700,a34047-Flag=N;a34049-Avg=10.66300,a34049-Flag=N&&C181\r\n
关于HJ212项目
git clone https://github.com/1249993110/IceCoffee.HJ212.git
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETCoreApp 3.1
- IceCoffee.FastSocket (>= 1.0.2)
-
.NETFramework 4.6.2
- IceCoffee.FastSocket (>= 1.0.2)
-
net6.0
- IceCoffee.FastSocket (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.