예제 #1
0
 public JT808Package Receive()
 {
     do
     {
         if (_data.Count > 0)
         {
             var result = _data.First();
             _data.Remove(result);
             return(result);
         }
         var buffer = new byte[1024];
         var rlen   = _client.SocketStream.Read(buffer, 0, 1024);
         if (rlen > 0)
         {
             var data = buffer.AsSpan().Slice(0, rlen).ToArray();
             _jUnpacker.DeCode(data, (b) =>
             {
                 var package = new JT808Serializer().Deserialize <JT808Package>(b.AsSpan());
                 _data.Add(package);
             });
         }
         else
         {
             return(null);
         }
     }while (true);
 }
예제 #2
0
 private void _client_OnReceive(TCPClient <JUnpacker> arg1, byte[] arg2)
 {
     _jUnpacker.DeCode(arg2, (b) =>
     {
         var package = new JT808Serializer().Deserialize <JT808Package>(b.AsSpan());
         OnReceive.Invoke(this, package);
     });
 }
예제 #3
0
 private void ClientSokcet_OnReceive(byte[] data)
 {
     _jUnpacker.DeCode(data, (b) =>
     {
         var package = new JT808Serializer().Deserialize <JT808Package>(b.AsSpan());
         OnReceive.Invoke(this, package);
     });
 }