using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Timers;
using System.Windows.Forms;
using QCRPG.Framework;
using QCRPG.TSL.ZigBee.Packets;

namespace QCRPG.TSL.ZigBee;

public class ZigBeeDataTransferUserControl : UserControlBase, QCRPG.Framework.IObserver<PacketBase>
{
	private const int receiveDataMaxRetries = 3;

	private const int timerInterval = 1000;

	private Logger logger;

	private ZigBeeMainWorkerThread zigBeeMainWorkerThread;

	private ZigBeeRemoteDeviceInfo remoteDeviceList;

	private ZigBeeAPI zigBeeApi;

	private int totalReceivedBytes;

	private int receivedPackets;

	private int totalTransmittedBytes;

	private int transmittedPackets;

	private int missingAckPackets;

	private int chAccessFailPackets;

	private double lastReceivedBytes;

	private double lastTransmittedBytes;

	private System.Timers.Timer transmitDataTimer = new System.Timers.Timer();

	private System.Timers.Timer receiveDataTimer = new System.Timers.Timer();

	private StopWatch txStopwatch = new StopWatch();

	private StopWatch rxStopwatch = new StopWatch();

	private StopWatch rxDurationStopwatch = new StopWatch();

	private StopWatch txDurationStopwatch = new StopWatch();

	private ZigBeeGooier zigBeeGooier;

	private bool isAssociatedTest = true;

	private long localAddress;

	private long dstAddress = 65534L;

	private uint msduLength = 5u;

	private uint msduHandle = 1u;

	private uint dstPanId = 6826u;

	private uint localPanId = 6826u;

	private uint channelId = 20u;

	private uint numPacketsToSend;

	private bool sequentialDataEnabled;

	private bool checkReceiveDataIntegrity = true;

	private bool continuousDataEnabled = true;

	private bool ackTx = true;

	private bool gtsTx;

	private bool indirectTx;

	private int dataPattern = 85;

	private DutaddressmodeEnum dstAddressMode = DutaddressmodeEnum.ShortAddress_16_BIT;

	private DutaddressmodeEnum localAddressMode = DutaddressmodeEnum.ShortAddress_16_BIT;

	private int remoteDataLength = 65535;

	private int remoteDataPattern = 85;

	private bool remoteSequentialDataEnabled;

	private bool remoteCheckReceiveDataIntegrityEnable;

	private int receiveDataRetries;

	private ulong remoteAddress;

	private DutaddressmodeEnum remoteAddrMode;

	private IContainer components;

	private Button dataTransfer15p4OptionsButton;

	private Button dataTransfer15p4StartTxButton;

	private Button dataTransfer15p4StopTxButton;

	private GroupBox groupBoxReceive;

	private TextBox textBoxRxPackets;

	private GroupBox groupBoxTransmit;

	private TextBox textBoxTxPackets;

	private Label txDataPacketsLabel;

	private TextBox textBoxTxBytes;

	private Label dataBytesLabel;

	private Label rxDataPacketsLabel;

	private TextBox textBoxRxBytes;

	private Label rxDataBytesLabel;

	private Button dataTransfer15p4StartRxButton;

	private TextBox textBoxTxDataRate;

	private Label label1;

	private TextBox textBoxRxDataRate;

	private Label label2;

	private TextBox packetsMissingAckTextBox;

	private Label labelPacketsMissingAck;

	private TextBox rxTransferDurationTextBox;

	private Label labelRxDataTransferDuration;

	private TextBox txTransferDurationTextBox;

	private Label labelTxDataTransferDuration;

	private TextBox chAccessFailTextBox;

	private Label labelPacketsChAccessFail;

	public uint LocalPanId => localPanId;

	public uint ChannelId => channelId;

	public ZigBeeDataTransferUserControl(ZigBeeMainWorkerThread zigBeeMainWorkerThread, ZigBeeGooier zigBeeGooier, Logger logger, ZigBeeAPI zigBeeApi, ZigBeeRemoteDeviceInfo remoteDeviceList)
		: base("15.4 Data Transfer")
	{
		InitializeComponent();
		this.zigBeeMainWorkerThread = zigBeeMainWorkerThread;
		this.zigBeeGooier = zigBeeGooier;
		this.logger = logger;
		this.zigBeeApi = zigBeeApi;
		this.remoteDeviceList = remoteDeviceList;
		transmitDataTimer.Interval = 1000.0;
		transmitDataTimer.Enabled = false;
		transmitDataTimer.Elapsed += transmitDataTimer_Elapsed;
		receiveDataTimer.Interval = 1000.0;
		receiveDataTimer.Enabled = false;
		receiveDataTimer.Elapsed += receiveDataTimer_Elapsed;
		zigBeeMainWorkerThread.TransmitDataTransferHandler += zigBeeMainWorkerThread_TransmitDataTransferHandler;
		zigBeeMainWorkerThread.EndDataTransferEventHandler += zigBeeMainWorkerThread_EndDataTransferHandler;
		zigBeeMainWorkerThread.UpdatePacketsMissingAckHandler += zigBeeMainWorkerThread_UpdateNoAckPacketsHandler;
		zigBeeMainWorkerThread.UpdatePacketsChAccessFailureHandler += zigBeeMainWorkerThread_UpdateChAccessFailPacketsHandler;
		if (isAssociatedTest)
		{
			dataTransfer15p4StartTxButton.Enabled = false;
		}
		else
		{
			dataTransfer15p4StartTxButton.Enabled = true;
		}
	}

