public void CanParseData_LocationMessage_SampleData1() { byte[] payloadByte = { 0x78, 0x78, 0x22, 0x22, 0x10, 0x02, 0x12, 0x13, 0x1D, 0x3B, 0xC6, 0x01, 0x2E, 0xE8, 0x44, 0x08, 0x42, 0xBF, 0x30, 0x00, 0x14, 0x00, 0x01, 0x94, 0x5E, 0x00, 0x4E, 0x00, 0x51, 0x2D, 0x01, 0x08, 0x00, 0x00, 0x05, 0x5A, 0xFB, 0x0D, 0x0A }; //string payLoad = "(014114564660BP05000014114564660160122A1058.2023N07737.1963E000.016260558.63000000178L04527024)"; Tracker.Protocol.Protocol protool = new Tracker.Protocol.Gt100Protocol(); DeviceInfo di = protool.Parse(new DeviceInfo() { RawData = payloadByte }); Assert.IsTrue(di.CommandType == DeviceCommandType.LocationData); Assert.IsTrue(di.DeviceDataTime == DateTime.Parse("2016-02-18 7:29:59 PM")); Assert.IsTrue(di.Direction == "0"); Assert.IsTrue(di.Latitude == "11.033253074"); Assert.IsTrue(di.Longitude == "76.999926370"); Assert.IsTrue(string.IsNullOrEmpty(di.Payload)); Assert.IsTrue(di.Speed == "00"); }
public void CanParseData_LocationMessage() { byte[] payloadByte = { 0x78, 0x78, 0x22, 0x22, 0x0B, 0x08, 0x1D, 0x11, 0x2E, 0x10, 0xCF, 0x02, 0x7A, 0xC7, 0xEB, 0x0C, 0x46, 0x58, 0x49, 0x00, 0x14, 0x8F, 0x01, 0xCC, 0x00, 0x28, 0x7D, 0x00, 0x1F, 0xB8, 0x01, 0x01, 0x00, 0x00, 0x03, 0xFE, 0x38, 0x0D, 0x0A }; //string payLoad = "(014114564660BP05000014114564660160122A1058.2023N07737.1963E000.016260558.63000000178L04527024)"; Tracker.Protocol.Protocol protool = new Tracker.Protocol.Gt100Protocol(); DeviceInfo di = protool.Parse(new DeviceInfo() { RawData = payloadByte }); Assert.IsTrue(di.CommandType == DeviceCommandType.LocationData); Assert.IsTrue(di.DeviceDataTime == DateTime.Parse("2011-08-29 5:46:16 PM")); Assert.IsTrue(di.Direction == "143"); Assert.IsTrue(di.Latitude == "23.116583361"); Assert.IsTrue(di.Longitude == "114.416543639"); Assert.IsTrue(string.IsNullOrEmpty(di.Payload)); Assert.IsTrue(di.Speed == "00"); }
public void CanParseData_LoginMessage() { byte[] payloadByte = { 0x78, 0x78, 0x11, 0x01, 0x01, 0x23, 0x45, 0x67, 0x89, 0x01, 0x23, 0x45, 0x20, 0x10, 0x32, 0x00, 0x00, 0x01, 0xA1, 0x21, 0x0D, 0x0 }; //string payLoad = "(014114564660BP05000014114564660160122A1058.2023N07737.1963E000.016260558.63000000178L04527024)"; Tracker.Protocol.Protocol protool = new Tracker.Protocol.Gt100Protocol(); DeviceInfo di = protool.Parse(new DeviceInfo() { RawData = payloadByte }); //Assert.IsTrue(di.TrackerId == "014114564660"); //Assert.IsTrue(di.CommandType == "BP05"); //Assert.IsTrue(di.DeviceId == "000014114564660"); ////di.TrackerDataActionTime = payload.Substring(0, 6); //160122 A1058.2023N07737.1963E000.016260558.63000000178L04527024)"; //Assert.IsTrue(di.ValidData == "A"); //Assert.IsTrue(di.Latitude == "1058.2023N"); //Assert.IsTrue(di.Longitude == "07737.1963E"); //Assert.IsTrue(di.Speed == "000.0"); //Assert.IsTrue(di.TrackerDataActionTime == "2016-01-22 16:26:05"); //Assert.IsTrue(di.Direction == "58.63"); //Assert.IsTrue(di.OnBattery == "0"); //Assert.IsTrue(di.OnIgnition == "0"); //Assert.IsTrue(di.OnAc == "0"); //Assert.IsTrue(di.UnKnown == "0"); //Assert.IsTrue(di.OnGps == "0"); //Assert.IsTrue(di.Mileage == "04527024"); }
public void CanParseData_LocationMessage_SampleData2() { byte[] payloadByte = { 0x78, 0x78, 0x22, 0x22, 0x10, 0x02, 0x12, 0x0C, 0x22, 0x00, 0xC4, 0x01, 0x2E, 0xE7, 0xF6, 0x08, 0x42, 0xC0, 0x00, 0x00, 0x14, 0x00, 0x01, 0x94, 0x5E, 0x00, 0x4E, 0x00, 0x51, 0x2D, 0x01, 0x05, 0x01, 0x00, 0x08, 0x4B, 0xC0, 0x0D, 0x0A }; //string payLoad = "(014114564660BP05000014114564660160122A1058.2023N07737.1963E000.016260558.63000000178L04527024)"; Tracker.Protocol.Protocol protool = new Tracker.Protocol.Gt100Protocol(); DeviceInfo di = protool.Parse(new DeviceInfo() { RawData = payloadByte }); Assert.IsTrue(di.CommandType == DeviceCommandType.LocationData); Assert.IsTrue(di.DeviceDataTime == DateTime.Parse("2016-02-18 12:34:00 PM")); Assert.IsTrue(di.Direction == "0"); Assert.IsTrue(di.Latitude == "11.033252352"); Assert.IsTrue(di.Longitude == "76.999928296"); Assert.IsTrue(string.IsNullOrEmpty(di.Payload)); Assert.IsTrue(di.Speed == "00"); }