X13.Periphery.TWIDriver.SI7020.Recv C# (CSharp) Method

Recv() public method

public Recv ( byte buf ) : bool
buf byte
return bool
      public override bool Recv(byte[] buf) {
        if(buf[0]==ADDR) {
          if(buf[1]==0x10 && buf.Length==6) {
            if(_st==2) {
              _H.value=Math.Round(((buf[4]<<8) | (buf[5]))*125.0/65536-6, 1);
              _present.value=true;
              _pt=DateTime.Now;
              _st=3;
            } else if(_st==5) {
              _T.value=Math.Round(((buf[4]<<8) | (buf[5]))*175.72/65536-46.85, 2);
              _present.value=true;
              _pt=DateTime.Now.AddSeconds(_rand.Next(45, 75));
              _st=0;
            } else {
              _present.value=false;
              Reset();
            }
          } else {
            _present.value=false;
            if(TWIDriver._verbose) {
              Log.Error("{0}.recv - {1}", _T.path, (AckFlags)buf[1]);
            }
            _pt=DateTime.Now.AddSeconds(_rand.Next(135, 165));
            _st=0;
          }
          return true;
        }
        return false;
      }
      public override bool Poll(out byte[] buf) {