	private void zigBeeMainWorkerThread_UpdateChAccessFailPacketsHandler(object sender)
	{
		chAccessFailPackets++;
	}

	private void zigBeeMainWorkerThread_UpdateNoAckPacketsHandler(object sender)
	{
		missingAckPackets++;
	}

	private void zigBeeMainWorkerThread_TransmitDataTransferHandler(object sender, int transmitByteCount, int transmitPacketCount)
	{
		totalTransmittedBytes = transmitByteCount;
		transmittedPackets = transmitPacketCount;
	}

	private void zigBeeMainWorkerThread_EndDataTransferHandler(object sender)
	{
		dataTransfer15p4StartTxButton.Enabled = true;
		dataTransfer15p4StopTxButton.Enabled = false;
		transmitDataTimer.Enabled = false;
		if (!isAssociatedTest)
		{
			zigBeeGooier.ZigBeeUpdateConnectionStatus((ulong)dstAddress, dstAddressMode, isConnected: false);
			zigBeeGooier.disconnectingDataTransfer = true;
		}
		zigBeeMainWorkerThread.SetDecodePacket(decodePacket: true, packetResponse: true, conciseLog: false);
		if (missingAckPackets > 0)
		{
			missingAckPackets--;
		}
		UpdateView(packetsMissingAckTextBox, missingAckPackets);
		UpdateView(textBoxTxBytes, totalTransmittedBytes);
		UpdateView(textBoxTxPackets, transmittedPackets);
		UpdateView(chAccessFailTextBox, chAccessFailPackets);
	}

	private void receiveDataTimer_Elapsed(object sender, ElapsedEventArgs e)
	{
		double totalMilliseconds = rxStopwatch.GetElapsedTime().TotalMilliseconds;
		double num = (double)totalReceivedBytes - lastReceivedBytes;
		lastReceivedBytes = totalReceivedBytes;
		if (receiveDataRetries >= 3)
		{
			receiveDataTimer.Enabled = false;
			if (!isAssociatedTest)
			{
				zigBeeGooier.ZigBeeUpdateConnectionStatus(remoteAddress, remoteAddrMode, isConnected: false);
			}
			zigBeeMainWorkerThread.SetDecodePacket(decodePacket: true, packetResponse: true, conciseLog: false);
			zigBeeGooier.disconnectingDataTransfer = true;
			logger.Enqueue(new LogMessage(LogMessageType.Verbose, "No data received for " + 3000 + " ms. Aborting receiver."));
		}
		else if (num == 0.0)
		{
			receiveDataRetries++;
		}
		else
		{
			rxStopwatch.Reset();
			UpdateView(textBoxRxBytes, totalReceivedBytes);
			UpdateView(textBoxRxPackets, receivedPackets);
			UpdateDurationView(rxTransferDurationTextBox, rxDurationStopwatch.GetElapsedTime());
			UpdateDataRateView(textBoxRxDataRate, num, totalMilliseconds);
		}
	}

	private void transmitDataTimer_Elapsed(object sender, ElapsedEventArgs e)
	{
		TimeSpan elapsedTime = txStopwatch.GetElapsedTime();
		double value = (double)totalTransmittedBytes - lastTransmittedBytes;
		lastTransmittedBytes = totalTransmittedBytes;
		txStopwatch.Reset();
		UpdateDataRateView(textBoxTxDataRate, value, elapsedTime.TotalMilliseconds);
		UpdateView(textBoxTxBytes, totalTransmittedBytes);
		UpdateView(textBoxTxPackets, transmittedPackets);
		UpdateView(packetsMissingAckTextBox, missingAckPackets);
		UpdateDurationView(txTransferDurationTextBox, txDurationStopwatch.GetElapsedTime());
		UpdateView(chAccessFailTextBox, chAccessFailPackets);
	}

	public void UpdateView(TextBox textBox, int value)
	{
		if (textBox.InvokeRequired)
		{
			textBox.Invoke((MethodInvoker)delegate
			{
				UpdateView(textBox, value);
			});
		}
		else
		{
			textBox.Text = value.ToString();
		}
	}

	public void UpdateDurationView(TextBox textBox, TimeSpan value)
	{
		if (textBox.InvokeRequired)
		{
			textBox.Invoke((MethodInvoker)delegate
			{
				UpdateDurationView(textBox, value);
			});
		}
		else
		{
			textBox.Text = value.ToString("dd\\.hh\\:mm\\:ss");
		}
	}

	public void UpdateDataRateView(TextBox textBox, double value, double timeElapse)
	{
		if (textBox.InvokeRequired)
		{
			textBox.Invoke((MethodInvoker)delegate
			{
				UpdateDataRateView(textBox, value, timeElapse);
			});
			return;
		}
		double num = 0.0;
		if (timeElapse != 0.0)
		{
			num = value * 8.0 / timeElapse;
		}
		textBox.Text = num.ToString("F3");
	}

	public void NotifyObserver(PacketBase packet)
	{
		if (!(packet is McpsDataIndication))
		{
			return;
		}
		McpsDataIndication mcpsDataIndication = packet as McpsDataIndication;
		uint msdulength = mcpsDataIndication._UserFields.Msdulength;
		List<uint> msdudataList = mcpsDataIndication._UserFields.MsdudataList;
		bool flag = msdudataList.Count >= 4;
		remoteAddress = mcpsDataIndication._UserFields.Srcaddr;
		remoteAddrMode = mcpsDataIndication._UserFields.GetSrcaddrmodeAsDutaddressmodeEnum();
		if (flag && msdudataList[2] == 221 && msdudataList[3] == 221)
		{
			remoteDataLength = (int)msdudataList[8];
			remoteDataPattern = (int)msdudataList[9];
			remoteSequentialDataEnabled = msdudataList[10] == 1;
			remoteCheckReceiveDataIntegrityEnable = msdudataList[11] == 1;
			if (msdudataList[12] == 1)
			{
				receiveDataTimer.Enabled = true;
				rxStopwatch.Reset();
				rxDurationStopwatch.Reset();
				receivedPackets = 0;
				totalReceivedBytes = 0;
				lastReceivedBytes = 0.0;
				zigBeeGooier.ZigBeeUpdateConnectionStatus(remoteAddress, remoteAddrMode, isConnected: true);
				zigBeeMainWorkerThread.SetDecodePacket(decodePacket: false, packetResponse: false, conciseLog: true);
			}
			else if (msdudataList[12] == 0)
			{
				receiveDataTimer.Enabled = false;
				if (!isAssociatedTest)
				{
					zigBeeGooier.ZigBeeUpdateConnectionStatus(remoteAddress, remoteAddrMode, isConnected: false);
					zigBeeGooier.disconnectingDataTransfer = true;
				}
				UpdateView(textBoxRxBytes, totalReceivedBytes);
				UpdateView(textBoxRxPackets, receivedPackets);
				logger.Enqueue(new LogMessage(LogMessageType.Verbose, "Received stop data transfer message from remote."));
				zigBeeMainWorkerThread.SetDecodePacket(decodePacket: true, packetResponse: true, conciseLog: false);
				remoteCheckReceiveDataIntegrityEnable = false;
			}
			else if (msdudataList[12] == 2)
			{
				receiveDataTimer.Enabled = false;
				transmitDataTimer.Enabled = false;
				if (!isAssociatedTest)
				{
					zigBeeGooier.ZigBeeUpdateConnectionStatus(remoteAddress, remoteAddrMode, isConnected: false);
					zigBeeGooier.disconnectingDataTransfer = true;
				}
				dataTransfer15p4StartTxButton.Enabled = true;
				dataTransfer15p4StopTxButton.Enabled = false;
				zigBeeMainWorkerThread.StopRemoteDataTransfer();
				zigBeeMainWorkerThread.SetDecodePacket(decodePacket: true, packetResponse: true, conciseLog: false);
				remoteCheckReceiveDataIntegrityEnable = false;
				logger.Enqueue(new LogMessage(LogMessageType.Error, "Received stop remote data transfer packet, stop transmitting."));
			}
		}
		else
		{
			if (!remoteCheckReceiveDataIntegrityEnable)
			{
				return;
			}
			if (remoteSequentialDataEnabled)
			{
				for (int i = 0; i < msdulength; i++)
				{
					if (msdudataList[i] != i)
					{
						zigBeeMainWorkerThread.StopRemoteDataTransfer((int)msduHandle, localAddressMode, remoteAddrMode, (uint)remoteAddress, dstPanId, msdulength, msduLength, dataPattern, continuousDataEnabled, sequentialDataEnabled, checkReceiveDataIntegrity);
						zigBeeGooier.ZigBeeUpdateConnectionStatus(remoteAddress, remoteAddrMode, isConnected: false);
						logger.Enqueue(new LogMessage(LogMessageType.Error, "Integrity check failed for sequential data, aborting data transfer"));
						break;
					}
				}
			}
			else
			{
				for (int j = 0; j < msdulength; j++)
				{
					if (msdudataList[j] != dataPattern)
					{
						zigBeeMainWorkerThread.StopRemoteDataTransfer((int)msduHandle, localAddressMode, remoteAddrMode, (uint)remoteAddress, dstPanId, msdulength, msduLength, dataPattern, continuousDataEnabled, sequentialDataEnabled, checkReceiveDataIntegrity);
						logger.Enqueue(new LogMessage(LogMessageType.Error, "Integrity check failed for data pattern " + dataPattern + ", aborting data transfer"));
						break;
					}
				}
			}
			totalReceivedBytes += (int)msdulength;
			receivedPackets++;
		}
	}

