jefffhaynes/XBee

XBeeNode.SampleReceived Handler not called. Continued

Closed this issue · 16 comments

Hope you don't mind, I wanted to start a fresh Issue, because the other one had gotten to lengthy.

Anyway, my way of initializing the XBeeNode.SampleReceived handler still doesn't work. However, I made a test, adapting your DiscoverNetwork example and it works.

I did find 2 Issues:

#1) args.Name is missing the first character of the Name for all nodes found.

#2) DiscoverNetworkAsync does not discover Sleeping Nodes, which is to be expected because they are asleep. That is why I developed a reactive system that adds nodes when they send a sample for the first time.

Now I'm back to my original problem. I remember you said you tried my code on your machine and it worked. I am lost at this point. You just suggested that it might be a difference in the way we are creating nodes, but you ran my code on your system and it was calling the Node_SampleReceived Handler.

Anyway, I have made something that does work, and it is always good to know that everything can work. However, it won't work for what I need, because of the sleeping nodes. Any suggestions would be greatly appreciated.
Thanks, Paul.


THIS CODE WORKS to call the Node_SampleReceived Handler

using System;
using System.Windows;
using XBee;

namespace WpfApp2 {
///


/// Interaction logic for MainWindow.xaml
///

public partial class MainWindow : Window {
private XBeeController controller = null;

	public MainWindow() {
		InitializeComponent();
		controller = new XBeeController();

		controller.NodeDiscovered += NodeDiscovered;

		Await_DiscoverController();
	}

	//----------------------------------------------------------

	private async void Await_DiscoverController() {
		try {
			await controller.OpenAsync( "COM3", 115200 );
			// NOTE: DiscoverNetworkAsync does not discover Sleeping Nodes  < < < < < < < < < < < <
			await controller.DiscoverNetworkAsync();
		}
		catch ( Exception e ) {
			string s = e.Message;
		}
	}

	//----------------------------------------------------------

	private void NodeDiscovered( object sender, NodeDiscoveredEventArgs args ) {
	// NOTE: args.Name is missing the first character of the Name for all nodes found  < < < < < < < < < < < <
	string s = args.Name;
		if ( args.Node.Address.LongAddress.Value == 0x0013A20040F4F731 ) {
			args.Node.SampleReceived += Node_SampleReceived;
		}
	}

	//---------------------------------------------------------------------------

	private int _sampleReceived_Cntr = 0;
	private void Node_SampleReceived( object sender, SampleReceivedEventArgs e ) {
		_sampleReceived_Cntr++;
	}



}

}

Sorry, I misunderstood.

I assume you mean the profile.xml files.
When I try to add them here, I get an error of: We don't support that file type.
Is there another way to export from XCTU or another way to attach these xml files?

Just found out I could reply to your email with them attached.

Did they come through on the email reply?

Hmm... Let me look in to that.

Haven't used onedrive since it was skydrive, here goes:

https://1drv.ms/f/s!ArPDpRHDMgzfehRpy01XdthK3uo

That should be a link to the files. Let me know if it works.

Thanks I appreciate all the help.
Remember, there is no rush. I am using your old code that works perfect. I just need this so I don't remain trapped in the past, and can't access new features.
Thanks,
Paul

I tried loading both. Coordinator, no problem. For some reason the router config is putting the node into a state where I can't talk to it (locally) and I have to do a forced recovery on it. Have you seen this?

I also realized that I only have one S2C module so I may have to order a second one before I can reproduce this. I don't mind but obviously it'll be a few days...

OOPS! I sent you the Router config off the xbee network, after my software had changed the DIN pin to an output. I just added the unchanged profile to one drive as profile_Router_2.xml. Does the link above still work to be able to get at it.

No worries. No, the folder just has the coord config now.

Yup, that works but I am going to need more nodes to reproduce. I ordered them so hopefully it won't take too long.

Found it! Try 1.5.4