Prasad Bhagat

Prasad Bhagat

  • NA
  • 516
  • 235.2k

what is the reason the static method was not firing ?

May 13 2016 10:28 AM
Dear All,
 
please find the bellow code .
 
public partial class Form1 : Form
{
static ImpinjReader reader = new ImpinjReader();
public Form1()
{
InitializeComponent();
//Connect();
}
private void Connect()
{
try
{
#region
IPAddress ipAddress = new IPAddress(new byte[] { 169, 254, 1, 1 });
//IPAddress ipAddress = new IPAddress(new byte[] { 192, 168, 0, 112 });
TcpListener lsnr = new TcpListener(ipAddress, 14150);
//lsnr.Start();
// Connect to the reader.
// Change the ReaderHostname constant in SolutionConstants.cs
// to the IP address or hostname of your reader.
reader.Connect("169.254.1.1");
// Get the default settings
// We'll use these as a starting point
// and then modify the settings we're
// interested in.
Settings settings = reader.QueryDefaultSettings();
// Tell the reader to include the antenna number
// in all tag reports. Other fields can be added
// to the reports in the same way by setting the
// appropriate Report.IncludeXXXXXXX property.
settings.Report.IncludeAntennaPortNumber = true;
// Set the reader mode, search mode and session
settings.ReaderMode = ReaderMode.AutoSetDenseReader;
settings.SearchMode = SearchMode.DualTarget;
settings.Session = 2;
// Enable antenna #1. Disable all others.
settings.Antennas.DisableAll();
settings.Antennas.GetAntenna(2).IsEnabled = true;
// Set the Transmit Power and
// Receive Sensitivity to the maximum.
settings.Antennas.GetAntenna(2).MaxTxPower = true;
settings.Antennas.GetAntenna(2).MaxRxSensitivity = true;
// You can also set them to specific values like this...
//settings.Antennas.GetAntenna(1).TxPowerInDbm = 20;
//settings.Antennas.GetAntenna(1).RxSensitivityInDbm = -70;
// Apply the newly modified settings.
reader.ApplySettings(settings);
// Assign the TagsReported event handler.
// This specifies which method to call
// when tags reports are available.
//reader.TagsReported +=reader_TagsReported;
reader.TagsReported += new ImpinjReader.TagsReportedHandler(reader_TagsReported);
// Start reading.
reader.Start();
// Wait for the user to press enter.
//Console.WriteLine("Press enter to exit.");
//Console.ReadLine();
// Stop reading.
reader.Stop();
// Disconnect from the reader.
reader.Disconnect();
#endregion
}
catch (OctaneSdkException e)
{
// Handle Octane SDK errors.
MessageBox.Show("Octane SDK exception: " + e.Message.ToString());
}
catch (Exception e)
{
// Handle other .NET errors.
MessageBox.Show("Exception : " + e.Message.ToString());
}
}
static void reader_TagsReported(ImpinjReader sender, TagReport report)
{
foreach (Tag tag in report)
{
//lblResult.Text = tag.AntennaPortNumber.ToString() + "\n" + tag.Epc.ToString() + "\n" + tag.Epc.CountBytes.ToString();
MessageBox.Show("Antenna : " + tag.AntennaPortNumber.ToString());
MessageBox.Show("EPC : " + tag.Epc.ToString());
MessageBox.Show("CountBytes : " + tag.Epc.CountBytes.ToString());
MessageBox.Show("Data : " + tag.Epc.ToString());
}
}
private void btnReadTag_Click(object sender, EventArgs e)
{
Connect();
}
}
 
in the abow program the  static void reader_TagsReported  THE METHOD WAS NOT FIRING PLEASE HELP ME

Answers (1)