	public void CheckEnableTxButtonForAssociatedDevice()
	{
		if (isAssociatedTest)
		{
			if (remoteDeviceList.GetAssociatedDevice(out var address, out var addrMode, out var panId, out var num))
			{
				dstAddress = (long)address;
				dstPanId = panId;
				dstAddressMode = addrMode;
				channelId = num;
				dataTransfer15p4StartTxButton.Enabled = true;
			}
			else
			{
				dataTransfer15p4StartTxButton.Enabled = false;
			}
		}
		else
		{
			dataTransfer15p4StartTxButton.Enabled = true;
		}
	}

	private void dataTransfer15p4OptionsButton_Click(object sender, EventArgs e)
	{
		ZigBeeChooseUserDataOption zigBeeChooseUserDataOption = new ZigBeeChooseUserDataOption();
		zigBeeMainWorkerThread.ReadAddress(localAddressMode);
		int.TryParse(zigBeeGooier.localDUTAddress, NumberStyles.HexNumber, null, out var result);
		zigBeeChooseUserDataOption.LocalAddress = result;
		zigBeeChooseUserDataOption.AssociatedTest = isAssociatedTest;
		zigBeeChooseUserDataOption.ChannelID = (int)channelId;
		zigBeeChooseUserDataOption.DstAddressMode = dstAddressMode;
		zigBeeChooseUserDataOption.DstAddress = dstAddress;
		zigBeeChooseUserDataOption.LocalAddressMode = localAddressMode;
		zigBeeChooseUserDataOption.MsduLength = (int)msduLength;
		zigBeeChooseUserDataOption.MsduHandle = (int)msduHandle;
		zigBeeChooseUserDataOption.DstPanId = (int)dstPanId;
		zigBeeChooseUserDataOption.LocalPanId = (int)localPanId;
		zigBeeChooseUserDataOption.CheckReceiveDataIntegrity = checkReceiveDataIntegrity;
		zigBeeChooseUserDataOption.SequentialDataEnabled = sequentialDataEnabled;
		zigBeeChooseUserDataOption.ContinuousData = continuousDataEnabled;
		zigBeeChooseUserDataOption.NumPacketsToSend = (int)numPacketsToSend;
		zigBeeChooseUserDataOption.DataPattern = dataPattern;
		zigBeeChooseUserDataOption.AckTx = ackTx;
		zigBeeChooseUserDataOption.GtsTx = gtsTx;
		zigBeeChooseUserDataOption.IndirectTx = indirectTx;
		zigBeeChooseUserDataOption.ShowDialog();
		if (zigBeeChooseUserDataOption.DialogResult != DialogResult.OK)
		{
			return;
		}
		isAssociatedTest = zigBeeChooseUserDataOption.AssociatedTest;
		channelId = (uint)zigBeeChooseUserDataOption.ChannelID;
		dstAddressMode = zigBeeChooseUserDataOption.DstAddressMode;
		dstAddress = zigBeeChooseUserDataOption.DstAddress;
		localAddressMode = zigBeeChooseUserDataOption.LocalAddressMode;
		localAddress = zigBeeChooseUserDataOption.LocalAddress;
		msduLength = (uint)zigBeeChooseUserDataOption.MsduLength;
		msduHandle = (uint)zigBeeChooseUserDataOption.MsduHandle;
		dstPanId = (uint)zigBeeChooseUserDataOption.DstPanId;
		localPanId = (uint)zigBeeChooseUserDataOption.LocalPanId;
		sequentialDataEnabled = zigBeeChooseUserDataOption.SequentialDataEnabled;
		continuousDataEnabled = zigBeeChooseUserDataOption.ContinuousData;
		numPacketsToSend = (uint)zigBeeChooseUserDataOption.NumPacketsToSend;
		dataPattern = zigBeeChooseUserDataOption.DataPattern;
		ackTx = zigBeeChooseUserDataOption.AckTx;
		gtsTx = zigBeeChooseUserDataOption.GtsTx;
		indirectTx = zigBeeChooseUserDataOption.IndirectTx;
		checkReceiveDataIntegrity = zigBeeChooseUserDataOption.CheckReceiveDataIntegrity;
		zigBeeMainWorkerThread.WriteLocalAddress(localAddressMode, localAddress.ToString("X16"));
		if (isAssociatedTest)
		{
			if (remoteDeviceList.GetAssociatedDevice(out var address, out var addrMode, out var panId, out var num))
			{
				dstAddress = (long)address;
				dstPanId = panId;
				dstAddressMode = addrMode;
				channelId = num;
				dataTransfer15p4StartTxButton.Enabled = true;
			}
			else
			{
				dataTransfer15p4StartTxButton.Enabled = false;
			}
		}
		else
		{
			dataTransfer15p4StartTxButton.Enabled = true;
		}
	}

