修改212端口号和注释GT808数据内容
This commit is contained in:
parent
82cf538330
commit
c68f032f59
|
|
@ -54,38 +54,38 @@ namespace langguanApi.Service.HJ212
|
|||
|
||||
Console.WriteLine($"原始数据:{data}----------");
|
||||
Console.WriteLine($"原始数据HexString:{data.ToHexString()}--------------------");
|
||||
Console.WriteLine($"原始数据ASCII:{Encoding.ASCII.GetString(data)}-");
|
||||
//Console.WriteLine($"原始数据ASCII:{Encoding.ASCII.GetString(data)}-");
|
||||
|
||||
Position position = ParsePosition(data);
|
||||
//Position position = ParsePosition(data);
|
||||
|
||||
Console.WriteLine($"Latitude: {position.Latitude}");
|
||||
Console.WriteLine($"Longitude: {position.Longitude}");
|
||||
Console.WriteLine($"Altitude: {position.Altitude}");
|
||||
int offset = 0;
|
||||
// 解析消息头
|
||||
var header = ProtocolParser.ParseHeader(data, ref offset);
|
||||
Console.WriteLine($"Message ID: {header.MessageId}, Terminal ID: {header.TerminalId}");
|
||||
//Console.WriteLine($"Latitude: {position.Latitude}");
|
||||
//Console.WriteLine($"Longitude: {position.Longitude}");
|
||||
//Console.WriteLine($"Altitude: {position.Altitude}");
|
||||
//int offset = 0;
|
||||
//// 解析消息头
|
||||
//var header = ProtocolParser.ParseHeader(data, ref offset);
|
||||
//Console.WriteLine($"Message ID: {header.MessageId}, Terminal ID: {header.TerminalId}");
|
||||
|
||||
// 解析终端注册消息
|
||||
var registerMessage = ProtocolParser.ParseTerminalRegisterMessage(data, ref offset);
|
||||
Console.WriteLine($"Province ID: {registerMessage.ProvinceId}, City ID: {registerMessage.CityId}");
|
||||
Console.WriteLine($"License Plate: {registerMessage.LicensePlate}");
|
||||
//// 解析终端注册消息
|
||||
//var registerMessage = ProtocolParser.ParseTerminalRegisterMessage(data, ref offset);
|
||||
//Console.WriteLine($"Province ID: {registerMessage.ProvinceId}, City ID: {registerMessage.CityId}");
|
||||
//Console.WriteLine($"License Plate: {registerMessage.LicensePlate}");
|
||||
|
||||
offset = 0;
|
||||
// 解析位置信息汇报消息
|
||||
var locationReportMessage = ProtocolParser.ParseLocationReportMessage(data, ref offset);
|
||||
Console.WriteLine($"Latitude: {locationReportMessage.Latitude}, Longitude: {locationReportMessage.Longitude}");
|
||||
Console.WriteLine($"Speed: {locationReportMessage.Speed}, Time: {locationReportMessage.Time}");
|
||||
// offset = 0;
|
||||
//// 解析位置信息汇报消息
|
||||
//var locationReportMessage = ProtocolParser.ParseLocationReportMessage(data, ref offset);
|
||||
//Console.WriteLine($"Latitude: {locationReportMessage.Latitude}, Longitude: {locationReportMessage.Longitude}");
|
||||
//Console.WriteLine($"Speed: {locationReportMessage.Speed}, Time: {locationReportMessage.Time}");
|
||||
|
||||
|
||||
|
||||
|
||||
var jT808Package = new JT808Serializer().Deserialize(data);
|
||||
//4.数据包体
|
||||
JT808_0x0200 jT808_0x0200 = (JT808_0x0200)jT808Package.Bodies;
|
||||
var lon = jT808_0x0200.Lat;
|
||||
var lat = jT808_0x0200.Lng;
|
||||
Console.WriteLine("经度:" + lon + " 纬度:" + lat);
|
||||
//var jT808Package = new JT808Serializer().Deserialize(data);
|
||||
////4.数据包体
|
||||
//JT808_0x0200 jT808_0x0200 = (JT808_0x0200)jT808Package.Bodies;
|
||||
//var lon = jT808_0x0200.Lat;
|
||||
//var lat = jT808_0x0200.Lng;
|
||||
//Console.WriteLine("经度:" + lon + " 纬度:" + lat);
|
||||
rawText = Encoding.UTF8.GetString(data);
|
||||
NetPackage netPackage = NetPackage.Parse(rawText, GetUnpackCache);
|
||||
((NetServer)Server).RaiseReceivedData(this, netPackage, rawText);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace langguanApi.Service
|
|||
/// <summary>
|
||||
/// 服务端口号
|
||||
/// </summary>
|
||||
private int port => 5003;
|
||||
private int port => 5001;
|
||||
// 编码
|
||||
// private string code;
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue