Add Notification (Enable):
private void btnEnableNotification_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
try
{
if (!registerMessageReceived)
{
comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);
registerMessageReceived = true;
}
comm.EnableMessageNotifications();
Output("Message notifications activated.");
Output("");
}
catch (Exception ex)
{
ShowException(ex);
}
Cursor.Current = Cursors.Default;
}
Add RequestStatusReport True:
if (chkReport.Checked)
pdu.RequestStatusReport = true;
Show Output of Status:
private void comm_MessageReceived(object sender, MessageReceivedEventArgs e)
{
try
{
IMessageIndicationObject obj = e.IndicationObject;
if (obj is MemoryLocation)
{
MemoryLocation loc = (MemoryLocation)obj;
Output(string.Format("New message received in storage \"{0}\", index {1}.",
loc.Storage, loc.Index));
Output("");
return;
}
Output("Error: Unknown notification object!");
}
catch (Exception ex)
{
ShowException(ex);
}
}