	private void dataTransfer15p4StartRxButton_Click(object sender, EventArgs e)
	{
		zigBeeMainWorkerThread.EnableRxIdle();
		zigBeeMainWorkerThread.SetChannel(channelId);
		zigBeeMainWorkerThread.SetPanId(localPanId);
	}

	private void dataTransfer15p4StartTxButton_Click(object sender, EventArgs e)
	{
		zigBeeMainWorkerThread.EnableRxIdle();
		zigBeeMainWorkerThread.SetChannel(channelId);
		zigBeeMainWorkerThread.SetPanId(localPanId);
		if (isAssociatedTest && dstPanId == 0)
		{
			dstPanId = localPanId;
		}
		zigBeeMainWorkerThread.StartDataTransfer((int)msduHandle, localAddressMode, dstAddressMode, dstAddress, dstPanId, channelId, msduLength, dataPattern, (int)numPacketsToSend, continuousDataEnabled, sequentialDataEnabled, checkReceiveDataIntegrity, ackTx, gtsTx, indirectTx);
		zigBeeGooier.ZigBeeUpdateConnectionStatus((ulong)dstAddress, dstAddressMode, isConnected: true);
		dataTransfer15p4StartTxButton.Enabled = false;
		dataTransfer15p4StopTxButton.Enabled = true;
		totalTransmittedBytes = 0;
		lastTransmittedBytes = 0.0;
		transmittedPackets = 0;
		missingAckPackets = 0;
		chAccessFailPackets = 0;
		transmitDataTimer.Enabled = true;
		txStopwatch.Reset();
		txDurationStopwatch.Reset();
	}

