Example #1
0
        private void Update()
        {
            string str = "\t";

            if ((this.sx1231 != null) && this.state)
            {
                if ((this.samples < this.maxSamples) || (this.maxSamples == 0L))
                {
                    str = ((((str + DateTime.Now.ToString("HH:mm:ss.fff", this.ci) + "\t") + ((this.sx1231.Mode == OperatingModeEnum.Tx) ? "Tx\t" : ((this.sx1231.Mode == OperatingModeEnum.Rx) ? "Rx\t" : "\t")) + ((this.sx1231.Mode == OperatingModeEnum.Rx) ? (this.sx1231.Packet.Rssi.ToString("F1") + "\t") : "\t")) + this.maxPacketNumber.ToString() + "\t") + this.packetNumber.ToString() + "\t") + this.sx1231.Packet.PreambleSize.ToString() + "\t";
                    MaskValidationType type = new MaskValidationType(this.sx1231.Packet.SyncValue);
                    str = (str + type.StringValue + "\t") + this.sx1231.Packet.MessageLength.ToString("X02") + "\t";
                    if (this.sx1231.Mode == OperatingModeEnum.Rx)
                    {
                        str = str + ((this.sx1231.Packet.AddressFiltering != AddressFilteringEnum.OFF) ? this.sx1231.Packet.NodeAddressRx.ToString("X02") : "");
                    }
                    else
                    {
                        str = str + ((this.sx1231.Packet.AddressFiltering != AddressFilteringEnum.OFF) ? this.sx1231.Packet.NodeAddress.ToString("X02") : "");
                    }
                    str = str + "\t";
                    if ((this.sx1231.Packet.Message != null) && (this.sx1231.Packet.Message.Length != 0))
                    {
                        int index = 0;
                        while (index < (this.sx1231.Packet.Message.Length - 1))
                        {
                            str = str + this.sx1231.Packet.Message[index].ToString("X02") + "-";
                            index++;
                        }
                        str = str + this.sx1231.Packet.Message[index].ToString("X02") + "\t";
                    }
                    str = str + (this.sx1231.Packet.CrcOn ? (((this.sx1231.Packet.Crc >> 8)).ToString("X02") + "-" + ((this.sx1231.Packet.Crc & 0xff)).ToString("X02") + "\t") : "\t");
                    this.streamWriter.WriteLine(str);
                    if (this.maxSamples != 0L)
                    {
                        this.samples += (ulong)1L;
                        this.OnProgressChanged((ulong)((this.samples * 100M) / this.maxSamples));
                    }
                    else
                    {
                        this.OnProgressChanged(0L);
                    }
                }
                else
                {
                    this.OnStop();
                }
            }
        }
Example #2
0
 private void Update()
 {
     string str = "\t";
     if ((this.sx1231 != null) && this.state)
     {
         if ((this.samples < this.maxSamples) || (this.maxSamples == 0L))
         {
             str = ((((str + DateTime.Now.ToString("HH:mm:ss.fff", this.ci) + "\t") + ((this.sx1231.Mode == OperatingModeEnum.Tx) ? "Tx\t" : ((this.sx1231.Mode == OperatingModeEnum.Rx) ? "Rx\t" : "\t")) + ((this.sx1231.Mode == OperatingModeEnum.Rx) ? (this.sx1231.Packet.Rssi.ToString("F1") + "\t") : "\t")) + this.maxPacketNumber.ToString() + "\t") + this.packetNumber.ToString() + "\t") + this.sx1231.Packet.PreambleSize.ToString() + "\t";
             MaskValidationType type = new MaskValidationType(this.sx1231.Packet.SyncValue);
             str = (str + type.StringValue + "\t") + this.sx1231.Packet.MessageLength.ToString("X02") + "\t";
             if (this.sx1231.Mode == OperatingModeEnum.Rx)
             {
                 str = str + ((this.sx1231.Packet.AddressFiltering != AddressFilteringEnum.OFF) ? this.sx1231.Packet.NodeAddressRx.ToString("X02") : "");
             }
             else
             {
                 str = str + ((this.sx1231.Packet.AddressFiltering != AddressFilteringEnum.OFF) ? this.sx1231.Packet.NodeAddress.ToString("X02") : "");
             }
             str = str + "\t";
             if ((this.sx1231.Packet.Message != null) && (this.sx1231.Packet.Message.Length != 0))
             {
                 int index = 0;
                 while (index < (this.sx1231.Packet.Message.Length - 1))
                 {
                     str = str + this.sx1231.Packet.Message[index].ToString("X02") + "-";
                     index++;
                 }
                 str = str + this.sx1231.Packet.Message[index].ToString("X02") + "\t";
             }
             str = str + (this.sx1231.Packet.CrcOn ? (((this.sx1231.Packet.Crc >> 8)).ToString("X02") + "-" + ((this.sx1231.Packet.Crc & 0xff)).ToString("X02") + "\t") : "\t");
             this.streamWriter.WriteLine(str);
             if (this.maxSamples != 0L)
             {
                 this.samples += (ulong) 1L;
                 this.OnProgressChanged((ulong) ((this.samples * 100M) / this.maxSamples));
             }
             else
             {
                 this.OnProgressChanged(0L);
             }
         }
         else
         {
             this.OnStop();
         }
     }
 }