public JT808_0x8900Test() { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); JT808Serializer = new JT808Serializer(jT808Config); }
public MyUnpacker() { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); _JT808Serializer = new JT808Serializer(jT808Config); }
public Demo5() { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); jT808Config.SkipCRCCode = true; JT808Serializer = new JT808Serializer(jT808Config); }
protected DeviceTypeBase(Dictionary <byte, byte[]> jT808CustomLocationAttachOriginalData) { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); JT808Serializer = new JT808Serializer(jT808Config); Execute(jT808CustomLocationAttachOriginalData); }
public Demo6() { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); //根据不同的设备终端号,添加自定义消息Id jT808Config.MsgIdFactory.CustomSetMap <DT1Demo6>(0x91, "1234567891"); jT808Config.MsgIdFactory.CustomSetMap <DT2Demo6>(0x91, "1234567892"); JT808Serializer = new JT808Serializer(jT808Config); }
public void Test1() { var result = Parallel.For(0, 100, new ParallelOptions { MaxDegreeOfParallelism = 2 }, (i) => { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); JT808Serializer jT808Serializer = new JT808Serializer(jT808Config); }); if (result.IsCompleted) { } }
public void Test1() { IJT808Config jT808Config = new DefaultGlobalConfig(); jT808Config.Register(Assembly.GetExecutingAssembly()); JT808Serializer demo5JT808Serializer = new JT808Serializer(jT808Config); JT808Package jT808Package = JT808MsgId.位置信息汇报.Create("123456789012", new JT808_0x0200 { AlarmFlag = 1, Altitude = 40, GPSTime = DateTime.Parse("2018-12-20 20:10:10"), Lat = 12222222, Lng = 132444444, Speed = 60, Direction = 0, StatusFlag = 2, JT808CustomLocationAttachData = new Dictionary <byte, JT808_0x0200_CustomBodyBase> { { 0x81, new JT808_0x0200_DT1_0x81 { Age = 15, Gender = 1, UserName = "******" } } } }); byte[] data = demo5JT808Serializer.Serialize(jT808Package); var jT808PackageResult = demo5JT808Serializer.Deserialize <JT808Package>(data); JT808_0x0200 jT808_0X0200 = jT808PackageResult.Bodies as JT808_0x0200; var attach = DeviceTypeFactory.Create(cache[jT808PackageResult.Header.TerminalPhoneNo], jT808_0X0200.JT808CustomLocationAttachOriginalData); var extJson = attach.ExtData.Data.ToString(Formatting.None); var attachinfo81 = (JT808_0x0200_DT1_0x81)attach.JT808CustomLocationAttachData[0x81]; Assert.Equal((uint)15, attachinfo81.Age); Assert.Equal(1, attachinfo81.Gender); Assert.Equal("smallchi", attachinfo81.UserName); }