	private void dataTransfer15p4StopTxButton_Click(object sender, EventArgs e)
	{
		zigBeeMainWorkerThread.StopDataTransfer();
		transmitDataTimer.Enabled = false;
		dataTransfer15p4StartTxButton.Enabled = true;
		dataTransfer15p4StopTxButton.Enabled = false;
	}

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.dataTransfer15p4OptionsButton = new System.Windows.Forms.Button();
		this.dataTransfer15p4StartTxButton = new System.Windows.Forms.Button();
		this.dataTransfer15p4StopTxButton = new System.Windows.Forms.Button();
		this.groupBoxReceive = new System.Windows.Forms.GroupBox();
		this.textBoxRxDataRate = new System.Windows.Forms.TextBox();
		this.label2 = new System.Windows.Forms.Label();
		this.textBoxRxBytes = new System.Windows.Forms.TextBox();
		this.rxDataBytesLabel = new System.Windows.Forms.Label();
		this.rxDataPacketsLabel = new System.Windows.Forms.Label();
		this.textBoxRxPackets = new System.Windows.Forms.TextBox();
		this.groupBoxTransmit = new System.Windows.Forms.GroupBox();
		this.packetsMissingAckTextBox = new System.Windows.Forms.TextBox();
		this.labelPacketsMissingAck = new System.Windows.Forms.Label();
		this.textBoxTxDataRate = new System.Windows.Forms.TextBox();
		this.label1 = new System.Windows.Forms.Label();
		this.textBoxTxBytes = new System.Windows.Forms.TextBox();
		this.dataBytesLabel = new System.Windows.Forms.Label();
		this.txDataPacketsLabel = new System.Windows.Forms.Label();
		this.textBoxTxPackets = new System.Windows.Forms.TextBox();
		this.dataTransfer15p4StartRxButton = new System.Windows.Forms.Button();
		this.labelPacketsChAccessFail = new System.Windows.Forms.Label();
		this.chAccessFailTextBox = new System.Windows.Forms.TextBox();
		this.labelTxDataTransferDuration = new System.Windows.Forms.Label();
		this.labelRxDataTransferDuration = new System.Windows.Forms.Label();
		this.txTransferDurationTextBox = new System.Windows.Forms.TextBox();
		this.rxTransferDurationTextBox = new System.Windows.Forms.TextBox();
		this.groupBoxReceive.SuspendLayout();
		this.groupBoxTransmit.SuspendLayout();
		base.SuspendLayout();
		this.dataTransfer15p4OptionsButton.Location = new System.Drawing.Point(63, 237);
		this.dataTransfer15p4OptionsButton.Name = "dataTransfer15p4OptionsButton";
		this.dataTransfer15p4OptionsButton.Size = new System.Drawing.Size(75, 23);
		this.dataTransfer15p4OptionsButton.TabIndex = 0;
		this.dataTransfer15p4OptionsButton.Text = "Options ...";
		this.dataTransfer15p4OptionsButton.UseVisualStyleBackColor = true;
		this.dataTransfer15p4OptionsButton.Click += new System.EventHandler(dataTransfer15p4OptionsButton_Click);
		this.dataTransfer15p4StartTxButton.Location = new System.Drawing.Point(209, 237);
		this.dataTransfer15p4StartTxButton.Name = "dataTransfer15p4StartTxButton";
		this.dataTransfer15p4StartTxButton.Size = new System.Drawing.Size(75, 23);
		this.dataTransfer15p4StartTxButton.TabIndex = 1;
		this.dataTransfer15p4StartTxButton.Text = "Start Tx";
		this.dataTransfer15p4StartTxButton.UseVisualStyleBackColor = true;
		this.dataTransfer15p4StartTxButton.Click += new System.EventHandler(dataTransfer15p4StartTxButton_Click);
		this.dataTransfer15p4StopTxButton.Enabled = false;
		this.dataTransfer15p4StopTxButton.Location = new System.Drawing.Point(299, 237);
		this.dataTransfer15p4StopTxButton.Name = "dataTransfer15p4StopTxButton";
		this.dataTransfer15p4StopTxButton.Size = new System.Drawing.Size(75, 23);
		this.dataTransfer15p4StopTxButton.TabIndex = 2;
		this.dataTransfer15p4StopTxButton.Text = "Stop Tx";
		this.dataTransfer15p4StopTxButton.UseVisualStyleBackColor = true;
		this.dataTransfer15p4StopTxButton.Click += new System.EventHandler(dataTransfer15p4StopTxButton_Click);
		this.groupBoxReceive.Controls.Add(this.rxTransferDurationTextBox);
		this.groupBoxReceive.Controls.Add(this.labelRxDataTransferDuration);
		this.groupBoxReceive.Controls.Add(this.textBoxRxDataRate);
		this.groupBoxReceive.Controls.Add(this.label2);
		this.groupBoxReceive.Controls.Add(this.textBoxRxBytes);
		this.groupBoxReceive.Controls.Add(this.rxDataBytesLabel);
		this.groupBoxReceive.Controls.Add(this.rxDataPacketsLabel);
		this.groupBoxReceive.Controls.Add(this.textBoxRxPackets);
		this.groupBoxReceive.Location = new System.Drawing.Point(275, 3);
		this.groupBoxReceive.Name = "groupBoxReceive";
		this.groupBoxReceive.Size = new System.Drawing.Size(279, 195);
		this.groupBoxReceive.TabIndex = 3;
		this.groupBoxReceive.TabStop = false;
		this.groupBoxReceive.Text = "Receive";
		this.textBoxRxDataRate.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxRxDataRate.Location = new System.Drawing.Point(173, 74);
		this.textBoxRxDataRate.Name = "textBoxRxDataRate";
		this.textBoxRxDataRate.ReadOnly = true;
		this.textBoxRxDataRate.Size = new System.Drawing.Size(100, 20);
		this.textBoxRxDataRate.TabIndex = 7;
		this.label2.AutoSize = true;
		this.label2.Location = new System.Drawing.Point(21, 77);
		this.label2.Name = "label2";
		this.label2.Size = new System.Drawing.Size(119, 13);
		this.label2.TabIndex = 6;
		this.label2.Text = "MSDU data rate (kbps):";
		this.textBoxRxBytes.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxRxBytes.Location = new System.Drawing.Point(173, 48);
		this.textBoxRxBytes.Name = "textBoxRxBytes";
		this.textBoxRxBytes.ReadOnly = true;
		this.textBoxRxBytes.Size = new System.Drawing.Size(100, 20);
		this.textBoxRxBytes.TabIndex = 4;
		this.rxDataBytesLabel.AutoSize = true;
		this.rxDataBytesLabel.Location = new System.Drawing.Point(21, 51);
		this.rxDataBytesLabel.Name = "rxDataBytesLabel";
		this.rxDataBytesLabel.Size = new System.Drawing.Size(94, 13);
		this.rxDataBytesLabel.TabIndex = 4;
		this.rxDataBytesLabel.Text = "MSDU data bytes:";
		this.rxDataPacketsLabel.AutoSize = true;
		this.rxDataPacketsLabel.Location = new System.Drawing.Point(21, 22);
		this.rxDataPacketsLabel.Name = "rxDataPacketsLabel";
		this.rxDataPacketsLabel.Size = new System.Drawing.Size(74, 13);
		this.rxDataPacketsLabel.TabIndex = 4;
		this.rxDataPacketsLabel.Text = "Data packets:";
		this.textBoxRxPackets.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxRxPackets.Location = new System.Drawing.Point(173, 19);
		this.textBoxRxPackets.Name = "textBoxRxPackets";
		this.textBoxRxPackets.ReadOnly = true;
		this.textBoxRxPackets.Size = new System.Drawing.Size(100, 20);
		this.textBoxRxPackets.TabIndex = 1;
		this.groupBoxTransmit.Controls.Add(this.txTransferDurationTextBox);
		this.groupBoxTransmit.Controls.Add(this.labelTxDataTransferDuration);
		this.groupBoxTransmit.Controls.Add(this.chAccessFailTextBox);
		this.groupBoxTransmit.Controls.Add(this.labelPacketsChAccessFail);
		this.groupBoxTransmit.Controls.Add(this.packetsMissingAckTextBox);
		this.groupBoxTransmit.Controls.Add(this.labelPacketsMissingAck);
		this.groupBoxTransmit.Controls.Add(this.textBoxTxDataRate);
		this.groupBoxTransmit.Controls.Add(this.label1);
		this.groupBoxTransmit.Controls.Add(this.textBoxTxBytes);
		this.groupBoxTransmit.Controls.Add(this.dataBytesLabel);
		this.groupBoxTransmit.Controls.Add(this.txDataPacketsLabel);
		this.groupBoxTransmit.Controls.Add(this.textBoxTxPackets);
		this.groupBoxTransmit.Location = new System.Drawing.Point(3, 3);
		this.groupBoxTransmit.Name = "groupBoxTransmit";
		this.groupBoxTransmit.Size = new System.Drawing.Size(266, 195);
		this.groupBoxTransmit.TabIndex = 4;
		this.groupBoxTransmit.TabStop = false;
		this.groupBoxTransmit.Text = "Transmit";
		this.packetsMissingAckTextBox.BackColor = System.Drawing.SystemColors.Control;
		this.packetsMissingAckTextBox.Location = new System.Drawing.Point(160, 102);
		this.packetsMissingAckTextBox.Name = "packetsMissingAckTextBox";
		this.packetsMissingAckTextBox.ReadOnly = true;
		this.packetsMissingAckTextBox.Size = new System.Drawing.Size(100, 20);
		this.packetsMissingAckTextBox.TabIndex = 7;
		this.labelPacketsMissingAck.AutoSize = true;
		this.labelPacketsMissingAck.Location = new System.Drawing.Point(16, 105);
		this.labelPacketsMissingAck.Name = "labelPacketsMissingAck";
		this.labelPacketsMissingAck.Size = new System.Drawing.Size(136, 13);
		this.labelPacketsMissingAck.TabIndex = 6;
		this.labelPacketsMissingAck.Text = "Total packets missing ACK:";
		this.textBoxTxDataRate.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxTxDataRate.Location = new System.Drawing.Point(160, 74);
		this.textBoxTxDataRate.Name = "textBoxTxDataRate";
		this.textBoxTxDataRate.ReadOnly = true;
		this.textBoxTxDataRate.Size = new System.Drawing.Size(100, 20);
		this.textBoxTxDataRate.TabIndex = 5;
		this.label1.AutoSize = true;
		this.label1.Location = new System.Drawing.Point(16, 77);
		this.label1.Name = "label1";
		this.label1.Size = new System.Drawing.Size(119, 13);
		this.label1.TabIndex = 4;
		this.label1.Text = "MSDU data rate (kbps):";
		this.textBoxTxBytes.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxTxBytes.Location = new System.Drawing.Point(160, 48);
		this.textBoxTxBytes.Name = "textBoxTxBytes";
		this.textBoxTxBytes.ReadOnly = true;
		this.textBoxTxBytes.Size = new System.Drawing.Size(100, 20);
		this.textBoxTxBytes.TabIndex = 3;
		this.dataBytesLabel.AutoSize = true;
		this.dataBytesLabel.Location = new System.Drawing.Point(16, 51);
		this.dataBytesLabel.Name = "dataBytesLabel";
		this.dataBytesLabel.Size = new System.Drawing.Size(94, 13);
		this.dataBytesLabel.TabIndex = 2;
		this.dataBytesLabel.Text = "MSDU data bytes:";
		this.txDataPacketsLabel.AutoSize = true;
		this.txDataPacketsLabel.Location = new System.Drawing.Point(16, 22);
		this.txDataPacketsLabel.Name = "txDataPacketsLabel";
		this.txDataPacketsLabel.Size = new System.Drawing.Size(74, 13);
		this.txDataPacketsLabel.TabIndex = 1;
		this.txDataPacketsLabel.Text = "Data packets:";
		this.textBoxTxPackets.BackColor = System.Drawing.SystemColors.Control;
		this.textBoxTxPackets.Location = new System.Drawing.Point(160, 19);
		this.textBoxTxPackets.Name = "textBoxTxPackets";
		this.textBoxTxPackets.ReadOnly = true;
		this.textBoxTxPackets.Size = new System.Drawing.Size(100, 20);
		this.textBoxTxPackets.TabIndex = 0;
		this.dataTransfer15p4StartRxButton.Location = new System.Drawing.Point(433, 237);
		this.dataTransfer15p4StartRxButton.Name = "dataTransfer15p4StartRxButton";
		this.dataTransfer15p4StartRxButton.Size = new System.Drawing.Size(75, 23);
		this.dataTransfer15p4StartRxButton.TabIndex = 5;
		this.dataTransfer15p4StartRxButton.Text = "Start Rx";
		this.dataTransfer15p4StartRxButton.UseVisualStyleBackColor = true;
		this.dataTransfer15p4StartRxButton.Click += new System.EventHandler(dataTransfer15p4StartRxButton_Click);
		this.labelPacketsChAccessFail.AutoSize = true;
		this.labelPacketsChAccessFail.Location = new System.Drawing.Point(16, 134);
		this.labelPacketsChAccessFail.Name = "labelPacketsChAccessFail";
		this.labelPacketsChAccessFail.Size = new System.Drawing.Size(121, 13);
		this.labelPacketsChAccessFail.TabIndex = 8;
		this.labelPacketsChAccessFail.Text = "Channel Access Failure:";
		this.chAccessFailTextBox.Location = new System.Drawing.Point(160, 131);
		this.chAccessFailTextBox.Name = "chAccessFailTextBox";
		this.chAccessFailTextBox.ReadOnly = true;
		this.chAccessFailTextBox.Size = new System.Drawing.Size(100, 20);
		this.chAccessFailTextBox.TabIndex = 9;
		this.labelTxDataTransferDuration.AutoSize = true;
		this.labelTxDataTransferDuration.Location = new System.Drawing.Point(16, 163);
		this.labelTxDataTransferDuration.Name = "labelTxDataTransferDuration";
		this.labelTxDataTransferDuration.Size = new System.Drawing.Size(118, 13);
		this.labelTxDataTransferDuration.TabIndex = 10;
		this.labelTxDataTransferDuration.Text = "Data Transfer Duration:";
		this.labelRxDataTransferDuration.AutoSize = true;
		this.labelRxDataTransferDuration.Location = new System.Drawing.Point(21, 102);
		this.labelRxDataTransferDuration.Name = "labelRxDataTransferDuration";
		this.labelRxDataTransferDuration.Size = new System.Drawing.Size(118, 13);
		this.labelRxDataTransferDuration.TabIndex = 8;
		this.labelRxDataTransferDuration.Text = "Data Transfer Duration:";
		this.txTransferDurationTextBox.Location = new System.Drawing.Point(160, 160);
		this.txTransferDurationTextBox.Name = "txTransferDurationTextBox";
		this.txTransferDurationTextBox.ReadOnly = true;
		this.txTransferDurationTextBox.Size = new System.Drawing.Size(100, 20);
		this.txTransferDurationTextBox.TabIndex = 11;
		this.rxTransferDurationTextBox.Location = new System.Drawing.Point(173, 99);
		this.rxTransferDurationTextBox.Name = "rxTransferDurationTextBox";
		this.rxTransferDurationTextBox.ReadOnly = true;
		this.rxTransferDurationTextBox.Size = new System.Drawing.Size(100, 20);
		this.rxTransferDurationTextBox.TabIndex = 9;
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.Controls.Add(this.dataTransfer15p4StartRxButton);
		base.Controls.Add(this.groupBoxTransmit);
		base.Controls.Add(this.groupBoxReceive);
		base.Controls.Add(this.dataTransfer15p4StopTxButton);
		base.Controls.Add(this.dataTransfer15p4StartTxButton);
		base.Controls.Add(this.dataTransfer15p4OptionsButton);
		base.Name = "ZigBeeDataTransferUserControl";
		base.Size = new System.Drawing.Size(557, 381);
		this.groupBoxReceive.ResumeLayout(false);
		this.groupBoxReceive.PerformLayout();
		this.groupBoxTransmit.ResumeLayout(false);
		this.groupBoxTransmit.PerformLayout();
		base.ResumeLayout(false);
	}
}
